annotate lisp/gdb-ui.el @ 51651:a81c039e79f9

(Advising Primitives): Renamed from Subr Arguments. Explain that advising primitives doesn't affect calls from C code.
author Richard M. Stallman <rms@gnu.org>
date Tue, 24 Jun 2003 18:14:01 +0000
parents cef03ad7bf21
children 04628db4db1a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1 ;;; gdb-ui.el --- User Interface for running GDB
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
3 ;; Author: Nick Roberts <nick@nick.uklinux.net>
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
4 ;; Maintainer: FSF
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
5 ;; Keywords: unix, tools
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
6
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
7 ;; Copyright (C) 2002 Free Software Foundation, Inc.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
8
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
10
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
14 ;; any later version.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
15
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
19 ;; GNU General Public License for more details.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
20
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
24 ;; Boston, MA 02111-1307, USA.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
25
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
26 ;;; Commentary:
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
27
49249
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
28 ;; This mode acts as a graphical user interface to GDB. You can interact with
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
29 ;; GDB through the GUD buffer in the usual way, but there are also further
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
30 ;; buffers which control the execution and describe the state of your program.
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
31 ;; It separates the input/output of your program from that of GDB and displays
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
32 ;; expressions and their current values in their own buffers. It also uses
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
33 ;; features of Emacs 21 such as the display margin for breakpoints, and the
51529
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
34 ;; toolbar (see the GDB Graphical Interface section in the Emacs info manual).
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
35
49249
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
36 ;; Start the debugger with M-x gdba.
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
37
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
38 ;; This file is based on gdba.el from GDB 5.0 written by Tom Lord and Jim
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
39 ;; Kingdon and uses GDB's annotation interface. You don't need to know about
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
40 ;; annotations to use this mode as a debugger, but if you are interested
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
41 ;; developing the mode itself, then see the Annotations section in the GDB
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
42 ;; info manual.
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
43 ;;
51617
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
44 ;; Known Bugs:
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
45 ;; Does not auto-display arrays of structures or structures containing arrays.
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
46 ;; On MS Windows, Gdb 5.1.1 from MinGW 2.0 does not flush the output from the
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
47 ;; inferior.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
48
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
49 ;;; Code:
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
50
48300
69646014abb3 Fix feature name in `require'.
Juanma Barranquero <lekktu@gmail.com>
parents: 48292
diff changeset
51 (require 'gud)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
52
49249
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
53 (defcustom gdb-window-height 20
51227
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
54 "Number of lines in a frame for a displayed expression in GDB-UI."
49249
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
55 :type 'integer
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
56 :group 'gud)
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
57
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
58 (defcustom gdb-window-width 30
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
59 "Width of a frame for a displayed expression in GDB-UI."
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
60 :type 'integer
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
61 :group 'gud)
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
62
51617
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
63 (defvar gdb-current-address "main" "Initialisation for Assembler buffer.")
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
64 (defvar gdb-previous-address nil)
51529
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
65 (defvar gdb-previous-frame nil)
51617
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
66 (defvar gdb-current-frame "main")
48498
8fdedd7dca85 General tidying. Patches from Stefan Monnier.
Nick Roberts <nickrob@snap.net.nz>
parents: 48300
diff changeset
67 (defvar gdb-display-in-progress nil)
8fdedd7dca85 General tidying. Patches from Stefan Monnier.
Nick Roberts <nickrob@snap.net.nz>
parents: 48300
diff changeset
68 (defvar gdb-dive nil)
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
69 (defvar gdb-view-source t "Non-nil means that source code can be viewed")
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
70 (defvar gdb-selected-view 'source "Code type that user wishes to view")
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
71 (defvar gdb-buffer-type nil)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
72 (defvar gdb-variables '()
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
73 "A list of variables that are local to the GUD buffer.")
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
74
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
75
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
76 ;;;###autoload
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
77 (defun gdba (command-line)
48827
dc51e4b2d5c1 Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48738
diff changeset
78 "Run gdb on program FILE in buffer *gud-FILE*.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
79 The directory containing FILE becomes the initial working directory
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
80 and source-file directory for your debugger.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
81
48827
dc51e4b2d5c1 Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48738
diff changeset
82 If `gdb-many-windows' is nil (the default value) then gdb starts with
dc51e4b2d5c1 Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48738
diff changeset
83 just two windows : the GUD and the source buffer. If it is t the
dc51e4b2d5c1 Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48738
diff changeset
84 following layout will appear (keybindings given in relevant buffer) :
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
85
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
86 ---------------------------------------------------------------------
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
87 GDB Toolbar
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
88 ---------------------------------------------------------------------
48827
dc51e4b2d5c1 Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48738
diff changeset
89 GUD buffer (I/O of GDB) | Locals buffer
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
90 |
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
91 |
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
92 |
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
93 ---------------------------------------------------------------------
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
94 Source buffer | Input/Output (of debuggee) buffer
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
95 | (comint-mode)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
96 |
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
97 |
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
98 |
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
99 |
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
100 |
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
101 |
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
102 ---------------------------------------------------------------------
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
103 Stack buffer | Breakpoints buffer
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
104 RET gdb-frames-select | SPC gdb-toggle-breakpoint
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
105 | RET gdb-goto-breakpoint
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
106 | d gdb-delete-breakpoint
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
107 ---------------------------------------------------------------------
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
108
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
109 All the buffers share the toolbar and source should always display in the same
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
110 window e.g after typing g on a breakpoint in the breakpoints buffer. Breakpoint
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
111 icons are displayed both by setting a break with gud-break and by typing break
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
112 in the GUD buffer.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
113
48827
dc51e4b2d5c1 Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48738
diff changeset
114 This works best (depending on the size of your monitor) using most of the
dc51e4b2d5c1 Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48738
diff changeset
115 screen.
dc51e4b2d5c1 Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48738
diff changeset
116
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
117 Displayed expressions appear in separate frames. Arrays may be displayed
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
118 as slices and visualised using the graph program from plotutils if installed.
48827
dc51e4b2d5c1 Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48738
diff changeset
119 Pointers in structures may be followed in a tree-like fashion.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
120
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
121 The following interactive lisp functions help control operation :
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
122
48827
dc51e4b2d5c1 Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48738
diff changeset
123 `gdb-many-windows' - Toggle the number of windows gdb uses.
dc51e4b2d5c1 Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48738
diff changeset
124 `gdb-restore-windows' - To restore the window layout.
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49249
diff changeset
125 `gdb-quit' - To delete (most) of the buffers used by GDB-UI and
48827
dc51e4b2d5c1 Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48738
diff changeset
126 reset variables."
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
127 ;;
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
128 (interactive (list (gud-query-cmdline 'gdba)))
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
129 ;;
48682
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
130 ;; Let's start with a basic gud-gdb buffer and then modify it a bit.
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
131 (gdb command-line)
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
132 ;;
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
133 (set (make-local-variable 'gud-minor-mode) 'gdba)
48884
f774c94b3b5e (gdba-marker-filter, gdb-output-burst): Merge and
Nick Roberts <nickrob@snap.net.nz>
parents: 48827
diff changeset
134 (set (make-local-variable 'gud-marker-filter) 'gud-gdba-marker-filter)
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
135 ;;
48682
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
136 (gud-def gud-break (if (not (string-equal mode-name "Assembler"))
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
137 (gud-call "break %f:%l" arg)
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
138 (save-excursion
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
139 (beginning-of-line)
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
140 (forward-char 2)
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
141 (gud-call "break *%a" arg)))
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
142 "\C-b" "Set breakpoint at current line or address.")
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
143 ;;
48682
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
144 (gud-def gud-remove (if (not (string-equal mode-name "Assembler"))
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
145 (gud-call "clear %f:%l" arg)
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
146 (save-excursion
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
147 (beginning-of-line)
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
148 (forward-char 2)
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
149 (gud-call "clear *%a" arg)))
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
150 "\C-d" "Remove breakpoint at current line or address.")
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
151 ;;
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
152 (gud-def gud-until (if (not (string-equal mode-name "Assembler"))
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
153 (gud-call "until %f:%l" arg)
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
154 (save-excursion
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
155 (beginning-of-line)
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
156 (forward-char 2)
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
157 (gud-call "until *%a" arg)))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
158 "\C-u" "Continue to current line or address.")
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
159
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
160 (setq comint-input-sender 'gdb-send)
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
161 ;;
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
162 ;; (re-)initialise
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
163 (setq gdb-current-address "main")
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
164 (setq gdb-previous-address nil)
51529
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
165 (setq gdb-previous-frame nil)
51617
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
166 (setq gdb-current-frame "main")
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
167 (setq gdb-display-in-progress nil)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
168 (setq gdb-dive nil)
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
169 (setq gdb-view-source t)
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
170 (setq gdb-selected-view 'source)
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
171 ;;
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
172 (mapc 'make-local-variable gdb-variables)
48884
f774c94b3b5e (gdba-marker-filter, gdb-output-burst): Merge and
Nick Roberts <nickrob@snap.net.nz>
parents: 48827
diff changeset
173 (setq gdb-buffer-type 'gdba)
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
174 ;;
48682
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
175 (gdb-clear-inferior-io)
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
176 ;;
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
177 (if (eq window-system 'w32)
51123
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
178 (gdb-enqueue-input (list "set new-console off\n" 'ignore)))
49039
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
179 (gdb-enqueue-input (list "set height 0\n" 'ignore))
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
180 ;; find source file and compilation directory here
51617
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
181 (gdb-enqueue-input (list "server list main\n" 'ignore)) ; C program
51172
61a988cae9b2 (gdba): Accommodate Fortran programs.
Nick Roberts <nickrob@snap.net.nz>
parents: 51123
diff changeset
182 (gdb-enqueue-input (list "server list MAIN__\n" 'ignore)) ; Fortran program
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
183 (gdb-enqueue-input (list "server info source\n"
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
184 'gdb-source-info))
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
185 ;;
48682
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
186 (run-hooks 'gdba-mode-hook))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
187
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
188 (defun gud-display ()
49039
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
189 "Auto-display (possibly dereferenced) C expression at point."
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
190 (interactive)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
191 (save-excursion
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
192 (let ((expr (gud-find-c-expr)))
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
193 (gdb-enqueue-input
49147
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
194 (list (concat "server ptype " expr "\n")
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
195 `(lambda () (gud-display1 ,expr)))))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
196
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
197 (defun gud-display1 (expr)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
198 (goto-char (point-min))
49147
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
199 (if (looking-at "No symbol")
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
200 (progn
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
201 (gdb-set-output-sink 'user)
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
202 (gud-call (concat "server ptype " expr)))
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
203 (goto-char (- (point-max) 1))
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
204 (if (equal (char-before) (string-to-char "\*"))
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
205 (gdb-enqueue-input
51617
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
206 (list (concat "display* " expr "\n") 'ignore))
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
207 (gdb-enqueue-input
51617
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
208 (list (concat "display " expr "\n") 'ignore)))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
209
49039
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
210 ; this would messy because these bindings don't work with M-x gdb
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
211 ; (define-key global-map "\C-x\C-a\C-a" 'gud-display)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
212 ; (define-key gud-minor-mode-map "\C-c\C-a" 'gud-display)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
213
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
214
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
215
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
216 ;; ======================================================================
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
217 ;;
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
218 ;; In this world, there are gdb variables (of unspecified
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
219 ;; representation) and buffers associated with those objects.
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
220 ;; The list of variables is built up by the expansions of
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
221 ;; def-gdb-variable
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
222
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
223 (defmacro def-gdb-var (root-symbol &optional default doc)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
224 (let* ((root (symbol-name root-symbol))
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
225 (accessor (intern (concat "gdb-get-" root)))
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
226 (setter (intern (concat "gdb-set-" root)))
48640
7bc8b0b65a02 (gdba): Use the default for gud-find-file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48639
diff changeset
227 (name (intern (concat "gdb-" root))))
7bc8b0b65a02 (gdba): Use the default for gud-find-file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48639
diff changeset
228 `(progn
7bc8b0b65a02 (gdba): Use the default for gud-find-file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48639
diff changeset
229 (defvar ,name ,default ,doc)
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
230 (if (not (memq ',name gdb-variables))
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
231 (push ',name gdb-variables))
48685
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
232 (defun ,accessor ()
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
233 (buffer-local-value ',name gud-comint-buffer))
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
234 (defun ,setter (val)
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
235 (with-current-buffer gud-comint-buffer
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
236 (setq ,name val))))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
237
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
238 (def-gdb-var buffer-type nil
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
239 "One of the symbols bound in gdb-buffer-rules")
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
240
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
241 (def-gdb-var burst ""
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
242 "A string of characters from gdb that have not yet been processed.")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
243
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
244 (def-gdb-var input-queue ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
245 "A list of high priority gdb command objects.")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
246
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
247 (def-gdb-var idle-input-queue ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
248 "A list of low priority gdb command objects.")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
249
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
250 (def-gdb-var prompting nil
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
251 "True when gdb is idle with no pending input.")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
252
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
253 (def-gdb-var output-sink 'user
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
254 "The disposition of the output of the current gdb command.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
255 Possible values are these symbols:
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
256
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
257 user -- gdb output should be copied to the GUD buffer
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
258 for the user to see.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
259
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
260 inferior -- gdb output should be copied to the inferior-io buffer
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
261
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
262 pre-emacs -- output should be ignored util the post-prompt
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
263 annotation is received. Then the output-sink
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
264 becomes:...
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
265 emacs -- output should be collected in the partial-output-buffer
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
266 for subsequent processing by a command. This is the
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
267 disposition of output generated by commands that
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
268 gdb mode sends to gdb on its own behalf.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
269 post-emacs -- ignore input until the prompt annotation is
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
270 received, then go to USER disposition.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
271 ")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
272
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
273 (def-gdb-var current-item nil
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
274 "The most recent command item sent to gdb.")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
275
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
276 (def-gdb-var pending-triggers '()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
277 "A list of trigger functions that have run later than their output
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
278 handlers.")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
279
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
280 ;; end of gdb variables
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
281
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
282 (defun gdb-get-target-string ()
48884
f774c94b3b5e (gdba-marker-filter, gdb-output-burst): Merge and
Nick Roberts <nickrob@snap.net.nz>
parents: 48827
diff changeset
283 (with-current-buffer gud-comint-buffer
f774c94b3b5e (gdba-marker-filter, gdb-output-burst): Merge and
Nick Roberts <nickrob@snap.net.nz>
parents: 48827
diff changeset
284 gud-target-name))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
285
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
286
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
287 ;;
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
288 ;; gdb buffers.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
289 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
290 ;; Each buffer has a TYPE -- a symbol that identifies the function
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
291 ;; of that particular buffer.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
292 ;;
48738
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
293 ;; The usual gdb interaction buffer is given the type `gdba' and
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
294 ;; is constructed specially.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
295 ;;
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
296 ;; Others are constructed by gdb-get-create-buffer and
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
297 ;; named according to the rules set forth in the gdb-buffer-rules-assoc
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
298
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
299 (defvar gdb-buffer-rules-assoc '())
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
300
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
301 (defun gdb-get-buffer (key)
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
302 "Return the gdb buffer tagged with type KEY.
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
303 The key should be one of the cars in `gdb-buffer-rules-assoc'."
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
304 (save-excursion
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
305 (gdb-look-for-tagged-buffer key (buffer-list))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
306
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
307 (defun gdb-get-create-buffer (key)
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
308 "Create a new gdb buffer of the type specified by KEY.
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
309 The key should be one of the cars in `gdb-buffer-rules-assoc'."
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
310 (or (gdb-get-buffer key)
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
311 (let* ((rules (assoc key gdb-buffer-rules-assoc))
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
312 (name (funcall (gdb-rules-name-maker rules)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
313 (new (get-buffer-create name)))
48685
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
314 (with-current-buffer new
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
315 ;; FIXME: This should be set after calling the function, since the
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
316 ;; function should run kill-all-local-variables.
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
317 (set (make-local-variable 'gdb-buffer-type) key)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
318 (if (cdr (cdr rules))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
319 (funcall (car (cdr (cdr rules)))))
48685
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
320 (set (make-local-variable 'gud-comint-buffer) gud-comint-buffer)
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
321 (set (make-local-variable 'gud-minor-mode) 'gdba)
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
322 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
323 new))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
324
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
325 (defun gdb-rules-name-maker (rules) (car (cdr rules)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
326
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
327 (defun gdb-look-for-tagged-buffer (key bufs)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
328 (let ((retval nil))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
329 (while (and (not retval) bufs)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
330 (set-buffer (car bufs))
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
331 (if (eq gdb-buffer-type key)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
332 (setq retval (car bufs)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
333 (setq bufs (cdr bufs)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
334 retval))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
335
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
336 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
337 ;; This assoc maps buffer type symbols to rules. Each rule is a list of
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
338 ;; at least one and possible more functions. The functions have these
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
339 ;; roles in defining a buffer type:
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
340 ;;
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
341 ;; NAME - Return a name for this buffer type.
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
342 ;;
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
343 ;; The remaining function(s) are optional:
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
344 ;;
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
345 ;; MODE - called in a new buffer with no arguments, should establish
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
346 ;; the proper mode for the buffer.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
347 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
348
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
349 (defun gdb-set-buffer-rules (buffer-type &rest rules)
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
350 (let ((binding (assoc buffer-type gdb-buffer-rules-assoc)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
351 (if binding
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
352 (setcdr binding rules)
48685
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
353 (push (cons buffer-type rules)
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
354 gdb-buffer-rules-assoc))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
355
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
356 ;; GUD buffers are an exception to the rules
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
357 (gdb-set-buffer-rules 'gdba 'error)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
358
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
359 ;;
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
360 ;; Partial-output buffer : This accumulates output from a command executed on
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
361 ;; behalf of emacs (rather than the user).
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
362 ;;
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
363 (gdb-set-buffer-rules 'gdb-partial-output-buffer
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
364 'gdb-partial-output-name)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
365
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
366 (defun gdb-partial-output-name ()
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
367 (concat "*partial-output-"
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
368 (gdb-get-target-string)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
369 "*"))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
370
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
371
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
372 (gdb-set-buffer-rules 'gdb-inferior-io
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
373 'gdb-inferior-io-name
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
374 'gdb-inferior-io-mode)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
375
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
376 (defun gdb-inferior-io-name ()
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
377 (concat "*input/output of "
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
378 (gdb-get-target-string)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
379 "*"))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
380
48661
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
381 (defvar gdb-inferior-io-mode-map
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
382 (let ((map (make-sparse-keymap)))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
383 (define-key map "\C-c\C-c" 'gdb-inferior-io-interrupt)
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
384 (define-key map "\C-c\C-z" 'gdb-inferior-io-stop)
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
385 (define-key map "\C-c\C-\\" 'gdb-inferior-io-quit)
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
386 (define-key map "\C-c\C-d" 'gdb-inferior-io-eof)
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
387 map))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
388
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
389 (define-derived-mode gdb-inferior-io-mode comint-mode "Debuggee I/O"
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
390 "Major mode for gdb inferior-io."
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
391 :syntax-table nil :abbrev-table nil
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
392 ;; We want to use comint because it has various nifty and familiar
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
393 ;; features. We don't need a process, but comint wants one, so create
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
394 ;; a dummy one.
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
395 (make-comint-in-buffer
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
396 (substring (buffer-name) 1 (- (length (buffer-name)) 1))
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
397 (current-buffer) "hexl")
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
398 (setq comint-input-sender 'gdb-inferior-io-sender))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
399
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
400 (defun gdb-inferior-io-sender (proc string)
48685
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
401 ;; PROC is the pseudo-process created to satisfy comint.
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
402 (with-current-buffer (process-buffer proc)
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
403 (setq proc (get-buffer-process gud-comint-buffer))
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
404 (process-send-string proc string)
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
405 (process-send-string proc "\n")))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
406
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
407 (defun gdb-inferior-io-interrupt ()
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
408 "Interrupt the program being debugged."
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
409 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
410 (interrupt-process
48685
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
411 (get-buffer-process gud-comint-buffer) comint-ptyp))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
412
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
413 (defun gdb-inferior-io-quit ()
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
414 "Send quit signal to the program being debugged."
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
415 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
416 (quit-process
48685
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
417 (get-buffer-process gud-comint-buffer) comint-ptyp))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
418
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
419 (defun gdb-inferior-io-stop ()
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
420 "Stop the program being debugged."
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
421 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
422 (stop-process
48685
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
423 (get-buffer-process gud-comint-buffer) comint-ptyp))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
424
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
425 (defun gdb-inferior-io-eof ()
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
426 "Send end-of-file to the program being debugged."
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
427 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
428 (process-send-eof
48685
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
429 (get-buffer-process gud-comint-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
430
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
431
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
432 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
433 ;; gdb communications
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
434 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
435
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
436 ;; INPUT: things sent to gdb
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
437 ;;
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
438 ;; There is a high and low priority input queue. Low priority input is sent
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
439 ;; only when the high priority queue is idle.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
440 ;;
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
441 ;; The queues are lists. Each element is either a string (indicating user or
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
442 ;; user-like input) or a list of the form:
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
443 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
444 ;; (INPUT-STRING HANDLER-FN)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
445 ;;
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
446 ;; The handler function will be called from the partial-output buffer when the
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
447 ;; command completes. This is the way to write commands which invoke gdb
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
448 ;; commands autonomously.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
449 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
450 ;; These lists are consumed tail first.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
451 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
452
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
453 (defun gdb-send (proc string)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
454 "A comint send filter for gdb.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
455 This filter may simply queue output for a later time."
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
456 (gdb-enqueue-input (concat string "\n")))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
457
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
458 ;; Note: Stuff enqueued here will be sent to the next prompt, even if it
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
459 ;; is a query, or other non-top-level prompt. To guarantee stuff will get
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
460 ;; sent to the top-level prompt, currently it must be put in the idle queue.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
461 ;; ^^^^^^^^^
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
462 ;; [This should encourage gdb extensions that invoke gdb commands to let
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
463 ;; the user go first; it is not a bug. -t]
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
464 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
465
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
466 (defun gdb-enqueue-input (item)
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
467 (if (gdb-get-prompting)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
468 (progn
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
469 (gdb-send-item item)
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
470 (gdb-set-prompting nil))
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
471 (gdb-set-input-queue
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
472 (cons item (gdb-get-input-queue)))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
473
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
474 (defun gdb-dequeue-input ()
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
475 (let ((queue (gdb-get-input-queue)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
476 (and queue
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
477 (if (not (cdr queue))
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
478 (let ((answer (car queue)))
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
479 (gdb-set-input-queue '())
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
480 answer)
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
481 (gdb-take-last-elt queue)))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
482
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
483 (defun gdb-enqueue-idle-input (item)
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
484 (if (and (gdb-get-prompting)
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
485 (not (gdb-get-input-queue)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
486 (progn
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
487 (gdb-send-item item)
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
488 (gdb-set-prompting nil))
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
489 (gdb-set-idle-input-queue
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
490 (cons item (gdb-get-idle-input-queue)))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
491
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
492 (defun gdb-dequeue-idle-input ()
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
493 (let ((queue (gdb-get-idle-input-queue)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
494 (and queue
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
495 (if (not (cdr queue))
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
496 (let ((answer (car queue)))
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
497 (gdb-set-idle-input-queue '())
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
498 answer)
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
499 (gdb-take-last-elt queue)))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
500
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
501 ;; Don't use this in general.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
502 (defun gdb-take-last-elt (l)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
503 (if (cdr (cdr l))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
504 (gdb-take-last-elt (cdr l))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
505 (let ((answer (car (cdr l))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
506 (setcdr l '())
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
507 answer)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
508
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
509
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
510 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
511 ;; output -- things gdb prints to emacs
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
512 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
513 ;; GDB output is a stream interrupted by annotations.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
514 ;; Annotations can be recognized by their beginning
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
515 ;; with \C-j\C-z\C-z<tag><opt>\C-j
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
516 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
517 ;; The tag is a string obeying symbol syntax.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
518 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
519 ;; The optional part `<opt>' can be either the empty string
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
520 ;; or a space followed by more data relating to the annotation.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
521 ;; For example, the SOURCE annotation is followed by a filename,
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
522 ;; line number and various useless goo. This data must not include
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
523 ;; any newlines.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
524 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
525
51172
61a988cae9b2 (gdba): Accommodate Fortran programs.
Nick Roberts <nickrob@snap.net.nz>
parents: 51123
diff changeset
526 (defcustom gud-gdba-command-name "gdb -annotate=2 -noasync"
48682
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
527 "Default command to execute an executable under the GDB-UI debugger."
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
528 :type 'string
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
529 :group 'gud)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
530
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
531 (defvar gdb-annotation-rules
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
532 '(("pre-prompt" gdb-pre-prompt)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
533 ("prompt" gdb-prompt)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
534 ("commands" gdb-subprompt)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
535 ("overload-choice" gdb-subprompt)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
536 ("query" gdb-subprompt)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
537 ("prompt-for-continue" gdb-subprompt)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
538 ("post-prompt" gdb-post-prompt)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
539 ("source" gdb-source)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
540 ("starting" gdb-starting)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
541 ("exited" gdb-stopping)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
542 ("signalled" gdb-stopping)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
543 ("signal" gdb-stopping)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
544 ("breakpoint" gdb-stopping)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
545 ("watchpoint" gdb-stopping)
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
546 ("frame-begin" gdb-frame-begin)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
547 ("stopped" gdb-stopped)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
548 ("display-begin" gdb-display-begin)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
549 ("display-end" gdb-display-end)
49147
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
550 ; GDB commands info stack, info locals and frame generate an error-begin
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
551 ; annotation at start when there is no stack but this is a quirk/bug in
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49249
diff changeset
552 ; annotations.
49147
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
553 ; ("error-begin" gdb-error-begin)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
554 ("display-number-end" gdb-display-number-end)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
555 ("array-section-begin" gdb-array-section-begin)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
556 ("array-section-end" gdb-array-section-end)
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
557 ;; ("elt" gdb-elt)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
558 ("field-begin" gdb-field-begin)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
559 ("field-end" gdb-field-end)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
560 ) "An assoc mapping annotation tags to functions which process them.")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
561
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
562 (defun gdb-ignore-annotation (args)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
563 nil)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
564
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
565 (defconst gdb-source-spec-regexp
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
566 "\\(.*\\):\\([0-9]*\\):[0-9]*:[a-z]*:\\(0x[a-f0-9]*\\)")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
567
48570
4934b8352621 (gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents: 48515
diff changeset
568 ;; Do not use this except as an annotation handler.
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
569 (defun gdb-source (args)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
570 (string-match gdb-source-spec-regexp args)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
571 ;; Extract the frame position from the marker.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
572 (setq gud-last-frame
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
573 (cons
48641
da382393fb77 Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48640
diff changeset
574 (match-string 1 args)
da382393fb77 Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48640
diff changeset
575 (string-to-int (match-string 2 args))))
da382393fb77 Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48640
diff changeset
576 (setq gdb-current-address (match-string 3 args))
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
577 (setq gdb-view-source t)
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
578 ;;update with new frame for machine code if necessary
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
579 (gdb-invalidate-assembler))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
580
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
581 (defun gdb-send-item (item)
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
582 (gdb-set-current-item item)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
583 (if (stringp item)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
584 (progn
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
585 (gdb-set-output-sink 'user)
48685
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
586 (process-send-string (get-buffer-process gud-comint-buffer) item))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
587 (progn
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
588 (gdb-clear-partial-output)
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
589 (gdb-set-output-sink 'pre-emacs)
48685
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
590 (process-send-string (get-buffer-process gud-comint-buffer)
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
591 (car item)))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
592
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
593 (defun gdb-pre-prompt (ignored)
48570
4934b8352621 (gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents: 48515
diff changeset
594 "An annotation handler for `pre-prompt'. This terminates the collection of
4934b8352621 (gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents: 48515
diff changeset
595 output from a previous command if that happens to be in effect."
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
596 (let ((sink (gdb-get-output-sink)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
597 (cond
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
598 ((eq sink 'user) t)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
599 ((eq sink 'emacs)
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
600 (gdb-set-output-sink 'post-emacs)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
601 (let ((handler
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
602 (car (cdr (gdb-get-current-item)))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
603 (save-excursion
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49249
diff changeset
604 (set-buffer (gdb-get-create-buffer
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
605 'gdb-partial-output-buffer))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
606 (funcall handler))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
607 (t
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
608 (gdb-set-output-sink 'user)
50378
6e0c9823bcc0 (gdb-inferior-io-mode): Remove Unix pathname for cat
Nick Roberts <nickrob@snap.net.nz>
parents: 49588
diff changeset
609 (error "Phase error in gdb-pre-prompt (got %s)" sink)))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
610
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
611 (defun gdb-prompt (ignored)
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49249
diff changeset
612 "An annotation handler for `prompt'.
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
613 This sends the next command (if any) to gdb."
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
614 (let ((sink (gdb-get-output-sink)))
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
615 (cond
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
616 ((eq sink 'user) t)
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
617 ((eq sink 'post-emacs)
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
618 (gdb-set-output-sink 'user))
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
619 (t
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
620 (gdb-set-output-sink 'user)
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
621 (error "Phase error in gdb-prompt (got %s)" sink))))
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
622 (let ((highest (gdb-dequeue-input)))
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
623 (if highest
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
624 (gdb-send-item highest)
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
625 (let ((lowest (gdb-dequeue-idle-input)))
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
626 (if lowest
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
627 (gdb-send-item lowest)
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
628 (progn
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
629 (gdb-set-prompting t)
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
630 (gud-display-frame)))))))
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
631
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
632 (defun gdb-subprompt (ignored)
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
633 "An annotation handler for non-top-level prompts."
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
634 (let ((highest (gdb-dequeue-input)))
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
635 (if highest
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
636 (gdb-send-item highest)
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
637 (gdb-set-prompting t))))
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
638
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
639 (defun gdb-starting (ignored)
48570
4934b8352621 (gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents: 48515
diff changeset
640 "An annotation handler for `starting'. This says that I/O for the
4934b8352621 (gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents: 48515
diff changeset
641 subprocess is now the program being debugged, not GDB."
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
642 (let ((sink (gdb-get-output-sink)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
643 (cond
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
644 ((eq sink 'user)
48570
4934b8352621 (gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents: 48515
diff changeset
645 (progn
48639
00993d9b9cb7 (gdba, gdb-starting, gdb-stopped, gdb-quit): Update gdb-running -> gud-running.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48600
diff changeset
646 (setq gud-running t)
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
647 (gdb-set-output-sink 'inferior)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
648 (t (error "Unexpected `starting' annotation")))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
649
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
650 (defun gdb-stopping (ignored)
48570
4934b8352621 (gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents: 48515
diff changeset
651 "An annotation handler for `exited' and other annotations which say that I/O
4934b8352621 (gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents: 48515
diff changeset
652 for the subprocess is now GDB, not the program being debugged."
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
653 (let ((sink (gdb-get-output-sink)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
654 (cond
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
655 ((eq sink 'inferior)
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
656 (gdb-set-output-sink 'user))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
657 (t (error "Unexpected stopping annotation")))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
658
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
659 (defun gdb-frame-begin (ignored)
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
660 (let ((sink (gdb-get-output-sink)))
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
661 (cond
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
662 ((eq sink 'inferior)
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
663 (gdb-set-output-sink 'user))
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
664 ((eq sink 'user) t)
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
665 ((eq sink 'emacs) t)
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
666 (t (error "Unexpected frame-begin annotation (%S)" sink)))))
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
667
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
668 (defun gdb-stopped (ignored)
48570
4934b8352621 (gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents: 48515
diff changeset
669 "An annotation handler for `stopped'. It is just like gdb-stopping, except
4934b8352621 (gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents: 48515
diff changeset
670 that if we already set the output sink to 'user in gdb-stopping, that is fine."
48639
00993d9b9cb7 (gdba, gdb-starting, gdb-stopped, gdb-quit): Update gdb-running -> gud-running.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48600
diff changeset
671 (setq gud-running nil)
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
672 (let ((sink (gdb-get-output-sink)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
673 (cond
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
674 ((eq sink 'inferior)
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
675 (gdb-set-output-sink 'user))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
676 ((eq sink 'user) t)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
677 (t (error "Unexpected stopped annotation")))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
678
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
679 (defun gdb-post-prompt (ignored)
48570
4934b8352621 (gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents: 48515
diff changeset
680 "An annotation handler for `post-prompt'. This begins the collection of
4934b8352621 (gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents: 48515
diff changeset
681 output from the current command if that happens to be appropriate."
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
682 (if (not (gdb-get-pending-triggers))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
683 (progn
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
684 (gdb-get-current-frame)
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
685 (gdb-invalidate-frames)
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
686 (gdb-invalidate-breakpoints)
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
687 (gdb-invalidate-assembler)
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
688 (gdb-invalidate-registers)
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
689 (gdb-invalidate-locals)
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
690 (gdb-invalidate-display)
50962
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
691 (gdb-invalidate-threads)))
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
692 (let ((sink (gdb-get-output-sink)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
693 (cond
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
694 ((eq sink 'user) t)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
695 ((eq sink 'pre-emacs)
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
696 (gdb-set-output-sink 'emacs))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
697 (t
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
698 (gdb-set-output-sink 'user)
50378
6e0c9823bcc0 (gdb-inferior-io-mode): Remove Unix pathname for cat
Nick Roberts <nickrob@snap.net.nz>
parents: 49588
diff changeset
699 (error "Phase error in gdb-post-prompt (got %s)" sink)))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
700
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
701 ;; If we get an error whilst evaluating one of the expressions
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
702 ;; we won't get the display-end annotation. Set the sink back to
49249
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
703 ;; user to make sure that the error message is seen.
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
704 ;; NOT USED: see annotation-rules for reason.
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
705 ;(defun gdb-error-begin (ignored)
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
706 ; (gdb-set-output-sink 'user))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
707
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
708 (defun gdb-display-begin (ignored)
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
709 (gdb-set-output-sink 'emacs)
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
710 (gdb-clear-partial-output)
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
711 (setq gdb-display-in-progress t))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
712
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
713 (defvar gdb-expression-buffer-name)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
714 (defvar gdb-display-number)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
715 (defvar gdb-dive-display-number)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
716
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
717 (defun gdb-display-number-end (ignored)
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
718 (set-buffer (gdb-get-buffer 'gdb-partial-output-buffer))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
719 (setq gdb-display-number (buffer-string))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
720 (setq gdb-expression-buffer-name
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
721 (concat "*display " gdb-display-number "*"))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
722 (save-excursion
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
723 (if (progn
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
724 (set-buffer (window-buffer))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
725 gdb-dive)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
726 (progn
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
727 (let ((number gdb-display-number))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
728 (switch-to-buffer
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
729 (set-buffer (get-buffer-create gdb-expression-buffer-name)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
730 (gdb-expressions-mode)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
731 (setq gdb-dive-display-number number)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
732 (set-buffer (get-buffer-create gdb-expression-buffer-name))
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
733 (gdb-expressions-mode)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
734 (if (and (display-graphic-p) (not gdb-dive))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
735 (catch 'frame-exists
48661
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
736 (dolist (frame (frame-list))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
737 (if (string-equal (frame-parameter frame 'name)
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
738 gdb-expression-buffer-name)
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
739 (throw 'frame-exists nil)))
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49249
diff changeset
740 (make-frame `((height . ,gdb-window-height)
49249
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
741 (width . ,gdb-window-width)
48661
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
742 (tool-bar-lines . nil)
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
743 (menu-bar-lines . nil)
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
744 (minibuffer . nil))))
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
745 (gdb-display-buffer (get-buffer gdb-expression-buffer-name)))))
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
746 (set-buffer (gdb-get-buffer 'gdb-partial-output-buffer))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
747 (setq gdb-dive nil))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
748
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
749 (defvar gdb-nesting-level)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
750 (defvar gdb-expression)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
751 (defvar gdb-point)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
752 (defvar gdb-annotation-arg)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
753
48661
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
754 (defun gdb-delete-line ()
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
755 "Delete the current line."
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
756 (delete-region (line-beginning-position) (line-beginning-position 2)))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
757
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
758 (defun gdb-display-end (ignored)
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
759 (set-buffer (gdb-get-buffer 'gdb-partial-output-buffer))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
760 (goto-char (point-min))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
761 (search-forward ": ")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
762 (looking-at "\\(.*?\\) =")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
763 (let ((char "")
48641
da382393fb77 Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48640
diff changeset
764 (gdb-temp-value (match-string 1)))
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
765 ;;move * to front of expression if necessary
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
766 (if (looking-at ".*\\*")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
767 (progn
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
768 (setq char "*")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
769 (setq gdb-temp-value (substring gdb-temp-value 1 nil))))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
770 (with-current-buffer gdb-expression-buffer-name
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
771 (setq gdb-expression gdb-temp-value)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
772 (if (not (string-match "::" gdb-expression))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
773 (setq gdb-expression (concat char gdb-current-frame
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
774 "::" gdb-expression))
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
775 ;;else put * back on if necessary
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
776 (setq gdb-expression (concat char gdb-expression)))
49039
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
777 (if (not header-line-format)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
778 (setq header-line-format (concat "-- " gdb-expression " %-")))))
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
779 ;;
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
780 ;;-if scalar/string
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
781 (if (not (re-search-forward "##" nil t))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
782 (progn
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
783 (with-current-buffer gdb-expression-buffer-name
49039
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
784 (let ((buffer-read-only nil))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
785 (delete-region (point-min) (point-max))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
786 (insert-buffer-substring
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
787 (gdb-get-buffer 'gdb-partial-output-buffer)))))
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
788 ;; display expression name...
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
789 (goto-char (point-min))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
790 (let ((start (progn (point)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
791 (end (progn (end-of-line) (point))))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
792 (with-current-buffer gdb-expression-buffer-name
51123
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
793 (let ((buffer-read-only nil))
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
794 (delete-region (point-min) (point-max))
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
795 (insert-buffer-substring (gdb-get-buffer
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
796 'gdb-partial-output-buffer)
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
797 start end)
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
798 (insert "\n"))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
799 (goto-char (point-min))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
800 (re-search-forward "##" nil t)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
801 (setq gdb-nesting-level 0)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
802 (if (looking-at "array-section-begin")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
803 (progn
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
804 (gdb-delete-line)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
805 (setq gdb-point (point))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
806 (gdb-array-format)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
807 (if (looking-at "field-begin \\(.\\)")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
808 (progn
48641
da382393fb77 Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48640
diff changeset
809 (setq gdb-annotation-arg (match-string 1))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
810 (gdb-field-format-begin))))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
811 (with-current-buffer gdb-expression-buffer-name
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
812 (if gdb-dive-display-number
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
813 (progn
49039
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
814 (let ((buffer-read-only nil))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
815 (goto-char (point-max))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
816 (insert "\n")
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
817 (insert-text-button "[back]" 'type 'gdb-display-back)))))
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
818 (gdb-clear-partial-output)
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
819 (gdb-set-output-sink 'user)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
820 (setq gdb-display-in-progress nil))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
821
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
822 (define-button-type 'gdb-display-back
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
823 'help-echo (purecopy "mouse-2, RET: go back to previous display buffer")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
824 'action (lambda (button) (gdb-display-go-back)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
825
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
826 (defun gdb-display-go-back ()
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
827 ;; delete display so they don't accumulate and delete buffer
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
828 (let ((number gdb-display-number))
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
829 (gdb-enqueue-input
48641
da382393fb77 Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48640
diff changeset
830 (list (concat "server delete display " number "\n") 'ignore))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
831 (switch-to-buffer (concat "*display " gdb-dive-display-number "*"))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
832 (kill-buffer (get-buffer (concat "*display " number "*")))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
833
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
834 ;; prefix annotations with ## and process whole output in one chunk
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
835 ;; in gdb-partial-output-buffer (to allow recursion).
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
836
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
837 ;; array-section flags are just removed again but after counting. They
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
838 ;; might also be useful for arrays of structures and structures with arrays.
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
839 (defun gdb-array-section-begin (args)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
840 (if gdb-display-in-progress
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
841 (progn
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
842 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
843 (goto-char (point-max))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
844 (insert (concat "\n##array-section-begin " args "\n"))))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
845
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
846 (defun gdb-array-section-end (ignored)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
847 (if gdb-display-in-progress
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
848 (progn
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
849 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
850 (goto-char (point-max))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
851 (insert "\n##array-section-end\n")))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
852
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
853 (defun gdb-field-begin (args)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
854 (if gdb-display-in-progress
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
855 (progn
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
856 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
857 (goto-char (point-max))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
858 (insert (concat "\n##field-begin " args "\n"))))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
859
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
860 (defun gdb-field-end (ignored)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
861 (if gdb-display-in-progress
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
862 (progn
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
863 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
864 (goto-char (point-max))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
865 (insert "\n##field-end\n")))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
866
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
867 (defun gdb-elt (ignored)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
868 (if gdb-display-in-progress
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
869 (progn
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
870 (goto-char (point-max))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
871 (insert "\n##elt\n"))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
872
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
873 (defun gdb-field-format-begin ()
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
874 ;; get rid of ##field-begin
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
875 (gdb-delete-line)
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
876 (gdb-insert-field)
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
877 (setq gdb-nesting-level (+ gdb-nesting-level 1))
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
878 (while (re-search-forward "##" nil t)
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
879 ;; keep making recursive calls...
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
880 (if (looking-at "field-begin \\(.\\)")
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
881 (progn
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
882 (setq gdb-annotation-arg (match-string 1))
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
883 (gdb-field-format-begin)))
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
884 ;; until field-end.
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
885 (if (looking-at "field-end") (gdb-field-format-end))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
886
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
887 (defun gdb-field-format-end ()
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
888 ;; get rid of ##field-end and `,' or `}'
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
889 (gdb-delete-line)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
890 (gdb-delete-line)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
891 (setq gdb-nesting-level (- gdb-nesting-level 1)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
892
48661
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
893 (defvar gdb-dive-map
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
894 (let ((map (make-sparse-keymap)))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
895 (define-key map [mouse-2] 'gdb-dive)
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
896 (define-key map [S-mouse-2] 'gdb-dive-new-frame)
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
897 map))
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
898
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
899 (defun gdb-dive (event)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
900 "Dive into structure."
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
901 (interactive "e")
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
902 (setq gdb-dive t)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
903 (gdb-dive-new-frame event))
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
904
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
905 (defun gdb-dive-new-frame (event)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
906 "Dive into structure and display in a new frame."
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
907 (interactive "e")
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
908 (save-excursion
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
909 (mouse-set-point event)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
910 (let ((point (point)) (gdb-full-expression gdb-expression)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
911 (end (progn (end-of-line) (point)))
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
912 (gdb-part-expression "") (gdb-last-field nil) (gdb-display-char nil))
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
913 (beginning-of-line)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
914 (if (looking-at "\*") (setq gdb-display-char "*"))
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
915 (re-search-forward "\\(\\S-+\\) = " end t)
48641
da382393fb77 Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48640
diff changeset
916 (setq gdb-last-field (match-string-no-properties 1))
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
917 (goto-char (match-beginning 1))
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
918 (let ((last-column (current-column)))
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
919 (while (re-search-backward "\\s-\\(\\S-+\\) = {" nil t)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
920 (goto-char (match-beginning 1))
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
921 (if (and (< (current-column) last-column)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
922 (> (count-lines 1 (point)) 1))
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
923 (progn
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
924 (setq gdb-part-expression
48641
da382393fb77 Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48640
diff changeset
925 (concat "." (match-string-no-properties 1)
da382393fb77 Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48640
diff changeset
926 gdb-part-expression))
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
927 (setq last-column (current-column))))))
48641
da382393fb77 Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48640
diff changeset
928 ;; * not needed for components of a pointer to a structure in gdb
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
929 (if (string-equal "*" (substring gdb-full-expression 0 1))
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
930 (setq gdb-full-expression (substring gdb-full-expression 1 nil)))
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
931 (setq gdb-full-expression
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
932 (concat gdb-full-expression gdb-part-expression "." gdb-last-field))
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
933 (gdb-enqueue-input
48641
da382393fb77 Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48640
diff changeset
934 (list (concat "server display" gdb-display-char
da382393fb77 Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48640
diff changeset
935 " " gdb-full-expression "\n")
da382393fb77 Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48640
diff changeset
936 'ignore)))))
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
937
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
938 (defun gdb-insert-field ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
939 (let ((start (progn (point)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
940 (end (progn (next-line) (point)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
941 (num 0))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
942 (with-current-buffer gdb-expression-buffer-name
49039
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
943 (let ((buffer-read-only nil))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
944 (if (string-equal gdb-annotation-arg "\*") (insert "\*"))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
945 (while (<= num gdb-nesting-level)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
946 (insert "\t")
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
947 (setq num (+ num 1)))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
948 (insert-buffer-substring (gdb-get-buffer
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
949 'gdb-partial-output-buffer)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
950 start end)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
951 (put-text-property (- (point) (- end start)) (- (point) 1)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
952 'mouse-face 'highlight)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
953 (put-text-property (- (point) (- end start)) (- (point) 1)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
954 'local-map gdb-dive-map)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
955 (delete-region start end)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
956
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
957 (defvar gdb-values)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
958
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
959 (defun gdb-array-format ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
960 (while (re-search-forward "##" nil t)
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
961 ;; keep making recursive calls...
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
962 (if (looking-at "array-section-begin")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
963 (progn
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
964 ;;get rid of ##array-section-begin
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
965 (gdb-delete-line)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
966 (setq gdb-nesting-level (+ gdb-nesting-level 1))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
967 (gdb-array-format)))
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
968 ;;until *matching* array-section-end is found
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
969 (if (looking-at "array-section-end")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
970 (if (eq gdb-nesting-level 0)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
971 (progn
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
972 (let ((values (buffer-substring gdb-point (- (point) 2))))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
973 (with-current-buffer gdb-expression-buffer-name
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
974 (setq gdb-values
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
975 (concat "{" (replace-regexp-in-string "\n" "" values)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
976 "}"))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
977 (gdb-array-format1))))
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
978 ;;else get rid of ##array-section-end etc
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
979 (gdb-delete-line)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
980 (setq gdb-nesting-level (- gdb-nesting-level 1))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
981 (gdb-array-format)))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
982
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
983 (defvar gdb-array-start)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
984 (defvar gdb-array-stop)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
985
48661
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
986 (defvar gdb-array-slice-map
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
987 (let ((map (make-sparse-keymap)))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
988 (define-key map [mouse-2] 'gdb-array-slice)
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
989 map))
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
990
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
991 (defun gdb-array-slice (event)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
992 "Select an array slice to display."
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
993 (interactive "e")
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
994 (mouse-set-point event)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
995 (save-excursion
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
996 (let ((n -1) (stop 0) (start 0) (point (point)))
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
997 (beginning-of-line)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
998 (while (search-forward "[" point t)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
999 (setq n (+ n 1)))
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1000 (setq start (string-to-int (read-string "Start index: ")))
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1001 (aset gdb-array-start n start)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1002 (setq stop (string-to-int (read-string "Stop index: ")))
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1003 (aset gdb-array-stop n stop)))
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1004 (gdb-array-format1))
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1005
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1006 (defvar gdb-display-string)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1007 (defvar gdb-array-size)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1008
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1009 (defun gdb-array-format1 ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1010 (setq gdb-display-string "")
49039
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1011 (let ((buffer-read-only nil))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1012 (delete-region (point-min) (point-max))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1013 (let ((gdb-value-list (split-string gdb-values ", ")))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1014 (string-match "\\({+\\)" (car gdb-value-list))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1015 (let* ((depth (- (match-end 1) (match-beginning 1)))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1016 (indices (make-vector depth '0))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1017 (index 0) (num 0) (array-start "")
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1018 (array-stop "") (array-slice "") (array-range nil)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1019 (flag t) (indices-string ""))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1020 (dolist (gdb-value gdb-value-list)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1021 (string-match "{*\\([^}]*\\)\\(}*\\)" gdb-value)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1022 (setq num 0)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1023 (while (< num depth)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1024 (setq indices-string
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1025 (concat indices-string
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1026 "[" (int-to-string (aref indices num)) "]"))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1027 (if (not (= (aref gdb-array-start num) -1))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1028 (if (or (< (aref indices num) (aref gdb-array-start num))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1029 (> (aref indices num) (aref gdb-array-stop num)))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1030 (setq flag nil))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1031 (aset gdb-array-size num (aref indices num)))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1032 (setq num (+ num 1)))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1033 (if flag
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1034 (let ((gdb-display-value (match-string 1 gdb-value)))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1035 (setq gdb-display-string (concat gdb-display-string " "
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1036 gdb-display-value))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1037 (insert
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1038 (concat indices-string "\t" gdb-display-value "\n"))))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1039 (setq indices-string "")
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1040 (setq flag t)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1041 ;; 0<= index < depth, start at right : (- depth 1)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1042 (setq index (- (- depth 1)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1043 (- (match-end 2) (match-beginning 2))))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1044 ;;don't set for very last brackets
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1045 (when (>= index 0)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1046 (aset indices index (+ 1 (aref indices index)))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1047 (setq num (+ 1 index))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1048 (while (< num depth)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1049 (aset indices num 0)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1050 (setq num (+ num 1)))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1051 (setq num 0)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1052 (while (< num depth)
49039
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1053 (if (= (aref gdb-array-start num) -1)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1054 (progn
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1055 (aset gdb-array-start num 0)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1056 (aset gdb-array-stop num (aref indices num))))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1057 (setq array-start (int-to-string (aref gdb-array-start num)))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1058 (setq array-stop (int-to-string (aref gdb-array-stop num)))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1059 (setq array-range (concat "[" array-start
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1060 ":" array-stop "]"))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1061 (put-text-property 1 (+ (length array-start)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1062 (length array-stop) 2)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1063 'mouse-face 'highlight array-range)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1064 (put-text-property 1 (+ (length array-start)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1065 (length array-stop) 2)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1066 'local-map gdb-array-slice-map array-range)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1067 (goto-char (point-min))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1068 (setq array-slice (concat array-slice array-range))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1069 (setq num (+ num 1)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1070 (goto-char (point-min))
49039
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1071 (insert "Array Size : ")
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1072 (setq num 0)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1073 (while (< num depth)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1074 (insert
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1075 (concat "["
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1076 (int-to-string (+ (aref gdb-array-size num) 1)) "]"))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1077 (setq num (+ num 1)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1078 (insert
49039
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1079 (concat "\n Slice : " array-slice "\n\nIndex\tValues\n\n"))))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1080
48884
f774c94b3b5e (gdba-marker-filter, gdb-output-burst): Merge and
Nick Roberts <nickrob@snap.net.nz>
parents: 48827
diff changeset
1081 (defun gud-gdba-marker-filter (string)
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1082 "A gud marker filter for gdb. Handle a burst of output from GDB."
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1083 (let (
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1084 ;; Recall the left over burst from last time
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1085 (burst (concat (gdb-get-burst) string))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1086 ;; Start accumulating output for the GUD buffer
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1087 (output ""))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1088 ;;
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1089 ;; Process all the complete markers in this chunk.
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1090 (while (string-match "\n\032\032\\(.*\\)\n" burst)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1091 (let ((annotation (match-string 1 burst)))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1092 ;;
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1093 ;; Stuff prior to the match is just ordinary output.
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1094 ;; It is either concatenated to OUTPUT or directed
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1095 ;; elsewhere.
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1096 (setq output
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49249
diff changeset
1097 (gdb-concat-output
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1098 output
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1099 (substring burst 0 (match-beginning 0))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1100
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1101 ;; Take that stuff off the burst.
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1102 (setq burst (substring burst (match-end 0)))
48300
69646014abb3 Fix feature name in `require'.
Juanma Barranquero <lekktu@gmail.com>
parents: 48292
diff changeset
1103
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1104 ;; Parse the tag from the annotation, and maybe its arguments.
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1105 (string-match "\\(\\S-*\\) ?\\(.*\\)" annotation)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1106 (let* ((annotation-type (match-string 1 annotation))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1107 (annotation-arguments (match-string 2 annotation))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1108 (annotation-rule (assoc annotation-type
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1109 gdb-annotation-rules)))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1110 ;; Call the handler for this annotation.
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1111 (if annotation-rule
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1112 (funcall (car (cdr annotation-rule))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1113 annotation-arguments)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1114 ;; Else the annotation is not recognized. Ignore it silently,
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1115 ;; so that GDB can add new annotations without causing
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1116 ;; us to blow up.
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1117 ))))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1118 ;;
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1119 ;; Does the remaining text end in a partial line?
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1120 ;; If it does, then keep part of the burst until we get more.
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1121 (if (string-match "\n\\'\\|\n\032\\'\\|\n\032\032.*\\'"
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1122 burst)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1123 (progn
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1124 ;; Everything before the potential marker start can be output.
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1125 (setq output
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1126 (gdb-concat-output output
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1127 (substring burst 0 (match-beginning 0))))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1128 ;;
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1129 ;; Everything after, we save, to combine with later input.
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1130 (setq burst (substring burst (match-beginning 0))))
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1131 ;;
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1132 ;; In case we know the burst contains no partial annotations:
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1133 (progn
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1134 (setq output (gdb-concat-output output burst))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1135 (setq burst "")))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1136 ;;
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1137 ;; Save the remaining burst for the next call to this function.
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1138 (gdb-set-burst burst)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1139 output))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1140
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1141 (defun gdb-concat-output (so-far new)
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1142 (let ((sink (gdb-get-output-sink )))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1143 (cond
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1144 ((eq sink 'user) (concat so-far new))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1145 ((or (eq sink 'pre-emacs) (eq sink 'post-emacs)) so-far)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1146 ((eq sink 'emacs)
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1147 (gdb-append-to-partial-output new)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1148 so-far)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1149 ((eq sink 'inferior)
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1150 (gdb-append-to-inferior-io new)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1151 so-far)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1152 (t (error "Bogon output sink %S" sink)))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1153
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1154 (defun gdb-append-to-partial-output (string)
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1155 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1156 (goto-char (point-max))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1157 (insert string)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1158
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1159 (defun gdb-clear-partial-output ()
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1160 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1161 (delete-region (point-min) (point-max))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1162
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1163 (defun gdb-append-to-inferior-io (string)
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1164 (with-current-buffer (gdb-get-create-buffer 'gdb-inferior-io)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1165 (goto-char (point-max))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1166 (insert-before-markers string))
48884
f774c94b3b5e (gdba-marker-filter, gdb-output-burst): Merge and
Nick Roberts <nickrob@snap.net.nz>
parents: 48827
diff changeset
1167 (if (not (string-equal string ""))
51529
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
1168 (gdb-display-buffer (gdb-get-create-buffer 'gdb-inferior-io))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1169
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1170 (defun gdb-clear-inferior-io ()
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1171 (with-current-buffer (gdb-get-create-buffer 'gdb-inferior-io)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1172 (delete-region (point-min) (point-max))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1173
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1174
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1175 ;; One trick is to have a command who's output is always available in a buffer
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1176 ;; of it's own, and is always up to date. We build several buffers of this
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1177 ;; type.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1178 ;;
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1179 ;; There are two aspects to this: gdb has to tell us when the output for that
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1180 ;; command might have changed, and we have to be able to run the command
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1181 ;; behind the user's back.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1182 ;;
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1183 ;; The idle input queue and the output phasing associated with the variable
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1184 ;; gdb-output-sink help us to run commands behind the user's back.
48300
69646014abb3 Fix feature name in `require'.
Juanma Barranquero <lekktu@gmail.com>
parents: 48292
diff changeset
1185 ;;
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1186 ;; Below is the code for specificly managing buffers of output from one
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1187 ;; command.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1188 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1189
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1190 ;; The trigger function is suitable for use in the assoc GDB-ANNOTATION-RULES
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1191 ;; It adds an idle input for the command we are tracking. It should be the
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1192 ;; annotation rule binding of whatever gdb sends to tell us this command
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1193 ;; might have changed it's output.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1194 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1195 ;; NAME is the function name. DEMAND-PREDICATE tests if output is really needed.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1196 ;; GDB-COMMAND is a string of such. OUTPUT-HANDLER is the function bound to the
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1197 ;; input in the input queue (see comment about ``gdb communications'' above).
48570
4934b8352621 (gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents: 48515
diff changeset
1198
4934b8352621 (gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents: 48515
diff changeset
1199 (defmacro def-gdb-auto-update-trigger (name demand-predicate gdb-command
4934b8352621 (gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents: 48515
diff changeset
1200 output-handler)
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1201 `(defun ,name (&optional ignored)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1202 (if (and (,demand-predicate)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1203 (not (member ',name
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1204 (gdb-get-pending-triggers))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1205 (progn
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1206 (gdb-enqueue-idle-input
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1207 (list ,gdb-command ',output-handler))
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1208 (gdb-set-pending-triggers
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1209 (cons ',name
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1210 (gdb-get-pending-triggers)))))))
48300
69646014abb3 Fix feature name in `require'.
Juanma Barranquero <lekktu@gmail.com>
parents: 48292
diff changeset
1211
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1212 (defmacro def-gdb-auto-update-handler (name trigger buf-key custom-defun)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1213 `(defun ,name ()
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1214 (gdb-set-pending-triggers
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1215 (delq ',trigger
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1216 (gdb-get-pending-triggers)))
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1217 (let ((buf (gdb-get-buffer ',buf-key)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1218 (and buf
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1219 (with-current-buffer buf
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1220 (let ((p (point))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1221 (buffer-read-only nil))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1222 (delete-region (point-min) (point-max))
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1223 (insert-buffer-substring (gdb-get-create-buffer
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1224 'gdb-partial-output-buffer))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1225 (goto-char p)))))
48641
da382393fb77 Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48640
diff changeset
1226 ;; put customisation here
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1227 (,custom-defun)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1228
48641
da382393fb77 Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48640
diff changeset
1229 (defmacro def-gdb-auto-updated-buffer (buffer-key trigger-name gdb-command
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1230 output-handler-name custom-defun)
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1231 `(progn
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1232 (def-gdb-auto-update-trigger ,trigger-name
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1233 ;; The demand predicate:
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1234 (lambda () (gdb-get-buffer ',buffer-key))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1235 ,gdb-command
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1236 ,output-handler-name)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1237 (def-gdb-auto-update-handler ,output-handler-name
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1238 ,trigger-name ,buffer-key ,custom-defun)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1239
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1240
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1241 ;;
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1242 ;; Breakpoint buffer : This displays the output of `info breakpoints'.
48300
69646014abb3 Fix feature name in `require'.
Juanma Barranquero <lekktu@gmail.com>
parents: 48292
diff changeset
1243 ;;
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1244 (gdb-set-buffer-rules 'gdb-breakpoints-buffer
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1245 'gdb-breakpoints-buffer-name
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1246 'gdb-breakpoints-mode)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1247
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1248 (def-gdb-auto-updated-buffer gdb-breakpoints-buffer
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1249 ;; This defines the auto update rule for buffers of type
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1250 ;; `gdb-breakpoints-buffer'.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1251 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1252 ;; It defines a function to serve as the annotation handler that
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1253 ;; handles the `foo-invalidated' message. That function is called:
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1254 gdb-invalidate-breakpoints
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1255 ;;
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1256 ;; To update the buffer, this command is sent to gdb.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1257 "server info breakpoints\n"
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1258 ;;
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1259 ;; This also defines a function to be the handler for the output
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1260 ;; from the command above. That function will copy the output into
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1261 ;; the appropriately typed buffer. That function will be called:
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1262 gdb-info-breakpoints-handler
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1263 ;; buffer specific functions
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1264 gdb-info-breakpoints-custom)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1265
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1266 (defvar gdb-cdir nil "Compilation directory.")
50796
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1267
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1268 (defconst breakpoint-xpm-data "/* XPM */
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1269 static char *magick[] = {
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1270 /* columns rows colors chars-per-pixel */
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1271 \"12 12 2 1\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1272 \" c red\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1273 \"+ c None\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1274 /* pixels */
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1275 \"++++++++++++\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1276 \"+++ +++\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1277 \"++ ++\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1278 \"+ +\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1279 \"+ +\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1280 \"+ +\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1281 \"+ +\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1282 \"+ +\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1283 \"+ +\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1284 \"++ ++\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1285 \"+++ +++\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1286 \"++++++++++++\"
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1287 };"
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1288 "XPM data used for breakpoint icon.")
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1289
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1290 (defconst breakpoint-enabled-pbm-data
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1291 "P1
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1292 12 12\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1293 0 0 0 0 0 0 0 0 0 0 0 0
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1294 0 0 0 1 1 1 1 1 1 0 0 0
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1295 0 0 1 1 1 1 1 1 1 1 0 0
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1296 0 1 1 1 1 1 1 1 1 1 1 0
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1297 0 1 1 1 1 1 1 1 1 1 1 0
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1298 0 1 1 1 1 1 1 1 1 1 1 0
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1299 0 1 1 1 1 1 1 1 1 1 1 0
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1300 0 1 1 1 1 1 1 1 1 1 1 0
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1301 0 1 1 1 1 1 1 1 1 1 1 0
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1302 0 0 1 1 1 1 1 1 1 1 0 0
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1303 0 0 0 1 1 1 1 1 1 0 0 0
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1304 0 0 0 0 0 0 0 0 0 0 0 0"
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1305 "PBM data used for enabled breakpoint icon.")
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1306
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1307 (defconst breakpoint-disabled-pbm-data
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1308 "P1
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1309 12 12\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1310 0 0 0 0 0 0 0 0 0 0 0 0
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1311 0 0 0 1 0 1 0 1 0 0 0 0
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1312 0 0 1 0 1 0 1 0 1 0 0 0
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1313 0 1 0 1 0 1 0 1 0 1 0 0
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1314 0 0 1 0 1 0 1 0 1 0 1 0
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1315 0 1 0 1 0 1 0 1 0 1 0 0
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1316 0 0 1 0 1 0 1 0 1 0 1 0
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1317 0 1 0 1 0 1 0 1 0 1 0 0
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1318 0 0 1 0 1 0 1 0 1 0 1 0
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1319 0 0 0 1 0 1 0 1 0 1 0 0
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1320 0 0 0 0 1 0 1 0 1 0 0 0
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1321 0 0 0 0 0 0 0 0 0 0 0 0"
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1322 "PBM data used for disabled breakpoint icon.")
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1323
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1324 (defvar breakpoint-enabled-icon
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1325 (find-image `((:type xpm :data ,breakpoint-xpm-data)
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1326 (:type pbm :data ,breakpoint-enabled-pbm-data)))
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1327 "Icon for enabled breakpoint in display margin")
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1328
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1329 (defvar breakpoint-disabled-icon
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1330 (find-image `((:type xpm :data ,breakpoint-xpm-data :conversion disabled)
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1331 (:type pbm :data ,breakpoint-disabled-pbm-data)))
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1332 "Icon for disabled breakpoint in display margin")
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1333
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
1334 ;;-put breakpoint icons in relevant margins (even those set in the GUD buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1335 (defun gdb-info-breakpoints-custom ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1336 (let ((flag)(address))
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1337 ;;
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
1338 ;; remove all breakpoint-icons in source buffers but not assembler buffer
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1339 (dolist (buffer (buffer-list))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1340 (with-current-buffer buffer
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1341 (if (and (eq gud-minor-mode 'gdba)
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1342 (not (string-match "^\*" (buffer-name))))
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
1343 (if (eq window-system 'x)
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1344 (remove-images (point-min) (point-max))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1345 (gdb-remove-strings (point-min) (point-max))))))
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1346 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1347 (save-excursion
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1348 (goto-char (point-min))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1349 (while (< (point) (- (point-max) 1))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1350 (forward-line 1)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1351 (if (looking-at "[^\t].*breakpoint")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1352 (progn
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1353 (looking-at "[0-9]*\\s-*\\S-*\\s-*\\S-*\\s-*\\(.\\)")
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1354 (setq flag (char-after (match-beginning 1)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1355 (beginning-of-line)
48738
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1356 (if (re-search-forward "in\\s-+\\S-+\\s-+at\\s-+" nil t)
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1357 (progn
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1358 (looking-at "\\(\\S-*\\):\\([0-9]+\\)")
49039
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1359 (let ((line (match-string 2)) (buffer-read-only nil)
48738
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1360 (file (match-string 1)))
49039
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1361 (put-text-property (progn (beginning-of-line) (point))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1362 (progn (end-of-line) (point))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1363 'mouse-face 'highlight)
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1364 (with-current-buffer
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1365 (find-file-noselect
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1366 (if (file-exists-p file) file
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1367 (expand-file-name file gdb-cdir)))
48738
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1368 (save-current-buffer
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1369 (set (make-local-variable 'gud-minor-mode) 'gdba)
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1370 (set (make-local-variable 'tool-bar-map)
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1371 gud-tool-bar-map)
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1372 (setq left-margin-width 2)
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1373 (if (get-buffer-window (current-buffer))
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1374 (set-window-margins (get-buffer-window
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1375 (current-buffer))
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1376 left-margin-width
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1377 right-margin-width)))
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1378 ;; only want one breakpoint icon at each location
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1379 (save-excursion
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1380 (goto-line (string-to-number line))
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49249
diff changeset
1381 (let ((start (progn (beginning-of-line)
48738
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1382 (- (point) 1)))
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1383 (end (progn (end-of-line) (+ (point) 1))))
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
1384 (if (eq window-system 'x)
48738
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1385 (progn
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1386 (remove-images start end)
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1387 (if (eq ?y flag)
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49249
diff changeset
1388 (put-image breakpoint-enabled-icon
51227
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1389 (+ start 1)
48738
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1390 "breakpoint icon enabled"
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1391 'left-margin)
51227
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1392 (put-image breakpoint-disabled-icon
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1393 (+ start 1)
48738
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1394 "breakpoint icon disabled"
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1395 'left-margin)))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1396 (gdb-remove-strings start end)
48738
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1397 (if (eq ?y flag)
51227
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1398 (gdb-put-string "B" (+ start 1))
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1399 (gdb-put-string "b" (+ start 1))))))))))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1400 (end-of-line))))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1401
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1402 (defun gdb-breakpoints-buffer-name ()
48685
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
1403 (with-current-buffer gud-comint-buffer
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1404 (concat "*breakpoints of " (gdb-get-target-string) "*")))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1405
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1406 (defun gdb-display-breakpoints-buffer ()
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
1407 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1408 (gdb-display-buffer
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1409 (gdb-get-create-buffer 'gdb-breakpoints-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1410
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1411 (defun gdb-frame-breakpoints-buffer ()
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
1412 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1413 (switch-to-buffer-other-frame
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1414 (gdb-get-create-buffer 'gdb-breakpoints-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1415
48661
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1416 (defvar gdb-breakpoints-mode-map
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1417 (let ((map (make-sparse-keymap))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1418 (menu (make-sparse-keymap "Breakpoints")))
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1419 (define-key menu [toggle] '("Toggle" . gdb-toggle-breakpoint))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1420 (define-key menu [delete] '("Delete" . gdb-delete-breakpoint))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1421 (define-key menu [goto] '("Goto" . gdb-goto-breakpoint))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1422
48661
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1423 (suppress-keymap map)
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1424 (define-key map [menu-bar breakpoints] (cons "Breakpoints" menu))
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1425 (define-key map " " 'gdb-toggle-breakpoint)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1426 (define-key map "d" 'gdb-delete-breakpoint)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1427 (define-key map "\r" 'gdb-goto-breakpoint)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1428 (define-key map [mouse-2] 'gdb-mouse-goto-breakpoint)
48661
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1429 map))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1430
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1431 (defun gdb-breakpoints-mode ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1432 "Major mode for gdb breakpoints.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1433
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1434 \\{gdb-breakpoints-mode-map}"
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1435 (setq major-mode 'gdb-breakpoints-mode)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1436 (setq mode-name "Breakpoints")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1437 (use-local-map gdb-breakpoints-mode-map)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1438 (setq buffer-read-only t)
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1439 (gdb-invalidate-breakpoints))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1440
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1441 (defun gdb-toggle-breakpoint ()
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1442 "Enable/disable the breakpoint at current line."
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1443 (interactive)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1444 (save-excursion
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1445 (beginning-of-line 1)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1446 (if (not (looking-at "\\([0-9]+\\).*point\\s-*\\S-*\\s-*\\(.\\)"))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1447 (error "Not recognized as break/watchpoint line")
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1448 (gdb-enqueue-input
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1449 (list
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1450 (concat
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1451 (if (eq ?y (char-after (match-beginning 2)))
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49249
diff changeset
1452 "server disable "
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1453 "server enable ")
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1454 (match-string 1) "\n")
48641
da382393fb77 Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48640
diff changeset
1455 'ignore)))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1456
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1457 (defun gdb-delete-breakpoint ()
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1458 "Delete the breakpoint at current line."
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1459 (interactive)
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1460 (beginning-of-line 1)
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1461 (if (not (looking-at "\\([0-9]+\\).*point\\s-*\\S-*\\s-*\\(.\\)"))
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1462 (error "Not recognized as break/watchpoint line")
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1463 (gdb-enqueue-input
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1464 (list (concat "server delete " (match-string 1) "\n") 'ignore))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1465
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1466 (defvar gdb-source-window nil)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1467
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1468 (defun gdb-goto-breakpoint ()
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1469 "Display the file in the source buffer at the breakpoint specified on the
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1470 current line."
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1471 (interactive)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1472 (save-excursion
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1473 (beginning-of-line 1)
48738
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1474 (re-search-forward "in\\s-+\\S-+\\s-+at\\s-+" nil t)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1475 (looking-at "\\(\\S-*\\):\\([0-9]+\\)"))
48738
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1476 (if (match-string 2)
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1477 (let ((line (match-string 2))
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1478 (file (match-string 1)))
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1479 (save-selected-window
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1480 (select-window gdb-source-window)
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1481 (switch-to-buffer (find-file-noselect
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1482 (if (file-exists-p file)
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1483 file
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1484 (expand-file-name file gdb-cdir))))
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1485 (goto-line (string-to-number line))))))
51123
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1486 ;; I'll get this to work one day!
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1487 ;; (defun gdb-goto-breakpoint ()
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1488 ;; "Display the file in the source buffer at the breakpoint specified on the
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1489 ;; current line."
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1490 ;; (interactive)
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1491 ;; (save-excursion
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1492 ;; (let ((eol (progn (end-of-line) (point))))
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1493 ;; (beginning-of-line 1)
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1494 ;; (if (re-search-forward "\\(\\S-*\\):\\([0-9]+\\)" eol t)
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1495 ;; (let ((line (match-string 2))
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1496 ;; (file (match-string 1)))
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1497 ;; (save-selected-window
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1498 ;; (select-window gdb-source-window)
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1499 ;; (switch-to-buffer (find-file-noselect
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1500 ;; (if (file-exists-p file)
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1501 ;; file
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1502 ;; (expand-file-name file gdb-cdir))))
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1503 ;; (goto-line (string-to-number line))))))
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1504 ;; (let ((eol (progn (end-of-line) (point))))
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1505 ;; (beginning-of-line 1)
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1506 ;; (if (re-search-forward "<\\(\\S-*?\\)\\(\\+*[0-9]*\\)>" eol t)
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1507 ;; (save-selected-window
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1508 ;; (select-window gdb-source-window)
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1509 ;; (gdb-get-create-buffer 'gdb-assembler-buffer)
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1510 ;; (gdb-enqueue-input
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1511 ;; (list (concat "server disassemble " (match-string 1) "\n")
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1512 ;; 'gdb-assembler-handler))
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1513 ;; (with-current-buffer (gdb-get-buffer 'gdb-assembler-buffer)
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1514 ;; (re-search-forward
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1515 ;; (concat (match-string 1) (match-string 2)))))))))
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1516
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1517 (defun gdb-mouse-goto-breakpoint (event)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1518 "Display the file in the source buffer at the selected breakpoint."
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1519 (interactive "e")
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1520 (mouse-set-point event)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1521 (gdb-goto-breakpoint))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1522
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1523 ;;
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1524 ;; Frames buffer. This displays a perpetually correct bactracktrace
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1525 ;; (from the command `where').
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1526 ;;
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1527 ;; Alas, if your stack is deep, it is costly.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1528 ;;
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1529 (gdb-set-buffer-rules 'gdb-stack-buffer
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1530 'gdb-stack-buffer-name
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1531 'gdb-frames-mode)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1532
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1533 (def-gdb-auto-updated-buffer gdb-stack-buffer
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1534 gdb-invalidate-frames
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1535 "server where\n"
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1536 gdb-info-frames-handler
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1537 gdb-info-frames-custom)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1538
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1539 (defun gdb-info-frames-custom ()
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1540 (with-current-buffer (gdb-get-buffer 'gdb-stack-buffer)
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1541 (save-excursion
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1542 (let ((buffer-read-only nil))
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1543 (goto-char (point-min))
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1544 (while (< (point) (point-max))
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1545 (put-text-property (progn (beginning-of-line) (point))
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1546 (progn (end-of-line) (point))
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1547 'mouse-face 'highlight)
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1548 (beginning-of-line)
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1549 (if (or (looking-at "^#[0-9]*\\s-*\\S-* in \\(\\S-*\\)")
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1550 (looking-at "^#[0-9]*\\s-*\\(\\S-*\\)"))
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1551 (if (equal (match-string 1) gdb-current-frame)
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1552 (put-text-property (progn (beginning-of-line) (point))
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1553 (progn (end-of-line) (point))
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1554 'face
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1555 `(:background ,(face-attribute 'default :foreground)
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1556 :foreground ,(face-attribute 'default :background)))))
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1557 (forward-line 1))))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1558
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1559 (defun gdb-stack-buffer-name ()
48685
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
1560 (with-current-buffer gud-comint-buffer
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1561 (concat "*stack frames of " (gdb-get-target-string) "*")))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1562
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1563 (defun gdb-display-stack-buffer ()
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
1564 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1565 (gdb-display-buffer
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1566 (gdb-get-create-buffer 'gdb-stack-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1567
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1568 (defun gdb-frame-stack-buffer ()
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
1569 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1570 (switch-to-buffer-other-frame
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1571 (gdb-get-create-buffer 'gdb-stack-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1572
48661
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1573 (defvar gdb-frames-mode-map
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1574 (let ((map (make-sparse-keymap)))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1575 (suppress-keymap map)
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1576 (define-key map "\r" 'gdb-frames-select)
48738
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1577 (define-key map [mouse-2] 'gdb-frames-mouse-select)
48661
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1578 map))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1579
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1580 (defun gdb-frames-mode ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1581 "Major mode for gdb frames.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1582
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1583 \\{gdb-frames-mode-map}"
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1584 (setq major-mode 'gdb-frames-mode)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1585 (setq mode-name "Frames")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1586 (setq buffer-read-only t)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1587 (use-local-map gdb-frames-mode-map)
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1588 (font-lock-mode -1)
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1589 (gdb-invalidate-frames))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1590
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1591 (defun gdb-get-frame-number ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1592 (save-excursion
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1593 (let* ((pos (re-search-backward "^#\\([0-9]*\\)" nil t))
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1594 (n (or (and pos (match-string-no-properties 1)) "0")))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1595 n)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1596
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1597 (defun gdb-frames-select ()
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1598 "Make the frame on the current line become the current frame and display the
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1599 source in the source buffer."
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1600 (interactive)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1601 (gdb-enqueue-input
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1602 (list (concat "server frame " (gdb-get-frame-number) "\n") 'ignore))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1603 (gud-display-frame))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1604
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1605 (defun gdb-frames-mouse-select (event)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1606 "Make the selected frame become the current frame and display the source in
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1607 the source buffer."
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1608 (interactive "e")
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1609 (mouse-set-point event)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1610 (gdb-frames-select))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1611
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1612 ;;
50962
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1613 ;; Threads buffer. This displays a selectable thread list.
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1614 ;;
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1615 (gdb-set-buffer-rules 'gdb-threads-buffer
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1616 'gdb-threads-buffer-name
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1617 'gdb-threads-mode)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1618
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1619 (def-gdb-auto-updated-buffer gdb-threads-buffer
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1620 gdb-invalidate-threads
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1621 "info threads\n"
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1622 gdb-info-threads-handler
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1623 gdb-info-threads-custom)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1624
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1625 (defun gdb-info-threads-custom ()
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1626 (with-current-buffer (gdb-get-buffer 'gdb-threads-buffer)
50962
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1627 (let ((buffer-read-only nil))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1628 (goto-char (point-min))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1629 (while (< (point) (point-max))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1630 (put-text-property (progn (beginning-of-line) (point))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1631 (progn (end-of-line) (point))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1632 'mouse-face 'highlight)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1633 (forward-line 1)))))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1634
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1635 (defun gdb-threads-buffer-name ()
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1636 (with-current-buffer gud-comint-buffer
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1637 (concat "*threads of " (gdb-get-target-string) "*")))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1638
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1639 (defun gdb-display-threads-buffer ()
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1640 (interactive)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1641 (gdb-display-buffer
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1642 (gdb-get-create-buffer 'gdb-threads-buffer)))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1643
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1644 (defun gdb-frame-threads-buffer ()
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1645 (interactive)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1646 (switch-to-buffer-other-frame
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1647 (gdb-get-create-buffer 'gdb-threads-buffer)))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1648
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1649 (defvar gdb-threads-mode-map
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1650 (let ((map (make-sparse-keymap)))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1651 (suppress-keymap map)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1652 (define-key map "\r" 'gdb-threads-select)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1653 (define-key map [mouse-2] 'gdb-threads-mouse-select)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1654 map))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1655
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1656 (defun gdb-threads-mode ()
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1657 "Major mode for gdb frames.
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1658
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1659 \\{gdb-frames-mode-map}"
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1660 (setq major-mode 'gdb-threads-mode)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1661 (setq mode-name "Threads")
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1662 (setq buffer-read-only t)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1663 (use-local-map gdb-threads-mode-map)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1664 (gdb-invalidate-threads))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1665
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1666 (defun gdb-get-thread-number ()
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1667 (save-excursion
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1668 (re-search-backward "^\\s-*\\([0-9]*\\)" nil t)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1669 (match-string-no-properties 1)))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1670
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1671
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1672 (defun gdb-threads-select ()
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1673 "Make the thread on the current line become the current thread and display the
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1674 source in the source buffer."
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1675 (interactive)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1676 (gdb-enqueue-input
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1677 (list (concat "thread " (gdb-get-thread-number) "\n") 'ignore))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1678 (gud-display-frame))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1679
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1680 (defun gdb-threads-mouse-select (event)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1681 "Make the selected frame become the current frame and display the source in
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1682 the source buffer."
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1683 (interactive "e")
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1684 (mouse-set-point event)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1685 (gdb-threads-select))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1686
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1687 ;;
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1688 ;; Registers buffer.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1689 ;;
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1690 (gdb-set-buffer-rules 'gdb-registers-buffer
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1691 'gdb-registers-buffer-name
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1692 'gdb-registers-mode)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1693
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1694 (def-gdb-auto-updated-buffer gdb-registers-buffer
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1695 gdb-invalidate-registers
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1696 "server info registers\n"
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1697 gdb-info-registers-handler
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1698 gdb-info-registers-custom)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1699
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1700 (defun gdb-info-registers-custom ())
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1701
48661
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1702 (defvar gdb-registers-mode-map
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1703 (let ((map (make-sparse-keymap)))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1704 (suppress-keymap map)
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1705 map))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1706
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1707 (defun gdb-registers-mode ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1708 "Major mode for gdb registers.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1709
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1710 \\{gdb-registers-mode-map}"
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1711 (setq major-mode 'gdb-registers-mode)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1712 (setq mode-name "Registers")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1713 (setq buffer-read-only t)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1714 (use-local-map gdb-registers-mode-map)
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1715 (gdb-invalidate-registers))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1716
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1717 (defun gdb-registers-buffer-name ()
48685
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
1718 (with-current-buffer gud-comint-buffer
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1719 (concat "*registers of " (gdb-get-target-string) "*")))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1720
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1721 (defun gdb-display-registers-buffer ()
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
1722 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1723 (gdb-display-buffer
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1724 (gdb-get-create-buffer 'gdb-registers-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1725
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1726 (defun gdb-frame-registers-buffer ()
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
1727 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1728 (switch-to-buffer-other-frame
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1729 (gdb-get-create-buffer 'gdb-registers-buffer)))
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1730
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1731 ;;
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1732 ;; Locals buffer.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1733 ;;
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1734 (gdb-set-buffer-rules 'gdb-locals-buffer
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1735 'gdb-locals-buffer-name
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1736 'gdb-locals-mode)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1737
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1738 (def-gdb-auto-updated-buffer gdb-locals-buffer
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1739 gdb-invalidate-locals
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1740 "server info locals\n"
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1741 gdb-info-locals-handler
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1742 gdb-info-locals-custom)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1743
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49249
diff changeset
1744 ;; Abbreviate for arrays and structures.
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1745 ;; These can be expanded using gud-display.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1746 (defun gdb-info-locals-handler nil
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1747 (gdb-set-pending-triggers (delq 'gdb-invalidate-locals
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1748 (gdb-get-pending-triggers)))
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1749 (let ((buf (gdb-get-buffer 'gdb-partial-output-buffer)))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1750 (with-current-buffer buf
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1751 (goto-char (point-min))
48685
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
1752 (while (re-search-forward "^ .*\n" nil t)
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
1753 (replace-match "" nil nil))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1754 (goto-char (point-min))
48685
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
1755 (while (re-search-forward "{[-0-9, {}\]*\n" nil t)
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
1756 (replace-match "(array);\n" nil nil))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1757 (goto-char (point-min))
48685
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
1758 (while (re-search-forward "{.*=.*\n" nil t)
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
1759 (replace-match "(structure);\n" nil nil))))
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1760 (let ((buf (gdb-get-buffer 'gdb-locals-buffer)))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1761 (and buf (with-current-buffer buf
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1762 (let ((p (point))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1763 (buffer-read-only nil))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1764 (delete-region (point-min) (point-max))
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1765 (insert-buffer-substring (gdb-get-create-buffer
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1766 'gdb-partial-output-buffer))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1767 (goto-char p)))))
48641
da382393fb77 Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48640
diff changeset
1768 (run-hooks 'gdb-info-locals-hook))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1769
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1770 (defun gdb-info-locals-custom ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1771 nil)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1772
48661
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1773 (defvar gdb-locals-mode-map
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1774 (let ((map (make-sparse-keymap)))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1775 (suppress-keymap map)
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1776 map))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1777
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1778 (defun gdb-locals-mode ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1779 "Major mode for gdb locals.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1780
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1781 \\{gdb-locals-mode-map}"
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1782 (setq major-mode 'gdb-locals-mode)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1783 (setq mode-name "Locals")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1784 (setq buffer-read-only t)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1785 (use-local-map gdb-locals-mode-map)
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1786 (gdb-invalidate-locals))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1787
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1788 (defun gdb-locals-buffer-name ()
48685
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
1789 (with-current-buffer gud-comint-buffer
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1790 (concat "*locals of " (gdb-get-target-string) "*")))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1791
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1792 (defun gdb-display-locals-buffer ()
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
1793 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1794 (gdb-display-buffer
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1795 (gdb-get-create-buffer 'gdb-locals-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1796
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1797 (defun gdb-frame-locals-buffer ()
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
1798 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1799 (switch-to-buffer-other-frame
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1800 (gdb-get-create-buffer 'gdb-locals-buffer)))
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1801
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1802 ;;
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1803 ;; Display expression buffer.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1804 ;;
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1805 (gdb-set-buffer-rules 'gdb-display-buffer
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1806 'gdb-display-buffer-name
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1807 'gdb-display-mode)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1808
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1809 (def-gdb-auto-updated-buffer gdb-display-buffer
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1810 ;; `gdb-display-buffer'.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1811 gdb-invalidate-display
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1812 "server info display\n"
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1813 gdb-info-display-handler
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1814 gdb-info-display-custom)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1815
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1816 (defun gdb-info-display-custom ()
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1817 (let ((display-list nil))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1818 (with-current-buffer (gdb-get-buffer 'gdb-display-buffer)
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1819 (goto-char (point-min))
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1820 (while (< (point) (- (point-max) 1))
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1821 (forward-line 1)
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1822 (if (looking-at "\\([0-9]+\\): \\([ny]\\)")
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49249
diff changeset
1823 (setq display-list
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1824 (cons (string-to-int (match-string 1)) display-list)))
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1825 (end-of-line)))
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1826 (if (not (display-graphic-p))
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1827 (progn
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1828 (dolist (buffer (buffer-list))
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1829 (if (string-match "\\*display \\([0-9]+\\)\\*" (buffer-name buffer))
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1830 (progn
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49249
diff changeset
1831 (let ((number
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1832 (match-string 1 (buffer-name buffer))))
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1833 (if (not (memq (string-to-int number) display-list))
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49249
diff changeset
1834 (kill-buffer
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1835 (get-buffer (concat "*display " number "*")))))))))
49039
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1836 (gdb-delete-frames display-list))))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1837
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1838 (defun gdb-delete-frames (display-list)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1839 (dolist (frame (frame-list))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1840 (let ((frame-name (frame-parameter frame 'name)))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1841 (if (string-match "\\*display \\([0-9]+\\)\\*" frame-name)
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1842 (progn
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1843 (let ((number (match-string 1 frame-name)))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1844 (if (not (memq (string-to-int number) display-list))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1845 (progn (kill-buffer
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1846 (get-buffer (concat "*display " number "*")))
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
1847 (delete-frame frame)))))))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1848
48661
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1849 (defvar gdb-display-mode-map
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1850 (let ((map (make-sparse-keymap))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1851 (menu (make-sparse-keymap "Display")))
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1852 (define-key menu [toggle] '("Toggle" . gdb-toggle-display))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1853 (define-key menu [delete] '("Delete" . gdb-delete-display))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1854
48661
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1855 (suppress-keymap map)
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1856 (define-key map [menu-bar display] (cons "Display" menu))
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1857 (define-key map " " 'gdb-toggle-display)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1858 (define-key map "d" 'gdb-delete-display)
48661
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1859 map))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1860
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1861 (defun gdb-display-mode ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1862 "Major mode for gdb display.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1863
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1864 \\{gdb-display-mode-map}"
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1865 (setq major-mode 'gdb-display-mode)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1866 (setq mode-name "Display")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1867 (setq buffer-read-only t)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1868 (use-local-map gdb-display-mode-map)
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1869 (gdb-invalidate-display))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1870
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1871 (defun gdb-display-buffer-name ()
48685
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
1872 (with-current-buffer gud-comint-buffer
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1873 (concat "*Displayed expressions of " (gdb-get-target-string) "*")))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1874
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1875 (defun gdb-display-display-buffer ()
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
1876 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1877 (gdb-display-buffer
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1878 (gdb-get-create-buffer 'gdb-display-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1879
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
1880 (defun gdb-frame-display-buffer ()
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
1881 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1882 (switch-to-buffer-other-frame
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1883 (gdb-get-create-buffer 'gdb-display-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1884
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1885 (defun gdb-toggle-display ()
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1886 "Enable/disable the displayed expression at current line."
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1887 (interactive)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1888 (save-excursion
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1889 (beginning-of-line 1)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1890 (if (not (looking-at "\\([0-9]+\\): \\([ny]\\)"))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1891 (error "No expression on this line")
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1892 (gdb-enqueue-input
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1893 (list
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1894 (concat
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1895 (if (eq ?y (char-after (match-beginning 2)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1896 "server disable display "
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1897 "server enable display ")
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1898 (match-string 1) "\n")
48641
da382393fb77 Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48640
diff changeset
1899 'ignore)))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1900
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1901 (defun gdb-delete-display ()
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1902 "Delete the displayed expression at current line."
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1903 (interactive)
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1904 (with-current-buffer (gdb-get-buffer 'gdb-display-buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1905 (beginning-of-line 1)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1906 (if (not (looking-at "\\([0-9]+\\): \\([ny]\\)"))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1907 (error "No expression on this line")
48641
da382393fb77 Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48640
diff changeset
1908 (let ((number (match-string 1)))
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1909 (gdb-enqueue-input
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1910 (list (concat "server delete display " number "\n") 'ignore))))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1911
48661
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1912 (defvar gdb-expressions-mode-map
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1913 (let ((map (make-sparse-keymap)))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1914 (suppress-keymap map)
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1915 (define-key map "v" 'gdb-array-visualise)
49147
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
1916 (define-key map "q" 'gdb-delete-expression)
48661
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1917 (define-key map [mouse-3] 'gdb-expressions-popup-menu)
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
1918 map))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1919
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1920 (defvar gdb-expressions-mode-menu
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1921 '("GDB Expressions Commands"
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1922 "----"
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1923 ["Visualise" gdb-array-visualise t]
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1924 ["Delete" gdb-delete-expression t])
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1925 "Menu for `gdb-expressions-mode'.")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1926
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1927 (defun gdb-expressions-popup-menu (event)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1928 "Explicit Popup menu as this buffer doesn't have a menubar."
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1929 (interactive "@e")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1930 (mouse-set-point event)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1931 (popup-menu gdb-expressions-mode-menu))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1932
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1933 (defun gdb-expressions-mode ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1934 "Major mode for display expressions.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1935
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1936 \\{gdb-expressions-mode-map}"
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1937 (setq major-mode 'gdb-expressions-mode)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1938 (setq mode-name "Expressions")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1939 (use-local-map gdb-expressions-mode-map)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1940 (make-local-variable 'gdb-display-number)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1941 (make-local-variable 'gdb-values)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1942 (make-local-variable 'gdb-expression)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1943 (set (make-local-variable 'gdb-display-string) nil)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1944 (set (make-local-variable 'gdb-dive-display-number) nil)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1945 (set (make-local-variable 'gud-minor-mode) 'gdba)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1946 (set (make-local-variable 'gdb-array-start) (make-vector 16 '-1))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1947 (set (make-local-variable 'gdb-array-stop) (make-vector 16 '-1))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1948 (set (make-local-variable 'gdb-array-size) (make-vector 16 '-1))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1949 (setq buffer-read-only t))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1950
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1951
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1952 ;;;; Window management
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1953
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1954 ;;; The way we abuse the dedicated-p flag is pretty gross, but seems
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1955 ;;; to do the right thing. Seeing as there is no way for Lisp code to
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1956 ;;; get at the use_time field of a window, I'm not sure there exists a
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1957 ;;; more elegant solution without writing C code.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1958
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1959 (defun gdb-display-buffer (buf &optional size)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1960 (let ((must-split nil)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1961 (answer nil))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1962 (unwind-protect
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1963 (progn
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1964 (walk-windows
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1965 '(lambda (win)
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1966 (if (or (eq gud-comint-buffer (window-buffer win))
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1967 (eq gdb-source-window win))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1968 (set-window-dedicated-p win t))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1969 (setq answer (get-buffer-window buf))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1970 (if (not answer)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1971 (let ((window (get-lru-window)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1972 (if window
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1973 (progn
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1974 (set-window-buffer window buf)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1975 (setq answer window))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1976 (setq must-split t)))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1977 (walk-windows
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1978 '(lambda (win)
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1979 (if (or (eq gud-comint-buffer (window-buffer win))
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
1980 (eq gdb-source-window win))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1981 (set-window-dedicated-p win nil)))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1982 (if must-split
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1983 (let* ((largest (get-largest-window))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1984 (cur-size (window-height largest))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1985 (new-size (and size (< size cur-size) (- cur-size size))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1986 (setq answer (split-window largest new-size))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1987 (set-window-buffer answer buf)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1988 answer))
48300
69646014abb3 Fix feature name in `require'.
Juanma Barranquero <lekktu@gmail.com>
parents: 48292
diff changeset
1989
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1990 (defun gdb-display-source-buffer (buffer)
51227
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1991 (if (eq gdb-selected-view 'source)
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1992 (set-window-buffer gdb-source-window buffer)
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1993 (set-window-buffer gdb-source-window
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1994 (gdb-get-buffer 'gdb-assembler-buffer)))
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1995 gdb-source-window)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1996
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1997
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1998 ;;; Shared keymap initialization:
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1999
51227
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
2000 (define-key gud-menu-map [gdb-many-windows]
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
2001 (menu-bar-make-toggle gdb-many-windows gdb-many-windows
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
2002 "Display other windows" "Many Windows %s"
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
2003 "Display locals, stack and breakpoint information"))
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
2004
51123
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2005 (let ((menu (make-sparse-keymap "GDB-Frames")))
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2006 (define-key gud-menu-map [frames]
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2007 `(menu-item "GDB-Frames" ,menu :visible (eq gud-minor-mode 'gdba)))
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2008 (define-key menu [gdb] '("Gdb" . gdb-frame-gdb-buffer))
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2009 (define-key menu [locals] '("Locals" . gdb-frame-locals-buffer))
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2010 (define-key menu [registers] '("Registers" . gdb-frame-registers-buffer))
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2011 (define-key menu [frames] '("Stack" . gdb-frame-stack-buffer))
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2012 (define-key menu [breakpoints] '("Breakpoints" . gdb-frame-breakpoints-buffer))
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2013 (define-key menu [display] '("Display" . gdb-frame-display-buffer))
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2014 (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer))
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2015 ; (define-key menu [assembler] '("Assembler" . gdb-frame-assembler-buffer))
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2016 )
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2017
48661
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2018 (let ((menu (make-sparse-keymap "GDB-Windows")))
48682
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
2019 (define-key gud-menu-map [displays]
48738
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
2020 `(menu-item "GDB-Windows" ,menu :visible (eq gud-minor-mode 'gdba)))
48661
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2021 (define-key menu [gdb] '("Gdb" . gdb-display-gdb-buffer))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2022 (define-key menu [locals] '("Locals" . gdb-display-locals-buffer))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2023 (define-key menu [registers] '("Registers" . gdb-display-registers-buffer))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2024 (define-key menu [frames] '("Stack" . gdb-display-stack-buffer))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2025 (define-key menu [breakpoints] '("Breakpoints" . gdb-display-breakpoints-buffer))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2026 (define-key menu [display] '("Display" . gdb-display-display-buffer))
50962
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
2027 (define-key menu [threads] '("Threads" . gdb-display-threads-buffer))
51123
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2028 ; (define-key menu [assembler] '("Assembler" . gdb-display-assembler-buffer))
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2029 )
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2030
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2031 (let ((menu (make-sparse-keymap "View")))
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2032 (define-key gud-menu-map [view] `(menu-item "View" ,menu))
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2033 ; (define-key menu [both] '(menu-item "Both" gdb-view-both
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2034 ; :help "Display both source and assembler"
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2035 ; :button (:radio . (eq gdb-selected-view 'both))))
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2036 (define-key menu [assembler] '(menu-item "Assembler" gdb-view-assembler
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2037 :help "Display assembler only"
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2038 :button (:radio . (eq gdb-selected-view 'assembler))))
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2039 (define-key menu [source] '(menu-item "Source" gdb-view-source
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2040 :help "Display source only"
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2041 :button (:radio . (eq gdb-selected-view 'source)))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2042
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
2043 (defun gdb-frame-gdb-buffer ()
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
2044 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2045 (switch-to-buffer-other-frame
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
2046 (gdb-get-create-buffer 'gdba)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2047
51123
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2048 (defun gdb-display-gdb-buffer ()
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2049 (interactive)
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2050 (gdb-display-buffer
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
2051 (gdb-get-create-buffer 'gdba)))
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2052
51617
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2053 (defvar gdb-main-file nil "Source file from which program execution begins.")
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2054
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2055 (defun gdb-view-source()
51617
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2056 (interactive)
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2057 (if gdb-view-source
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2058 (if gud-last-last-frame
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2059 (set-window-buffer gdb-source-window
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2060 (gud-find-file (car gud-last-last-frame)))
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2061 (set-window-buffer gdb-source-window (gud-find-file gdb-main-file))))
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2062 (setq gdb-selected-view 'source))
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2063
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2064 (defun gdb-view-assembler()
51617
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2065 (interactive)
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2066 (set-window-buffer gdb-source-window
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2067 (gdb-get-create-buffer 'gdb-assembler-buffer))
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2068 (setq gdb-selected-view 'assembler))
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2069
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2070 ;(defun gdb-view-both()
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2071 ;(interactive)
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2072 ;(setq gdb-selected-view 'both))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2073
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2074 ;; layout for all the windows
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
2075 (defun gdb-setup-windows ()
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
2076 (gdb-display-locals-buffer)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
2077 (gdb-display-stack-buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2078 (delete-other-windows)
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
2079 (gdb-display-breakpoints-buffer)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
2080 (gdb-display-display-buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2081 (delete-other-windows)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2082 (split-window nil ( / ( * (window-height) 3) 4))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2083 (split-window nil ( / (window-height) 3))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2084 (split-window-horizontally)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2085 (other-window 1)
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
2086 (switch-to-buffer (gdb-locals-buffer-name))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2087 (other-window 1)
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2088 (if gdb-view-source
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2089 (switch-to-buffer
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2090 (if gud-last-last-frame
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2091 (gud-find-file (car gud-last-last-frame))
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2092 (gud-find-file gdb-main-file)))
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2093 (switch-to-buffer (gdb-get-create-buffer 'gdb-assembler-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2094 (setq gdb-source-window (get-buffer-window (current-buffer)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2095 (split-window-horizontally)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2096 (other-window 1)
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
2097 (switch-to-buffer (gdb-inferior-io-name))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2098 (other-window 1)
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
2099 (switch-to-buffer (gdb-stack-buffer-name))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2100 (split-window-horizontally)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2101 (other-window 1)
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
2102 (switch-to-buffer (gdb-breakpoints-buffer-name))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2103 (other-window 1))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2104
51227
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
2105 (defcustom gdb-many-windows nil
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
2106 "Nil means that gdb starts with just two windows : the GUD and
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
2107 the source buffer."
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
2108 :type 'boolean
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
2109 :group 'gud)
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
2110
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
2111 (defun gdb-many-windows (arg)
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
2112 "Toggle the number of windows in the basic arrangement."
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
2113 (interactive "P")
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
2114 (setq gdb-many-windows
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
2115 (if (null arg)
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
2116 (not gdb-many-windows)
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
2117 (> (prefix-numeric-value arg) 0)))
48600
88be03de9df4 (gdb-many-windows): Define as a minor mode.
Nick Roberts <nickrob@snap.net.nz>
parents: 48570
diff changeset
2118 (gdb-restore-windows))
88be03de9df4 (gdb-many-windows): Define as a minor mode.
Nick Roberts <nickrob@snap.net.nz>
parents: 48570
diff changeset
2119
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2120 (defun gdb-restore-windows ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2121 "Restore the basic arrangement of windows used by gdba.
48498
8fdedd7dca85 General tidying. Patches from Stefan Monnier.
Nick Roberts <nickrob@snap.net.nz>
parents: 48300
diff changeset
2122 This arrangement depends on the value of `gdb-many-windows'."
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2123 (interactive)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2124 (if gdb-many-windows
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2125 (progn
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2126 (switch-to-buffer gud-comint-buffer)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2127 (delete-other-windows)
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
2128 (gdb-setup-windows))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2129 (switch-to-buffer gud-comint-buffer)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2130 (delete-other-windows)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2131 (split-window)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2132 (other-window 1)
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2133 (if gdb-view-source
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2134 (switch-to-buffer
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2135 (if gud-last-last-frame
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2136 (gud-find-file (car gud-last-last-frame))
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2137 (gud-find-file gdb-main-file)))
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2138 (switch-to-buffer (gdb-get-create-buffer 'gdb-assembler-buffer)))
51617
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2139 (setq gdb-source-window (get-buffer-window (current-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2140 (other-window 1)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2141
49147
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
2142 (defun gdb-reset ()
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
2143 "Exit a debugging session cleanly by killing the gdb buffers and resetting
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
2144 the source buffers."
49039
6c5f45b01d2e Acknowledge Tom Lord as author of gdba.el.
Nick Roberts <nickrob@snap.net.nz>
parents: 49000
diff changeset
2145 (gdb-delete-frames '())
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
2146 (dolist (buffer (buffer-list))
49147
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
2147 (if (not (eq buffer gud-comint-buffer))
49249
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
2148 (with-current-buffer buffer
49147
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
2149 (if (eq gud-minor-mode 'gdba)
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
2150 (if (string-match "^\*.+*$" (buffer-name))
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
2151 (kill-buffer nil)
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2152 (if (eq window-system 'x)
49147
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
2153 (remove-images (point-min) (point-max))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2154 (gdb-remove-strings (point-min) (point-max)))
49147
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
2155 (setq left-margin-width 0)
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
2156 (setq gud-minor-mode nil)
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
2157 (kill-local-variable 'tool-bar-map)
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
2158 (setq gud-running nil)
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
2159 (if (get-buffer-window (current-buffer))
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
2160 (set-window-margins (get-buffer-window
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
2161 (current-buffer))
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
2162 left-margin-width
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
2163 right-margin-width))))))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2164
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2165 (defun gdb-source-info ()
48641
da382393fb77 Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48640
diff changeset
2166 "Find the source file where the program starts and displays it with related
48570
4934b8352621 (gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents: 48515
diff changeset
2167 buffers."
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2168 (goto-char (point-min))
51617
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2169 (if (search-forward "directory is " nil t)
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2170 (progn
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2171 (if (looking-at "\\S-*:\\(\\S-*\\)")
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2172 (setq gdb-cdir (match-string 1))
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2173 (looking-at "\\S-*")
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2174 (setq gdb-cdir (match-string 0)))
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2175 (search-forward "Located in ")
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2176 (looking-at "\\S-*")
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2177 (setq gdb-main-file (match-string 0)))
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2178 (setq gdb-view-source nil))
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2179 (delete-other-windows)
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2180 (if gdb-many-windows
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2181 (gdb-setup-windows)
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2182 (gdb-display-breakpoints-buffer)
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2183 (gdb-display-display-buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2184 (delete-other-windows)
51617
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2185 (split-window)
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2186 (other-window 1)
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2187 (if gdb-view-source
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2188 (switch-to-buffer (gud-find-file gdb-main-file))
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2189 (switch-to-buffer (gdb-get-create-buffer 'gdb-assembler-buffer))
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2190 (gdb-invalidate-assembler))
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2191 (setq gdb-source-window (get-buffer-window (current-buffer)))
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2192 (other-window 1)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2193
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
2194 ;;from put-image
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2195 (defun gdb-put-string (putstring pos)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2196 "Put string PUTSTRING in front of POS in the current buffer.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2197 PUTSTRING is displayed by putting an overlay into the current buffer with a
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2198 `before-string' STRING that has a `display' property whose value is
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2199 PUTSTRING."
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2200 (setq string "x")
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2201 (let ((buffer (current-buffer)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2202 (setq string (copy-sequence string))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2203 (let ((overlay (make-overlay pos pos buffer))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2204 (prop (list (list 'margin 'left-margin) putstring)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2205 (put-text-property 0 (length string) 'display prop string)
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2206 (overlay-put overlay 'put-break t)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2207 (overlay-put overlay 'before-string string))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2208
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
2209 ;;from remove-images
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2210 (defun gdb-remove-strings (start end &optional buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2211 "Remove strings between START and END in BUFFER.
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2212 Remove only strings that were put in BUFFER with calls to `put-string'.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2213 BUFFER nil or omitted means use the current buffer."
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2214 (unless buffer
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2215 (setq buffer (current-buffer)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2216 (let ((overlays (overlays-in start end)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2217 (while overlays
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2218 (let ((overlay (car overlays)))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2219 (when (overlay-get overlay 'put-break)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2220 (delete-overlay overlay)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2221 (setq overlays (cdr overlays)))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2222
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2223 (defun gdb-put-arrow (putstring pos)
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2224 "Put arrow string PUTSTRING in the left margin in front of POS
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2225 in the current buffer. PUTSTRING is displayed by putting an
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2226 overlay into the current buffer with a `before-string'
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2227 \"gdb-arrow\" that has a `display' property whose value is
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2228 PUTSTRING. STRING is defaulted if you omit it. POS may be an
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2229 integer or marker."
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2230 (setq string "gdb-arrow")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2231 (let ((buffer (current-buffer)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2232 (setq string (copy-sequence string))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2233 (let ((overlay (make-overlay pos pos buffer))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2234 (prop (list (list 'margin 'left-margin) putstring)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2235 (put-text-property 0 (length string) 'display prop string)
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2236 (overlay-put overlay 'put-arrow t)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2237 (overlay-put overlay 'before-string string))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2238
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2239 (defun gdb-remove-arrow (&optional buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2240 "Remove arrow in BUFFER.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2241 Remove only images that were put in BUFFER with calls to `put-arrow'.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2242 BUFFER nil or omitted means use the current buffer."
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2243 (unless buffer
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2244 (setq buffer (current-buffer)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2245 (let ((overlays (overlays-in (point-min) (point-max))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2246 (while overlays
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2247 (let ((overlay (car overlays)))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2248 (when (overlay-get overlay 'put-arrow)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2249 (delete-overlay overlay)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2250 (setq overlays (cdr overlays)))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2251
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2252 (defun gdb-array-visualise ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2253 "Visualise arrays and slices using graph program from plotutils."
48498
8fdedd7dca85 General tidying. Patches from Stefan Monnier.
Nick Roberts <nickrob@snap.net.nz>
parents: 48300
diff changeset
2254 (interactive)
48661
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2255 (when (and (display-graphic-p) gdb-display-string)
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2256 (let ((n 0) m)
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2257 (catch 'multi-dimensional
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2258 (while (eq (aref gdb-array-start n) (aref gdb-array-stop n))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2259 (setq n (+ n 1)))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2260 (setq m (+ n 1))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2261 (while (< m (length gdb-array-start))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2262 (if (not (eq (aref gdb-array-start m) (aref gdb-array-stop m)))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2263 (progn
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2264 (x-popup-dialog
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2265 t `(,(concat "Only one dimensional data can be visualised.\n"
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2266 "Use an array slice to reduce the number of\n"
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2267 "dimensions") ("OK" t)))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2268 (throw 'multi-dimensional nil))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2269 (setq m (+ m 1))))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2270 (shell-command (concat "echo" gdb-display-string " | graph -a 1 "
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2271 (int-to-string (aref gdb-array-start n))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2272 " -x "
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2273 (int-to-string (aref gdb-array-start n))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2274 " "
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2275 (int-to-string (aref gdb-array-stop n))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2276 " 1 -T X"))))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2277
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
2278 (defun gdb-delete-expression ()
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2279 "Delete displayed expression and its frame."
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2280 (interactive)
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
2281 (gdb-enqueue-input
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2282 (list (concat "server delete display " gdb-display-number "\n")
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
2283 'ignore)))
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
2284
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
2285 ;;
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
2286 ;; Assembler buffer.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2287 ;;
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
2288 (gdb-set-buffer-rules 'gdb-assembler-buffer
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
2289 'gdb-assembler-buffer-name
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
2290 'gdb-assembler-mode)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2291
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2292 (def-gdb-auto-updated-buffer gdb-assembler-buffer
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2293 gdb-invalidate-assembler
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
2294 (concat "server disassemble " gdb-current-address "\n")
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2295 gdb-assembler-handler
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2296 gdb-assembler-custom)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2297
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2298 (defun gdb-assembler-custom ()
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
2299 (let ((buffer (gdb-get-buffer 'gdb-assembler-buffer))
51617
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2300 (gdb-arrow-position 1) (address) (flag))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2301 (with-current-buffer buffer
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
2302 (if (not (equal gdb-current-address "main"))
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
2303 (progn
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2304 (gdb-remove-arrow)
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2305 (goto-char (point-min))
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2306 (if (re-search-forward gdb-current-address nil t)
51617
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2307 (progn
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2308 (setq gdb-arrow-position (point))
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2309 (gdb-put-arrow "=>" (point))))))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2310 ;; remove all breakpoint-icons in assembler buffer before updating.
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2311 (if (eq window-system 'x)
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2312 (remove-images (point-min) (point-max))
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2313 (gdb-remove-strings (point-min) (point-max))))
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2314 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2315 (goto-char (point-min))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2316 (while (< (point) (- (point-max) 1))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2317 (forward-line 1)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2318 (if (looking-at "[^\t].*breakpoint")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2319 (progn
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2320 (looking-at
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
2321 "[0-9]*\\s-*\\S-*\\s-*\\S-*\\s-*\\(.\\)\\s-*0x\\(\\S-*\\)")
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
2322 (setq flag (char-after (match-beginning 1)))
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2323 (setq address (match-string 2))
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2324 ;; remove leading 0s from output of info break.
51529
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2325 (if (string-match "^0+\\(.*\\)" address)
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2326 (setq address (match-string 1 address)))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2327 (with-current-buffer buffer
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
2328 (goto-char (point-min))
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
2329 (if (re-search-forward address nil t)
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
2330 (let ((start (progn (beginning-of-line) (- (point) 1)))
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
2331 (end (progn (end-of-line) (+ (point) 1))))
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2332 (if (eq window-system 'x)
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
2333 (progn
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
2334 (remove-images start end)
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
2335 (if (eq ?y flag)
51227
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
2336 (put-image breakpoint-enabled-icon
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
2337 (+ start 1)
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
2338 "breakpoint icon enabled"
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
2339 'left-margin)
51227
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
2340 (put-image breakpoint-disabled-icon
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
2341 (+ start 1)
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
2342 "breakpoint icon disabled"
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
2343 'left-margin)))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2344 (gdb-remove-strings start end)
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
2345 (if (eq ?y flag)
51227
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
2346 (gdb-put-string "B" (+ start 1))
51617
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2347 (gdb-put-string "b" (+ start 1)))))))))))
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2348 (if (not (equal gdb-current-address "main"))
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
2349 (set-window-point (get-buffer-window buffer) gdb-arrow-position))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2350
48661
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2351 (defvar gdb-assembler-mode-map
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2352 (let ((map (make-sparse-keymap)))
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2353 (suppress-keymap map)
b092bff770ec Fold top-level `setq's and `define-key's into their corresponding defvar.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48659
diff changeset
2354 map))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2355
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2356 (defun gdb-assembler-mode ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2357 "Major mode for viewing code assembler.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2358
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2359 \\{gdb-assembler-mode-map}"
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2360 (setq major-mode 'gdb-assembler-mode)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2361 (setq mode-name "Assembler")
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
2362 (setq left-margin-width 2)
51227
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
2363 (setq fringes-outside-margins t)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2364 (setq buffer-read-only t)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2365 (use-local-map gdb-assembler-mode-map)
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
2366 (gdb-invalidate-assembler)
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
2367 (gdb-invalidate-breakpoints))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2368
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
2369 (defun gdb-assembler-buffer-name ()
48685
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
2370 (with-current-buffer gud-comint-buffer
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
2371 (concat "*Machine Code " (gdb-get-target-string) "*")))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2372
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
2373 (defun gdb-display-assembler-buffer ()
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
2374 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2375 (gdb-display-buffer
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
2376 (gdb-get-create-buffer 'gdb-assembler-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2377
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
2378 (defun gdb-frame-assembler-buffer ()
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
2379 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2380 (switch-to-buffer-other-frame
48921
3aa5ba679145 Remove the concept of an instance. This means that a lot of functions have
Nick Roberts <nickrob@snap.net.nz>
parents: 48884
diff changeset
2381 (gdb-get-create-buffer 'gdb-assembler-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2382
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
2383 ;; modified because if gdb-current-address has changed value a new command
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
2384 ;; must be enqueued to update the buffer with the new output
48515
3216cd45d6d2 Major re-organisation. Simplify legacy gdba code to allow only one gdb process.
Nick Roberts <nickrob@snap.net.nz>
parents: 48498
diff changeset
2385 (defun gdb-invalidate-assembler (&optional ignored)
51529
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2386 (if (gdb-get-buffer 'gdb-assembler-buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2387 (progn
51529
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2388 (if (string-equal gdb-current-frame gdb-previous-frame)
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2389 (gdb-assembler-custom)
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2390 (if (or (not (member 'gdb-invalidate-assembler
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2391 (gdb-get-pending-triggers)))
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2392 (not (string-equal gdb-current-address
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2393 gdb-previous-address)))
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2394 (progn
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2395 ;; take previous disassemble command off the queue
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2396 (with-current-buffer gud-comint-buffer
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2397 (let ((queue (gdb-get-idle-input-queue)) (item))
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2398 (dolist (item queue)
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2399 (if (equal (cdr item) '(gdb-assembler-handler))
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2400 (gdb-set-idle-input-queue
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2401 (delete item (gdb-get-idle-input-queue)))))))
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2402 (gdb-enqueue-idle-input
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2403 (list (concat "server disassemble " gdb-current-address "\n")
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2404 'gdb-assembler-handler))
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2405 (gdb-set-pending-triggers
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2406 (cons 'gdb-invalidate-assembler
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2407 (gdb-get-pending-triggers)))
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2408 (setq gdb-previous-address gdb-current-address)
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2409 (setq gdb-previous-frame gdb-current-frame)))))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2410
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
2411 (defun gdb-get-current-frame ()
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
2412 (if (not (member 'gdb-get-current-frame (gdb-get-pending-triggers)))
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49249
diff changeset
2413 (progn
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
2414 (gdb-enqueue-idle-input
51529
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2415 (list (concat "server info frame\n") 'gdb-frame-handler))
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49249
diff changeset
2416 (gdb-set-pending-triggers
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
2417 (cons 'gdb-get-current-frame
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
2418 (gdb-get-pending-triggers))))))
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
2419
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
2420 (defun gdb-frame-handler ()
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49249
diff changeset
2421 (gdb-set-pending-triggers
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
2422 (delq 'gdb-get-current-frame (gdb-get-pending-triggers)))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
2423 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
2424 (goto-char (point-min))
51529
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2425 (forward-line)
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2426 (if (looking-at ".*= 0x\\(\\S-*\\) in \\(\\S-*\\)")
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
2427 (progn
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
2428 (setq gdb-current-frame (match-string 2))
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
2429 (let ((address (match-string 1)))
51529
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2430 ;; remove leading 0s from output of info frame command.
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2431 (if (string-match "^0+\\(.*\\)" address)
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2432 (setq gdb-current-address
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2433 (concat "0x" (match-string 1 address)))
51529
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2434 (setq gdb-current-address (concat "0x" address))))
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2435 (if (or (if (not (looking-at ".*(\\S-*:[0-9]*)"))
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2436 (progn (setq gdb-view-source nil) t))
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2437 (eq gdb-selected-view 'assembler))
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
2438 (progn
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2439 (set-window-buffer
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2440 gdb-source-window
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
2441 (gdb-get-create-buffer 'gdb-assembler-buffer))
51529
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
2442 (gdb-invalidate-assembler)))))))
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
2443
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2444 (provide 'gdb-ui)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2445
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
2446 ;;; gdb-ui.el ends here