annotate lisp/gdb-ui.el @ 52709:7bea35b48a17

Revision: miles@gnu.org--gnu-2003/emacs--cvs-trunk--0--patch-69 Update INSTALL-CVS to reflect new loaddefs.el handling
author Miles Bader <miles@gnu.org>
date Wed, 01 Oct 2003 02:09:47 +0000
parents 367c1b29dbee
children f49c1c4d92de
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
51617
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
53 (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
54 (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
55 (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
56 (defvar gdb-current-frame "main")
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
57 (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
58 (defvar gdb-selected-view 'source "Code type that user wishes to view")
52698
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
59 (defvar gdb-var-list nil "List of variables in watch window")
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
60 (defvar gdb-var-changed nil "Non-nil means that gdb-var-list has changed")
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
61 (defvar gdb-update-flag t "Non-il means update buffers")
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
62 (defvar gdb-buffer-type nil)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
63 (defvar gdb-variables '()
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
64 "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
65
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
66 ;;;###autoload
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
67 (defun gdba (command-line)
48827
dc51e4b2d5c1 Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48738
diff changeset
68 "Run gdb on program FILE in buffer *gud-FILE*.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
69 The directory containing FILE becomes the initial working directory
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
70 and source-file directory for your debugger.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
71
48827
dc51e4b2d5c1 Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48738
diff changeset
72 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
73 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
74 following layout will appear (keybindings given in relevant buffer) :
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
75
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
76 ---------------------------------------------------------------------
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
77 GDB Toolbar
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
78 ---------------------------------------------------------------------
48827
dc51e4b2d5c1 Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48738
diff changeset
79 GUD buffer (I/O of GDB) | Locals buffer
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
80 |
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
81 |
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
82 |
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
83 ---------------------------------------------------------------------
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
84 Source buffer | Input/Output (of debuggee) buffer
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
85 | (comint-mode)
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 |
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
88 |
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
89 |
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 Stack buffer | Breakpoints buffer
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
94 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
95 | RET gdb-goto-breakpoint
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
96 | d gdb-delete-breakpoint
48292
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 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
100 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
101 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
102 in the GUD buffer.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
103
48827
dc51e4b2d5c1 Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48738
diff changeset
104 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
105 screen.
dc51e4b2d5c1 Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48738
diff changeset
106
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
107 Displayed expressions appear in separate frames. Arrays may be displayed
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
108 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
109 Pointers in structures may be followed in a tree-like fashion.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
110
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
111 The following interactive lisp functions help control operation :
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
112
48827
dc51e4b2d5c1 Improve documentation strings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48738
diff changeset
113 `gdb-many-windows' - Toggle the number of windows gdb uses.
52328
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
114 `gdb-restore-windows' - To restore the window layout."
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
115 ;;
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
116 (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
117 ;;
48682
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
118 ;; 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
119 (gdb command-line)
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
120 ;;
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
121 (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
122 (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
123 ;;
48682
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
124 (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
125 (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
126 (save-excursion
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
127 (beginning-of-line)
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
128 (forward-char 2)
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
129 (gud-call "break *%a" arg)))
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
130 "\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
131 ;;
48682
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
132 (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
133 (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
134 (save-excursion
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
135 (beginning-of-line)
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
136 (forward-char 2)
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
137 (gud-call "clear *%a" arg)))
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
138 "\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
139 ;;
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
140 (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
141 (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
142 (save-excursion
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
143 (beginning-of-line)
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
144 (forward-char 2)
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
145 (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
146 "\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
147
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
148 (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
149 ;;
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
150 ;; (re-)initialise
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
151 (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
152 (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
153 (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
154 (setq gdb-current-frame "main")
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
155 (setq gdb-view-source t)
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
156 (setq gdb-selected-view 'source)
52698
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
157 (setq gdb-var-list nil)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
158 (setq gdb-var-changed nil)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
159 (setq gdb-update-flag t)
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
160 ;;
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
161 (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
162 (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
163 ;;
48682
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
164 (gdb-clear-inferior-io)
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
165 ;;
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
166 (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
167 (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
168 (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
169 ;; find source file and compilation directory here
51787
10f90558dc89 (gdb-source-info): Display current frame when
Nick Roberts <nickrob@snap.net.nz>
parents: 51693
diff changeset
170 (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
171 (gdb-enqueue-input (list "server list MAIN__\n" 'ignore)) ; Fortran program
51787
10f90558dc89 (gdb-source-info): Display current frame when
Nick Roberts <nickrob@snap.net.nz>
parents: 51693
diff changeset
172 (gdb-enqueue-input (list "server info source\n" 'gdb-source-info))
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
173 ;;
48682
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
174 (run-hooks 'gdba-mode-hook))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
175
52698
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
176 (defun gud-watch ()
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
177 "Watch expression."
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
178 (interactive)
52698
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
179 (let ((expr (tooltip-identifier-from-point (point))))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
180 (setq expr (concat gdb-current-frame "::" expr))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
181 (catch 'already-watched
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
182 (dolist (var gdb-var-list)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
183 (if (string-equal expr (car var)) (throw 'already-watched 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
184 (gdb-enqueue-input
52698
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
185 (list (concat "interpreter mi \"-var-create - * " expr "\"\n")
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
186 `(lambda () (gdb-var-create-handler ,expr))))))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
187 (select-window (get-buffer-window gud-comint-buffer)))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
188
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
189 (defconst gdb-var-create-regexp
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
190 "name=\"\\(.*?\\)\",numchild=\"\\(.*?\\)\",type=\"\\(.*?\\)\"")
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
191
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
192 (defun gdb-var-create-handler (expr)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
193 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
194 (goto-char (point-min))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
195 (if (re-search-forward gdb-var-create-regexp nil t)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
196 (let ((var (list expr
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
197 (match-string-no-properties 1)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
198 (match-string-no-properties 2)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
199 (match-string-no-properties 3)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
200 nil)))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
201 (push var gdb-var-list)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
202 (speedbar 1)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
203 (if (equal (nth 2 var) "0")
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
204 (gdb-enqueue-input
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
205 (list (concat "interpreter mi \"-var-evaluate-expression "
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
206 (nth 1 var) "\"\n")
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
207 `(lambda () (gdb-var-evaluate-expression-handler
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
208 ,(nth 1 var)))))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
209 (setq gdb-var-changed t)))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
210 (if (re-search-forward "Undefined command" nil t)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
211 (message "Watching expressions requires gdb 6.0 onwards")
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
212 (message "No symbol %s in current context." expr)))))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
213
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
214 (defun gdb-var-evaluate-expression-handler (varnum)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
215 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
216 (goto-char (point-min))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
217 (re-search-forward ".*value=\"\\(.*?\\)\"" nil t)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
218 (let ((var-list nil))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
219 (dolist (var gdb-var-list)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
220 (if (string-equal varnum (cadr var))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
221 (progn
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
222 (push (nreverse (cons (match-string-no-properties 1)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
223 (cdr (nreverse var)))) var-list))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
224 (push var var-list)))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
225 (setq gdb-var-list (nreverse var-list))))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
226 (setq gdb-var-changed t))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
227
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
228 (defun gdb-var-list-children (varnum)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
229 (gdb-enqueue-input
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
230 (list (concat "interpreter mi \"-var-list-children " varnum "\"\n")
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
231 `(lambda () (gdb-var-list-children-handler ,varnum)))))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
232
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
233 (defconst gdb-var-list-children-regexp
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
234 "name=\"\\(.*?\\)\",exp=\"\\(.*?\\)\",numchild=\"\\(.*?\\)\",type=\"\\(.*?\\)\"")
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
235
52698
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
236 (defun gdb-var-list-children-handler (varnum)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
237 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
238 (goto-char (point-min))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
239 (let ((var-list nil))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
240 (catch 'child-already-watched
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
241 (dolist (var gdb-var-list)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
242 (if (string-equal varnum (cadr var))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
243 (progn
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
244 (push var var-list)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
245 (while (re-search-forward gdb-var-list-children-regexp nil t)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
246 (let ((varchild (list (match-string-no-properties 2)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
247 (match-string-no-properties 1)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
248 (match-string-no-properties 3)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
249 (match-string-no-properties 4)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
250 nil)))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
251 (dolist (var1 gdb-var-list)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
252 (if (string-equal (cadr var1) (cadr varchild))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
253 (throw 'child-already-watched nil)))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
254 (push varchild var-list)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
255 (if (equal (nth 2 varchild) "0")
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
256 (gdb-enqueue-input
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
257 (list
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
258 (concat "interpreter mi \"-var-evaluate-expression "
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
259 (nth 1 varchild) "\"\n")
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
260 `(lambda () (gdb-var-evaluate-expression-handler
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
261 ,(nth 1 varchild)))))))))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
262 (push var var-list)))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
263 (setq gdb-var-list (nreverse var-list))))))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
264
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
265 (defun gdb-var-update ()
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
266 (setq gdb-update-flag nil)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
267 (if (not (member 'gdb-var-update (gdb-get-pending-triggers)))
49147
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
268 (progn
52698
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
269 (gdb-enqueue-input (list "server interpreter mi \"-var-update *\"\n"
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
270 'gdb-var-update-handler))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
271 (gdb-set-pending-triggers (cons 'gdb-var-update
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
272 (gdb-get-pending-triggers))))))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
273
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
274 (defconst gdb-var-update-regexp "name=\"\\(.*?\\)\"")
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
275
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
276 (defun gdb-var-update-handler ()
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
277 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
278 (goto-char (point-min))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
279 (while (re-search-forward gdb-var-update-regexp nil t)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
280 (let ((varnum (match-string-no-properties 1)))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
281 (gdb-enqueue-input
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
282 (list (concat "interpreter mi \"-var-evaluate-expression "
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
283 varnum "\"\n")
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
284 `(lambda () (gdb-var-evaluate-expression-handler
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
285 ,varnum)))))))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
286 (gdb-set-pending-triggers
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
287 (delq 'gdb-var-update (gdb-get-pending-triggers))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
288
52698
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
289 (defun gdb-var-delete (text token indent)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
290 "Delete watched expression."
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
291 (interactive)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
292 (when (eq indent 0)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
293 (string-match "\\(\\S-+\\)" text)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
294 (let* ((expr (match-string 1 text))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
295 (var (assoc expr gdb-var-list))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
296 (varnum (cadr var)))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
297 (gdb-enqueue-input
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
298 (list (concat "interpreter mi \"-var-delete " varnum "\"\n")
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
299 'ignore))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
300 (setq gdb-var-list (delq var gdb-var-list))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
301 (dolist (varchild gdb-var-list)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
302 (if (string-match (concat (nth 1 var) "\\.") (nth 1 varchild))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
303 (setq gdb-var-list (delq varchild gdb-var-list)))))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
304 (setq gdb-var-changed t)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
305
52698
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
306 (defun gdb-speedbar-expand-node (text token indent)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
307 "Expand the node the user clicked on.
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
308 TEXT is the text of the button we clicked on, a + or - item.
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
309 TOKEN is data related to this node.
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
310 INDENT is the current indentation depth."
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
311 (cond ((string-match "+" text) ;expand this node
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
312 (gdb-var-list-children token))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
313 ((string-match "-" text) ;contract this node
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
314 (dolist (var gdb-var-list)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
315 (if (string-match (concat token "\\.") (nth 1 var))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
316 (setq gdb-var-list (delq var gdb-var-list))))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
317 (setq gdb-var-changed t))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
318
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
319
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
320 ;; ======================================================================
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
321 ;;
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
322 ;; In this world, there are gdb variables (of unspecified
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
323 ;; 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
324 ;; 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
325 ;; def-gdb-variable
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
326
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
327 (defmacro def-gdb-var (root-symbol &optional default doc)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
328 (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
329 (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
330 (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
331 (name (intern (concat "gdb-" root))))
7bc8b0b65a02 (gdba): Use the default for gud-find-file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48639
diff changeset
332 `(progn
7bc8b0b65a02 (gdba): Use the default for gud-find-file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48639
diff changeset
333 (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
334 (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
335 (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
336 (defun ,accessor ()
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
337 (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
338 (defun ,setter (val)
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
339 (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
340 (setq ,name val))))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
341
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
342 (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
343 "One of the symbols bound in gdb-buffer-rules")
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
344
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
345 (def-gdb-var burst ""
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
346 "A string of characters from gdb that have not yet been processed.")
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 (def-gdb-var input-queue ()
52443
31a30e670e11 (gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents: 52401
diff changeset
349 "A list of gdb command objects.")
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
350
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
351 (def-gdb-var prompting nil
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
352 "True when gdb is idle with no pending input.")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
353
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
354 (def-gdb-var output-sink 'user
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
355 "The disposition of the output of the current gdb command.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
356 Possible values are these symbols:
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
357
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
358 user -- gdb output should be copied to the GUD buffer
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
359 for the user to see.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
360
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
361 inferior -- gdb output should be copied to the inferior-io buffer
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
362
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
363 pre-emacs -- output should be ignored util the post-prompt
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
364 annotation is received. Then the output-sink
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
365 becomes:...
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
366 emacs -- output should be collected in the partial-output-buffer
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
367 for subsequent processing by a command. This is the
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
368 disposition of output generated by commands that
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
369 gdb mode sends to gdb on its own behalf.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
370 post-emacs -- ignore input until the prompt annotation is
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
371 received, then go to USER disposition.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
372 ")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
373
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
374 (def-gdb-var current-item nil
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
375 "The most recent command item sent to gdb.")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
376
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
377 (def-gdb-var pending-triggers '()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
378 "A list of trigger functions that have run later than their output
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
379 handlers.")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
380
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
381 ;; end of gdb variables
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
382
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
383 (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
384 (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
385 gud-target-name))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
386
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
387
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
388 ;;
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
389 ;; gdb buffers.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
390 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
391 ;; Each buffer has a TYPE -- a symbol that identifies the function
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
392 ;; of that particular buffer.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
393 ;;
48738
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
394 ;; The usual gdb interaction buffer is given the type `gdba' and
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
395 ;; is constructed specially.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
396 ;;
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
397 ;; 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
398 ;; 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
399
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
400 (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
401
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
402 (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
403 "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
404 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
405 (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
406 (gdb-look-for-tagged-buffer key (buffer-list))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
407
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
408 (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
409 "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
410 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
411 (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
412 (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
413 (name (funcall (gdb-rules-name-maker rules)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
414 (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
415 (with-current-buffer new
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
416 ;; 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
417 ;; 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
418 (set (make-local-variable 'gdb-buffer-type) key)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
419 (if (cdr (cdr rules))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
420 (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
421 (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
422 (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
423 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
424 new))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
425
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
426 (defun gdb-rules-name-maker (rules) (car (cdr rules)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
427
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
428 (defun gdb-look-for-tagged-buffer (key bufs)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
429 (let ((retval nil))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
430 (while (and (not retval) bufs)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
431 (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
432 (if (eq gdb-buffer-type key)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
433 (setq retval (car bufs)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
434 (setq bufs (cdr bufs)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
435 retval))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
436
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
437 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
438 ;; 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
439 ;; at least one and possible more functions. The functions have these
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
440 ;; roles in defining a buffer type:
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
441 ;;
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
442 ;; 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
443 ;;
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
444 ;; The remaining function(s) are optional:
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 ;; MODE - called in a new buffer with no arguments, should establish
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
447 ;; the proper mode for the buffer.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
448 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
449
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
450 (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
451 (let ((binding (assoc buffer-type gdb-buffer-rules-assoc)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
452 (if binding
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
453 (setcdr binding rules)
48685
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
454 (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
455 gdb-buffer-rules-assoc))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
456
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
457 ;; 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
458 (gdb-set-buffer-rules 'gdba 'error)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
459
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
460 ;;
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
461 ;; Partial-output buffer : This accumulates output from a command executed on
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
462 ;; behalf of emacs (rather than the user).
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
463 ;;
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
464 (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
465 'gdb-partial-output-name)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
466
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
467 (defun gdb-partial-output-name ()
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
468 (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
469 (gdb-get-target-string)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
470 "*"))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
471
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
472
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
473 (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
474 '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
475 'gdb-inferior-io-mode)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
476
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
477 (defun gdb-inferior-io-name ()
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
478 (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
479 (gdb-get-target-string)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
480 "*"))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
481
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
482 (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
483 (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
484 (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
485 (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
486 (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
487 (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
488 map))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
489
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
490 (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
491 "Major mode for gdb inferior-io."
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
492 :syntax-table nil :abbrev-table nil
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
493 ;; We want to use comint because it has various nifty and familiar
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
494 ;; 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
495 ;; a dummy one.
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
496 (make-comint-in-buffer
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
497 (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
498 (current-buffer) "hexl")
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
499 (setq comint-input-sender 'gdb-inferior-io-sender))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
500
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
501 (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
502 ;; 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
503 (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
504 (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
505 (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
506 (process-send-string proc "\n")))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
507
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
508 (defun gdb-inferior-io-interrupt ()
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
509 "Interrupt the program being debugged."
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
510 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
511 (interrupt-process
48685
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
512 (get-buffer-process gud-comint-buffer) comint-ptyp))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
513
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
514 (defun gdb-inferior-io-quit ()
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
515 "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
516 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
517 (quit-process
48685
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
518 (get-buffer-process gud-comint-buffer) comint-ptyp))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
519
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
520 (defun gdb-inferior-io-stop ()
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
521 "Stop the program being debugged."
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
522 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
523 (stop-process
48685
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
524 (get-buffer-process gud-comint-buffer) comint-ptyp))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
525
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
526 (defun gdb-inferior-io-eof ()
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
527 "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
528 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
529 (process-send-eof
48685
19bf840bede8 Replace uses of (gdb-get-instance-buffer 'gdba) and
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48682
diff changeset
530 (get-buffer-process gud-comint-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
531
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
532
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
533 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
534 ;; gdb communications
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
535 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
536
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
537 ;; INPUT: things sent to gdb
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
538 ;;
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
539 ;; 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
540 ;; user-like input) or a list of the form:
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
541 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
542 ;; (INPUT-STRING HANDLER-FN)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
543 ;;
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
544 ;; 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
545 ;; 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
546 ;; commands autonomously.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
547 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
548 ;; These lists are consumed tail first.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
549 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
550
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
551 (defun gdb-send (proc string)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
552 "A comint send filter for gdb.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
553 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
554 (gdb-enqueue-input (concat string "\n")))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
555
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
556 ;; Note: Stuff enqueued here will be sent to the next prompt, even if it
52698
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
557 ;; is a query, or other non-top-level prompt.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
558
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
559 (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
560 (if (gdb-get-prompting)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
561 (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
562 (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
563 (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
564 (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
565 (cons item (gdb-get-input-queue)))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
566
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
567 (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
568 (let ((queue (gdb-get-input-queue)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
569 (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
570 (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
571 (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
572 (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
573 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
574 (gdb-take-last-elt queue)))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
575
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
576 ;; Don't use this in general.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
577 (defun gdb-take-last-elt (l)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
578 (if (cdr (cdr l))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
579 (gdb-take-last-elt (cdr l))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
580 (let ((answer (car (cdr l))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
581 (setcdr l '())
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
582 answer)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
583
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
584
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
585 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
586 ;; output -- things gdb prints to emacs
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
587 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
588 ;; GDB output is a stream interrupted by annotations.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
589 ;; Annotations can be recognized by their beginning
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
590 ;; with \C-j\C-z\C-z<tag><opt>\C-j
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
591 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
592 ;; The tag is a string obeying symbol syntax.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
593 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
594 ;; The optional part `<opt>' can be either the empty string
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
595 ;; or a space followed by more data relating to the annotation.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
596 ;; For example, the SOURCE annotation is followed by a filename,
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
597 ;; line number and various useless goo. This data must not include
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
598 ;; any newlines.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
599 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
600
52698
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
601 (defcustom gud-gdba-command-name "~/gdb/gdb/gdb -annotate=3"
48682
a74dd42cf01d (gud-gdb-complete-string, gud-gdb-complete-break)
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48662
diff changeset
602 "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
603 :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
604 :group 'gud)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
605
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
606 (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
607 '(("pre-prompt" gdb-pre-prompt)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
608 ("prompt" gdb-prompt)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
609 ("commands" gdb-subprompt)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
610 ("overload-choice" gdb-subprompt)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
611 ("query" gdb-subprompt)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
612 ("prompt-for-continue" gdb-subprompt)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
613 ("post-prompt" gdb-post-prompt)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
614 ("source" gdb-source)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
615 ("starting" gdb-starting)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
616 ("exited" gdb-stopping)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
617 ("signalled" gdb-stopping)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
618 ("signal" gdb-stopping)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
619 ("breakpoint" gdb-stopping)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
620 ("watchpoint" gdb-stopping)
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
621 ("frame-begin" gdb-frame-begin)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
622 ("stopped" gdb-stopped)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
623 ) "An assoc mapping annotation tags to functions which process them.")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
624
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
625 (defconst gdb-source-spec-regexp
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
626 "\\(.*\\):\\([0-9]*\\):[0-9]*:[a-z]*:\\(0x[a-f0-9]*\\)")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
627
48570
4934b8352621 (gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents: 48515
diff changeset
628 ;; 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
629 (defun gdb-source (args)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
630 (string-match gdb-source-spec-regexp args)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
631 ;; Extract the frame position from the marker.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
632 (setq gud-last-frame
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
633 (cons
48641
da382393fb77 Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48640
diff changeset
634 (match-string 1 args)
da382393fb77 Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48640
diff changeset
635 (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
636 (setq gdb-current-address (match-string 3 args))
52328
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
637 (setq gdb-view-source t))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
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-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
640 (gdb-set-current-item item)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
641 (if (stringp item)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
642 (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
643 (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
644 (process-send-string (get-buffer-process gud-comint-buffer) item))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
645 (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
646 (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
647 (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
648 (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
649 (car item)))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
650
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
651 (defun gdb-pre-prompt (ignored)
48570
4934b8352621 (gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents: 48515
diff changeset
652 "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
653 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
654 (let ((sink (gdb-get-output-sink)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
655 (cond
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
656 ((eq sink 'user) t)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
657 ((eq sink 'emacs)
52698
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
658 (gdb-set-output-sink 'post-emacs))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
659 (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
660 (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
661 (error "Phase error in gdb-pre-prompt (got %s)" sink)))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
662
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
663 (defun gdb-prompt (ignored)
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49249
diff changeset
664 "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
665 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
666 (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
667 (cond
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
668 ((eq sink 'user) t)
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
669 ((eq sink 'post-emacs)
52698
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
670 (gdb-set-output-sink 'user)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
671 (let ((handler
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
672 (car (cdr (gdb-get-current-item)))))
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
673 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
674 (funcall handler))))
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
675 (t
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
676 (gdb-set-output-sink 'user)
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
677 (error "Phase error in gdb-prompt (got %s)" sink))))
52443
31a30e670e11 (gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents: 52401
diff changeset
678 (let ((input (gdb-dequeue-input)))
31a30e670e11 (gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents: 52401
diff changeset
679 (if input
31a30e670e11 (gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents: 52401
diff changeset
680 (gdb-send-item input)
31a30e670e11 (gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents: 52401
diff changeset
681 (progn
31a30e670e11 (gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents: 52401
diff changeset
682 (gdb-set-prompting t)
31a30e670e11 (gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents: 52401
diff changeset
683 (gud-display-frame)))))
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
684
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
685 (defun gdb-subprompt (ignored)
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
686 "An annotation handler for non-top-level prompts."
52443
31a30e670e11 (gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents: 52401
diff changeset
687 (gdb-set-prompting t))
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
688
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
689 (defun gdb-starting (ignored)
48570
4934b8352621 (gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents: 48515
diff changeset
690 "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
691 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
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)
48570
4934b8352621 (gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents: 48515
diff changeset
695 (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
696 (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
697 (gdb-set-output-sink 'inferior)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
698 (t (error "Unexpected `starting' annotation")))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
699
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
700 (defun gdb-stopping (ignored)
48570
4934b8352621 (gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents: 48515
diff changeset
701 "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
702 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
703 (let ((sink (gdb-get-output-sink)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
704 (cond
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
705 ((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
706 (gdb-set-output-sink 'user))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
707 (t (error "Unexpected stopping annotation")))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
708
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
709 (defun gdb-frame-begin (ignored)
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
710 (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
711 (cond
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
712 ((eq sink 'inferior)
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
713 (gdb-set-output-sink 'user))
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
714 ((eq sink 'user) t)
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
715 ((eq sink 'emacs) t)
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
716 (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
717
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
718 (defun gdb-stopped (ignored)
48570
4934b8352621 (gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents: 48515
diff changeset
719 "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
720 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
721 (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
722 (let ((sink (gdb-get-output-sink)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
723 (cond
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
724 ((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
725 (gdb-set-output-sink 'user))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
726 ((eq sink 'user) t)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
727 (t (error "Unexpected stopped annotation")))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
728
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
729 (defun gdb-post-prompt (ignored)
48570
4934b8352621 (gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents: 48515
diff changeset
730 "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
731 output from the current command if that happens to be appropriate."
52698
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
732 (if (and (not (gdb-get-pending-triggers)) gdb-update-flag)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
733 (progn
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
734 (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
735 (gdb-invalidate-frames)
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
736 (gdb-invalidate-breakpoints)
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
737 (gdb-invalidate-assembler)
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
738 (gdb-invalidate-registers)
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
739 (gdb-invalidate-locals)
50962
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
740 (gdb-invalidate-threads)))
52698
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
741 (setq gdb-update-flag 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
742 (let ((sink (gdb-get-output-sink)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
743 (cond
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
744 ((eq sink 'user) t)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
745 ((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
746 (gdb-set-output-sink 'emacs))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
747 (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
748 (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
749 (error "Phase error in gdb-post-prompt (got %s)" sink)))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
750
48884
f774c94b3b5e (gdba-marker-filter, gdb-output-burst): Merge and
Nick Roberts <nickrob@snap.net.nz>
parents: 48827
diff changeset
751 (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
752 "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
753 (let (
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
754 ;; 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
755 (burst (concat (gdb-get-burst) string))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
756 ;; 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
757 (output ""))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
758 ;;
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
759 ;; 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
760 (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
761 (let ((annotation (match-string 1 burst)))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
762 ;;
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
763 ;; 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
764 ;; 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
765 ;; elsewhere.
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
766 (setq output
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49249
diff changeset
767 (gdb-concat-output
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
768 output
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
769 (substring burst 0 (match-beginning 0))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
770
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
771 ;; Take that stuff off the burst.
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
772 (setq burst (substring burst (match-end 0)))
48300
69646014abb3 Fix feature name in `require'.
Juanma Barranquero <lekktu@gmail.com>
parents: 48292
diff changeset
773
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
774 ;; 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
775 (string-match "\\(\\S-*\\) ?\\(.*\\)" annotation)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
776 (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
777 (annotation-arguments (match-string 2 annotation))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
778 (annotation-rule (assoc annotation-type
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
779 gdb-annotation-rules)))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
780 ;; Call the handler for this annotation.
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
781 (if annotation-rule
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
782 (funcall (car (cdr annotation-rule))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
783 annotation-arguments)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
784 ;; 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
785 ;; 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
786 ;; us to blow up.
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
787 ))))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
788 ;;
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
789 ;; 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
790 ;; 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
791 (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
792 burst)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
793 (progn
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
794 ;; 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
795 (setq output
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
796 (gdb-concat-output output
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
797 (substring burst 0 (match-beginning 0))))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
798 ;;
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
799 ;; 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
800 (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
801 ;;
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
802 ;; 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
803 (progn
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
804 (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
805 (setq burst "")))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
806 ;;
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
807 ;; 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
808 (gdb-set-burst burst)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
809 output))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
810
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
811 (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
812 (let ((sink (gdb-get-output-sink )))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
813 (cond
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
814 ((eq sink 'user) (concat so-far new))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
815 ((or (eq sink 'pre-emacs) (eq sink 'post-emacs)) so-far)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
816 ((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
817 (gdb-append-to-partial-output new)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
818 so-far)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
819 ((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
820 (gdb-append-to-inferior-io new)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
821 so-far)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
822 (t (error "Bogon output sink %S" sink)))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
823
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
824 (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
825 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
826 (goto-char (point-max))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
827 (insert string)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
828
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
829 (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
830 (with-current-buffer (gdb-get-create-buffer 'gdb-partial-output-buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
831 (delete-region (point-min) (point-max))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
832
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
833 (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
834 (with-current-buffer (gdb-get-create-buffer 'gdb-inferior-io)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
835 (goto-char (point-max))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
836 (insert-before-markers string))
48884
f774c94b3b5e (gdba-marker-filter, gdb-output-burst): Merge and
Nick Roberts <nickrob@snap.net.nz>
parents: 48827
diff changeset
837 (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
838 (gdb-display-buffer (gdb-get-create-buffer 'gdb-inferior-io))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
839
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
840 (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
841 (with-current-buffer (gdb-get-create-buffer 'gdb-inferior-io)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
842 (delete-region (point-min) (point-max))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
843
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
844
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
845 ;; 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
846 ;; 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
847 ;; type.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
848 ;;
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
849 ;; 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
850 ;; 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
851 ;; behind the user's back.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
852 ;;
52443
31a30e670e11 (gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents: 52401
diff changeset
853 ;; The output phasing associated with the variable gdb-output-sink
31a30e670e11 (gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents: 52401
diff changeset
854 ;; 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
855 ;;
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
856 ;; Below is the code for specificly managing buffers of output from one
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
857 ;; command.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
858 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
859
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
860 ;; The trigger function is suitable for use in the assoc GDB-ANNOTATION-RULES
52443
31a30e670e11 (gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents: 52401
diff changeset
861 ;; It adds an input for the command we are tracking. It should be the
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
862 ;; annotation rule binding of whatever gdb sends to tell us this command
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
863 ;; might have changed it's output.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
864 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
865 ;; 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
866 ;; 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
867 ;; 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
868
4934b8352621 (gdb-starting): Set gdb-running to t.
Nick Roberts <nickrob@snap.net.nz>
parents: 48515
diff changeset
869 (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
870 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
871 `(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
872 (if (and (,demand-predicate)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
873 (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
874 (gdb-get-pending-triggers))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
875 (progn
52443
31a30e670e11 (gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents: 52401
diff changeset
876 (gdb-enqueue-input
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
877 (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
878 (gdb-set-pending-triggers
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
879 (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
880 (gdb-get-pending-triggers)))))))
48300
69646014abb3 Fix feature name in `require'.
Juanma Barranquero <lekktu@gmail.com>
parents: 48292
diff changeset
881
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
882 (defmacro def-gdb-auto-update-handler (name trigger buf-key custom-defun)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
883 `(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
884 (gdb-set-pending-triggers
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
885 (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
886 (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
887 (let ((buf (gdb-get-buffer ',buf-key)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
888 (and buf
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
889 (with-current-buffer buf
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
890 (let ((p (point))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
891 (buffer-read-only nil))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
892 (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
893 (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
894 'gdb-partial-output-buffer))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
895 (goto-char p)))))
48641
da382393fb77 Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48640
diff changeset
896 ;; put customisation here
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
897 (,custom-defun)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
898
48641
da382393fb77 Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48640
diff changeset
899 (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
900 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
901 `(progn
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
902 (def-gdb-auto-update-trigger ,trigger-name
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
903 ;; 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
904 (lambda () (gdb-get-buffer ',buffer-key))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
905 ,gdb-command
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
906 ,output-handler-name)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
907 (def-gdb-auto-update-handler ,output-handler-name
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
908 ,trigger-name ,buffer-key ,custom-defun)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
909
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
910
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
911 ;;
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
912 ;; 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
913 ;;
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
914 (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
915 '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
916 'gdb-breakpoints-mode)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
917
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
918 (def-gdb-auto-updated-buffer gdb-breakpoints-buffer
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
919 ;; This defines the auto update rule for buffers of type
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
920 ;; `gdb-breakpoints-buffer'.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
921 ;;
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
922 ;; It defines a function to serve as the annotation handler that
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
923 ;; handles the `foo-invalidated' message. That function is called:
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
924 gdb-invalidate-breakpoints
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
925 ;;
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
926 ;; To update the buffer, this command is sent to gdb.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
927 "server info breakpoints\n"
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
928 ;;
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
929 ;; This also defines a function to be the handler for the output
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
930 ;; from the command above. That function will copy the output into
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
931 ;; the appropriately typed buffer. That function will be called:
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
932 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
933 ;; buffer specific functions
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
934 gdb-info-breakpoints-custom)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
935
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
936 (defvar gdb-cdir nil "Compilation directory.")
50796
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
937
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
938 (defconst breakpoint-xpm-data "/* XPM */
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
939 static char *magick[] = {
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
940 /* columns rows colors chars-per-pixel */
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
941 \"12 12 2 1\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
942 \" c red\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
943 \"+ c None\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
944 /* pixels */
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
945 \"++++++++++++\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
946 \"+++ +++\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
947 \"++ ++\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
948 \"+ +\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
949 \"+ +\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
950 \"+ +\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
951 \"+ +\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
952 \"+ +\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
953 \"+ +\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
954 \"++ ++\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
955 \"+++ +++\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
956 \"++++++++++++\"
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
957 };"
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
958 "XPM data used for breakpoint icon.")
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
959
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
960 (defconst breakpoint-enabled-pbm-data
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
961 "P1
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
962 12 12\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
963 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
964 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
965 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
966 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
967 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
968 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
969 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
970 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
971 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
972 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
973 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
974 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
975 "PBM data used for enabled breakpoint icon.")
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
976
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
977 (defconst breakpoint-disabled-pbm-data
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
978 "P1
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
979 12 12\",
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
980 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
981 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
982 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
983 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
984 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
985 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
986 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
987 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
988 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
989 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
990 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
991 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
992 "PBM data used for disabled breakpoint icon.")
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
993
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
994 (defvar breakpoint-enabled-icon
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
995 (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
996 (:type pbm :data ,breakpoint-enabled-pbm-data)))
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
997 "Icon for enabled breakpoint in display margin")
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
998
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
999 (defvar breakpoint-disabled-icon
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1000 (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
1001 (:type pbm :data ,breakpoint-disabled-pbm-data)))
5f329faeef51 (breakpoint-enabled-icon, breakpoint-disabled-icon):
Nick Roberts <nickrob@snap.net.nz>
parents: 50378
diff changeset
1002 "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
1003
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
1004 ;;-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
1005 (defun gdb-info-breakpoints-custom ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1006 (let ((flag)(address))
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1007 ;;
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
1008 ;; 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
1009 (dolist (buffer (buffer-list))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1010 (with-current-buffer buffer
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1011 (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
1012 (not (string-match "^\*" (buffer-name))))
52177
57a5b7571acc (gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents: 52066
diff changeset
1013 (if (display-images-p)
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1014 (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
1015 (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
1016 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1017 (save-excursion
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1018 (goto-char (point-min))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1019 (while (< (point) (- (point-max) 1))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1020 (forward-line 1)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1021 (if (looking-at "[^\t].*breakpoint")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1022 (progn
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1023 (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
1024 (setq flag (char-after (match-beginning 1)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1025 (beginning-of-line)
48738
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1026 (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
1027 (progn
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1028 (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
1029 (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
1030 (file (match-string 1)))
52177
57a5b7571acc (gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents: 52066
diff changeset
1031 (add-text-properties (point-at-bol) (point-at-eol)
57a5b7571acc (gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents: 52066
diff changeset
1032 '(mouse-face highlight
57a5b7571acc (gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents: 52066
diff changeset
1033 help-echo "mouse-2, RET: visit breakpoint"))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1034 (with-current-buffer
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1035 (find-file-noselect
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1036 (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
1037 (expand-file-name file gdb-cdir)))
48738
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1038 (save-current-buffer
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1039 (set (make-local-variable 'gud-minor-mode) 'gdba)
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1040 (set (make-local-variable 'tool-bar-map)
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1041 gud-tool-bar-map)
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1042 (setq left-margin-width 2)
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1043 (if (get-buffer-window (current-buffer))
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1044 (set-window-margins (get-buffer-window
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1045 (current-buffer))
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1046 left-margin-width
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1047 right-margin-width)))
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1048 ;; only want one breakpoint icon at each location
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1049 (save-excursion
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1050 (goto-line (string-to-number line))
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49249
diff changeset
1051 (let ((start (progn (beginning-of-line)
48738
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1052 (- (point) 1)))
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1053 (end (progn (end-of-line) (+ (point) 1))))
52177
57a5b7571acc (gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents: 52066
diff changeset
1054 (if (display-images-p)
48738
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1055 (progn
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1056 (remove-images start end)
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1057 (if (eq ?y flag)
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49249
diff changeset
1058 (put-image breakpoint-enabled-icon
51227
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1059 (+ start 1)
48738
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1060 "breakpoint icon enabled"
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1061 'left-margin)
51227
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1062 (put-image breakpoint-disabled-icon
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1063 (+ start 1)
48738
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1064 "breakpoint icon disabled"
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1065 'left-margin)))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1066 (gdb-remove-strings start end)
48738
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1067 (if (eq ?y flag)
51227
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1068 (gdb-put-string "B" (+ start 1))
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1069 (gdb-put-string "b" (+ start 1))))))))))))
52328
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1070 (end-of-line)))))
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1071 (if (gdb-get-buffer 'gdb-assembler-buffer) (gdb-assembler-custom)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1072
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
1073 (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
1074 (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
1075 (concat "*breakpoints of " (gdb-get-target-string) "*")))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1076
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
1077 (defun gdb-display-breakpoints-buffer ()
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
1078 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1079 (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
1080 (gdb-get-create-buffer 'gdb-breakpoints-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1081
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
1082 (defun gdb-frame-breakpoints-buffer ()
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
1083 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1084 (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
1085 (gdb-get-create-buffer 'gdb-breakpoints-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1086
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
1087 (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
1088 (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
1089 (menu (make-sparse-keymap "Breakpoints")))
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1090 (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
1091 (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
1092 (define-key menu [goto] '("Goto" . gdb-goto-breakpoint))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1093
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
1094 (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
1095 (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
1096 (define-key map " " 'gdb-toggle-breakpoint)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1097 (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
1098 (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
1099 (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
1100 map))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1101
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1102 (defun gdb-breakpoints-mode ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1103 "Major mode for gdb breakpoints.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1104
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1105 \\{gdb-breakpoints-mode-map}"
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1106 (setq major-mode 'gdb-breakpoints-mode)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1107 (setq mode-name "Breakpoints")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1108 (use-local-map gdb-breakpoints-mode-map)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1109 (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
1110 (gdb-invalidate-breakpoints))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1111
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1112 (defun gdb-toggle-breakpoint ()
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1113 "Enable/disable the breakpoint at current line."
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1114 (interactive)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1115 (save-excursion
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1116 (beginning-of-line 1)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1117 (if (not (looking-at "\\([0-9]+\\).*point\\s-*\\S-*\\s-*\\(.\\)"))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1118 (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
1119 (gdb-enqueue-input
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1120 (list
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1121 (concat
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1122 (if (eq ?y (char-after (match-beginning 2)))
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49249
diff changeset
1123 "server disable "
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1124 "server enable ")
48963
1bb53161a4b9 (gdb-info-display-custom): Ensure that frames/buffers
Nick Roberts <nickrob@snap.net.nz>
parents: 48955
diff changeset
1125 (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
1126 'ignore)))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1127
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1128 (defun gdb-delete-breakpoint ()
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1129 "Delete the breakpoint at current line."
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1130 (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
1131 (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
1132 (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
1133 (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
1134 (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
1135 (list (concat "server delete " (match-string 1) "\n") 'ignore))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1136
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
1137 (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
1138
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1139 (defun gdb-goto-breakpoint ()
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1140 "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
1141 current line."
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1142 (interactive)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1143 (save-excursion
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1144 (beginning-of-line 1)
48738
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1145 (re-search-forward "in\\s-+\\S-+\\s-+at\\s-+" nil t)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1146 (looking-at "\\(\\S-*\\):\\([0-9]+\\)"))
48738
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1147 (if (match-string 2)
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1148 (let ((line (match-string 2))
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1149 (file (match-string 1)))
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1150 (save-selected-window
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1151 (select-window gdb-source-window)
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1152 (switch-to-buffer (find-file-noselect
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1153 (if (file-exists-p file)
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1154 file
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1155 (expand-file-name file gdb-cdir))))
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1156 (goto-line (string-to-number line))))))
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1157
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1158 (defun gdb-mouse-goto-breakpoint (event)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1159 "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
1160 (interactive "e")
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1161 (mouse-set-point event)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1162 (gdb-goto-breakpoint))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1163
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1164 ;;
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1165 ;; Frames buffer. This displays a perpetually correct bactracktrace
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1166 ;; (from the command `where').
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1167 ;;
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1168 ;; Alas, if your stack is deep, it is costly.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1169 ;;
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
1170 (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
1171 '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
1172 'gdb-frames-mode)
48292
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 (def-gdb-auto-updated-buffer gdb-stack-buffer
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1175 gdb-invalidate-frames
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1176 "server where\n"
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1177 gdb-info-frames-handler
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1178 gdb-info-frames-custom)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1179
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1180 (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
1181 (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
1182 (save-excursion
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1183 (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
1184 (goto-char (point-min))
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1185 (while (< (point) (point-max))
52177
57a5b7571acc (gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents: 52066
diff changeset
1186 (add-text-properties (point-at-bol) (point-at-eol)
57a5b7571acc (gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents: 52066
diff changeset
1187 '(mouse-face highlight
57a5b7571acc (gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents: 52066
diff changeset
1188 help-echo "mouse-2, RET: Select frame"))
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1189 (beginning-of-line)
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1190 (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
1191 (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
1192 (if (equal (match-string 1) gdb-current-frame)
52177
57a5b7571acc (gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents: 52066
diff changeset
1193 (put-text-property (point-at-bol) (point-at-eol)
57a5b7571acc (gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents: 52066
diff changeset
1194 'face
57a5b7571acc (gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents: 52066
diff changeset
1195 `(:background ,(face-attribute 'default :foreground)
57a5b7571acc (gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents: 52066
diff changeset
1196 :foreground ,(face-attribute 'default :background)))))
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1197 (forward-line 1))))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1198
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
1199 (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
1200 (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
1201 (concat "*stack frames of " (gdb-get-target-string) "*")))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1202
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
1203 (defun gdb-display-stack-buffer ()
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
1204 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1205 (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
1206 (gdb-get-create-buffer 'gdb-stack-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1207
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
1208 (defun gdb-frame-stack-buffer ()
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
1209 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1210 (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
1211 (gdb-get-create-buffer 'gdb-stack-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1212
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
1213 (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
1214 (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
1215 (suppress-keymap map)
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1216 (define-key map "\r" 'gdb-frames-select)
48738
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1217 (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
1218 map))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1219
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1220 (defun gdb-frames-mode ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1221 "Major mode for gdb frames.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1222
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1223 \\{gdb-frames-mode-map}"
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1224 (setq major-mode 'gdb-frames-mode)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1225 (setq mode-name "Frames")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1226 (setq buffer-read-only t)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1227 (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
1228 (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
1229 (gdb-invalidate-frames))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1230
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1231 (defun gdb-get-frame-number ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1232 (save-excursion
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1233 (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
1234 (n (or (and pos (match-string-no-properties 1)) "0")))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1235 n)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1236
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1237 (defun gdb-frames-select ()
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1238 "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
1239 source in the source buffer."
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1240 (interactive)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1241 (gdb-enqueue-input
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1242 (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
1243 (gud-display-frame))
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1244
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1245 (defun gdb-frames-mouse-select (event)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1246 "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
1247 the source buffer."
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1248 (interactive "e")
49000
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1249 (mouse-set-point event)
f3c5848184cb (gdb-delete-display): Rename (gdb-delete-expression).
Nick Roberts <nickrob@snap.net.nz>
parents: 48963
diff changeset
1250 (gdb-frames-select))
48292
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 ;;
50962
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1253 ;; 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
1254 ;;
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1255 (gdb-set-buffer-rules 'gdb-threads-buffer
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1256 'gdb-threads-buffer-name
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1257 'gdb-threads-mode)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1258
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1259 (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
1260 gdb-invalidate-threads
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1261 "info threads\n"
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1262 gdb-info-threads-handler
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1263 gdb-info-threads-custom)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1264
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1265 (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
1266 (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
1267 (let ((buffer-read-only nil))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1268 (goto-char (point-min))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1269 (while (< (point) (point-max))
52177
57a5b7571acc (gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents: 52066
diff changeset
1270 (add-text-properties (point-at-bol) (point-at-eol)
57a5b7571acc (gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents: 52066
diff changeset
1271 '(mouse-face highlight
57a5b7571acc (gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents: 52066
diff changeset
1272 help-echo "mouse-2, RET: select thread"))
50962
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1273 (forward-line 1)))))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1274
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1275 (defun gdb-threads-buffer-name ()
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1276 (with-current-buffer gud-comint-buffer
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1277 (concat "*threads of " (gdb-get-target-string) "*")))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1278
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1279 (defun gdb-display-threads-buffer ()
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1280 (interactive)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1281 (gdb-display-buffer
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1282 (gdb-get-create-buffer 'gdb-threads-buffer)))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1283
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1284 (defun gdb-frame-threads-buffer ()
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1285 (interactive)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1286 (switch-to-buffer-other-frame
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1287 (gdb-get-create-buffer 'gdb-threads-buffer)))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1288
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1289 (defvar gdb-threads-mode-map
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1290 (let ((map (make-sparse-keymap)))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1291 (suppress-keymap map)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1292 (define-key map "\r" 'gdb-threads-select)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1293 (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
1294 map))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1295
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1296 (defun gdb-threads-mode ()
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1297 "Major mode for gdb frames.
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1298
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1299 \\{gdb-frames-mode-map}"
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1300 (setq major-mode 'gdb-threads-mode)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1301 (setq mode-name "Threads")
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1302 (setq buffer-read-only t)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1303 (use-local-map gdb-threads-mode-map)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1304 (gdb-invalidate-threads))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1305
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1306 (defun gdb-get-thread-number ()
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1307 (save-excursion
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1308 (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
1309 (match-string-no-properties 1)))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1310
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1311
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1312 (defun gdb-threads-select ()
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1313 "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
1314 source in the source buffer."
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1315 (interactive)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1316 (gdb-enqueue-input
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1317 (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
1318 (gud-display-frame))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1319
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1320 (defun gdb-threads-mouse-select (event)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1321 "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
1322 the source buffer."
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1323 (interactive "e")
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1324 (mouse-set-point event)
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1325 (gdb-threads-select))
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1326
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1327 ;;
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1328 ;; Registers buffer.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1329 ;;
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1330 (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
1331 'gdb-registers-buffer-name
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1332 'gdb-registers-mode)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1333
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1334 (def-gdb-auto-updated-buffer gdb-registers-buffer
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1335 gdb-invalidate-registers
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1336 "server info registers\n"
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1337 gdb-info-registers-handler
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1338 gdb-info-registers-custom)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1339
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1340 (defun gdb-info-registers-custom ())
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1341
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
1342 (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
1343 (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
1344 (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
1345 map))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1346
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1347 (defun gdb-registers-mode ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1348 "Major mode for gdb registers.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1349
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1350 \\{gdb-registers-mode-map}"
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1351 (setq major-mode 'gdb-registers-mode)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1352 (setq mode-name "Registers")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1353 (setq buffer-read-only t)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1354 (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
1355 (gdb-invalidate-registers))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1356
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
1357 (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
1358 (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
1359 (concat "*registers of " (gdb-get-target-string) "*")))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1360
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
1361 (defun gdb-display-registers-buffer ()
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
1362 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1363 (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
1364 (gdb-get-create-buffer 'gdb-registers-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1365
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
1366 (defun gdb-frame-registers-buffer ()
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
1367 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1368 (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
1369 (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
1370
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1371 ;;
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1372 ;; Locals buffer.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1373 ;;
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1374 (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
1375 'gdb-locals-buffer-name
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1376 'gdb-locals-mode)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1377
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1378 (def-gdb-auto-updated-buffer gdb-locals-buffer
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1379 gdb-invalidate-locals
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1380 "server info locals\n"
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1381 gdb-info-locals-handler
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1382 gdb-info-locals-custom)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1383
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49249
diff changeset
1384 ;; 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
1385 ;; These can be expanded using gud-display.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1386 (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
1387 (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
1388 (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
1389 (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
1390 (with-current-buffer buf
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1391 (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
1392 (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
1393 (replace-match "" nil nil))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1394 (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
1395 (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
1396 (replace-match "(array);\n" nil nil))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1397 (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
1398 (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
1399 (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
1400 (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
1401 (and buf (with-current-buffer buf
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1402 (let ((p (point))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1403 (buffer-read-only nil))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1404 (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
1405 (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
1406 'gdb-partial-output-buffer))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1407 (goto-char p)))))
48641
da382393fb77 Get rid of (quote ..); use match-string and ignore.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48640
diff changeset
1408 (run-hooks 'gdb-info-locals-hook))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1409
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1410 (defun gdb-info-locals-custom ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1411 nil)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1412
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
1413 (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
1414 (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
1415 (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
1416 map))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1417
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1418 (defun gdb-locals-mode ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1419 "Major mode for gdb locals.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1420
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1421 \\{gdb-locals-mode-map}"
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1422 (setq major-mode 'gdb-locals-mode)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1423 (setq mode-name "Locals")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1424 (setq buffer-read-only t)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1425 (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
1426 (gdb-invalidate-locals))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1427
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
1428 (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
1429 (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
1430 (concat "*locals of " (gdb-get-target-string) "*")))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1431
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
1432 (defun gdb-display-locals-buffer ()
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
1433 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1434 (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
1435 (gdb-get-create-buffer 'gdb-locals-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1436
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
1437 (defun gdb-frame-locals-buffer ()
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
1438 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1439 (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
1440 (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
1441
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1442
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1443 ;;;; Window management
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1444
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1445 ;;; 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
1446 ;;; 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
1447 ;;; 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
1448 ;;; more elegant solution without writing C code.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1449
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1450 (defun gdb-display-buffer (buf &optional size)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1451 (let ((must-split nil)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1452 (answer nil))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1453 (unwind-protect
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1454 (progn
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1455 (walk-windows
52328
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1456 #'(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
1457 (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
1458 (eq gdb-source-window win))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1459 (set-window-dedicated-p win t))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1460 (setq answer (get-buffer-window buf))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1461 (if (not answer)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1462 (let ((window (get-lru-window)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1463 (if window
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1464 (progn
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1465 (set-window-buffer window buf)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1466 (setq answer window))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1467 (setq must-split t)))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1468 (walk-windows
52328
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1469 #'(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
1470 (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
1471 (eq gdb-source-window win))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1472 (set-window-dedicated-p win nil)))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1473 (if must-split
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1474 (let* ((largest (get-largest-window))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1475 (cur-size (window-height largest))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1476 (new-size (and size (< size cur-size) (- cur-size size))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1477 (setq answer (split-window largest new-size))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1478 (set-window-buffer answer buf)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1479 answer))
48300
69646014abb3 Fix feature name in `require'.
Juanma Barranquero <lekktu@gmail.com>
parents: 48292
diff changeset
1480
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1481 (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
1482 (if (eq gdb-selected-view 'source)
52328
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1483 (progn
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1484 (if (window-live-p gdb-source-window)
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1485 (set-window-buffer gdb-source-window buffer)
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1486 (gdb-display-buffer buffer)
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1487 (setq gdb-source-window (get-buffer-window buffer)))
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1488 gdb-source-window)
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1489 (if (window-live-p gdb-source-window)
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1490 (set-window-buffer gdb-source-window
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1491 (gdb-get-buffer 'gdb-assembler-buffer))
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1492 (let ((buf (gdb-get-buffer 'gdb-assembler-buffer)))
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1493 (gdb-display-buffer buf)
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1494 (setq gdb-source-window (get-buffer-window buf))))
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1495 nil))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1496
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1497
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1498 ;;; Shared keymap initialization:
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1499
51693
04628db4db1a (gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents: 51617
diff changeset
1500 (let ((menu (make-sparse-keymap "GDB-Frames")))
51123
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1501 (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
1502 `(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
1503 (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
1504 (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
1505 (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
1506 (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
1507 (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
1508 (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
1509 ; (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
1510 )
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1511
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
1512 (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
1513 (define-key gud-menu-map [displays]
48738
81dc78298a54 Remove inappropriate key-bindings.
Nick Roberts <nickrob@snap.net.nz>
parents: 48685
diff changeset
1514 `(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
1515 (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
1516 (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
1517 (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
1518 (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
1519 (define-key menu [breakpoints] '("Breakpoints" . gdb-display-breakpoints-buffer))
50962
8a38e6c7aa44 (gdb-invalidate-assembler): Update assembler buffer
Nick Roberts <nickrob@snap.net.nz>
parents: 50796
diff changeset
1520 (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
1521 ; (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
1522 )
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1523
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1524 (let ((menu (make-sparse-keymap "View")))
52066
9a40de6a1802 (gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents: 51787
diff changeset
1525 (define-key gud-menu-map [view]
9a40de6a1802 (gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents: 51787
diff changeset
1526 `(menu-item "View" ,menu :visible (eq gud-minor-mode 'gdba)))
51123
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1527 ; (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
1528 ; :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
1529 ; :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
1530 (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
1531 :help "Display assembler only"
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1532 :button (:radio . (eq gdb-selected-view 'assembler))))
51693
04628db4db1a (gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents: 51617
diff changeset
1533 (define-key menu [source] '(menu-item "Source" gdb-view-source-function
51123
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1534 :help "Display source only"
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1535 :button (:radio . (eq gdb-selected-view 'source)))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1536
52066
9a40de6a1802 (gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents: 51787
diff changeset
1537 (let ((menu (make-sparse-keymap "GDB-UI")))
9a40de6a1802 (gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents: 51787
diff changeset
1538 (define-key gud-menu-map [ui]
9a40de6a1802 (gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents: 51787
diff changeset
1539 `(menu-item "GDB-UI" ,menu :visible (eq gud-minor-mode 'gdba)))
9a40de6a1802 (gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents: 51787
diff changeset
1540 (define-key menu [gdb-restore-windows]
9a40de6a1802 (gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents: 51787
diff changeset
1541 '("Restore window layout" . gdb-restore-windows))
9a40de6a1802 (gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents: 51787
diff changeset
1542 (define-key menu [gdb-many-windows]
9a40de6a1802 (gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents: 51787
diff changeset
1543 (menu-bar-make-toggle gdb-many-windows gdb-many-windows
9a40de6a1802 (gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents: 51787
diff changeset
1544 "Display other windows" "Many Windows %s"
9a40de6a1802 (gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents: 51787
diff changeset
1545 "Display locals, stack and breakpoint information")))
9a40de6a1802 (gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents: 51787
diff changeset
1546
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
1547 (defun gdb-frame-gdb-buffer ()
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
1548 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1549 (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
1550 (gdb-get-create-buffer 'gdba)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1551
51123
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1552 (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
1553 (interactive)
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1554 (gdb-display-buffer
605e818cbe30 (gud-gdba-command-name): Use -noasync option for Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51116
diff changeset
1555 (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
1556
51617
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
1557 (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
1558
51693
04628db4db1a (gdb-display-number-end): Don't re-initialise local
Nick Roberts <nickrob@snap.net.nz>
parents: 51617
diff changeset
1559 (defun gdb-view-source-function ()
51617
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
1560 (interactive)
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
1561 (if gdb-view-source
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
1562 (if gud-last-last-frame
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
1563 (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
1564 (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
1565 (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
1566 (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
1567
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
1568 (defun gdb-view-assembler()
51617
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
1569 (interactive)
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
1570 (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
1571 (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
1572 (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
1573
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
1574 ;(defun gdb-view-both()
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
1575 ;(interactive)
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
1576 ;(setq gdb-selected-view 'both))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1577
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1578 ;; 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
1579 (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
1580 (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
1581 (gdb-display-stack-buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1582 (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
1583 (gdb-display-breakpoints-buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1584 (delete-other-windows)
51787
10f90558dc89 (gdb-source-info): Display current frame when
Nick Roberts <nickrob@snap.net.nz>
parents: 51693
diff changeset
1585 (switch-to-buffer gud-comint-buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1586 (split-window nil ( / ( * (window-height) 3) 4))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1587 (split-window nil ( / (window-height) 3))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1588 (split-window-horizontally)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1589 (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
1590 (switch-to-buffer (gdb-locals-buffer-name))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1591 (other-window 1)
52066
9a40de6a1802 (gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents: 51787
diff changeset
1592 (if (and gdb-view-source
9a40de6a1802 (gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents: 51787
diff changeset
1593 (eq gdb-selected-view 'source))
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
1594 (switch-to-buffer
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
1595 (if gud-last-last-frame
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
1596 (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
1597 (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
1598 (switch-to-buffer (gdb-get-create-buffer 'gdb-assembler-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1599 (setq gdb-source-window (get-buffer-window (current-buffer)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1600 (split-window-horizontally)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1601 (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
1602 (switch-to-buffer (gdb-inferior-io-name))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1603 (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
1604 (switch-to-buffer (gdb-stack-buffer-name))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1605 (split-window-horizontally)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1606 (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
1607 (switch-to-buffer (gdb-breakpoints-buffer-name))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1608 (other-window 1))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1609
51227
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1610 (defcustom gdb-many-windows nil
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1611 "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
1612 the source buffer."
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1613 :type 'boolean
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1614 :group 'gud)
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1615
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1616 (defun gdb-many-windows (arg)
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1617 "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
1618 (interactive "P")
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1619 (setq gdb-many-windows
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1620 (if (null arg)
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1621 (not gdb-many-windows)
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1622 (> (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
1623 (gdb-restore-windows))
88be03de9df4 (gdb-many-windows): Define as a minor mode.
Nick Roberts <nickrob@snap.net.nz>
parents: 48570
diff changeset
1624
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1625 (defun gdb-restore-windows ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1626 "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
1627 This arrangement depends on the value of `gdb-many-windows'."
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1628 (interactive)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1629 (if gdb-many-windows
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1630 (progn
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1631 (switch-to-buffer gud-comint-buffer)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1632 (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
1633 (gdb-setup-windows))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1634 (switch-to-buffer gud-comint-buffer)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1635 (delete-other-windows)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1636 (split-window)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1637 (other-window 1)
52066
9a40de6a1802 (gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents: 51787
diff changeset
1638 (if (and gdb-view-source
9a40de6a1802 (gdb-setup-windows, gdb-restore-windows): Restore
Nick Roberts <nickrob@snap.net.nz>
parents: 51787
diff changeset
1639 (eq gdb-selected-view 'source))
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
1640 (switch-to-buffer
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
1641 (if gud-last-last-frame
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
1642 (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
1643 (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
1644 (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
1645 (setq gdb-source-window (get-buffer-window (current-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1646 (other-window 1)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1647
49147
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
1648 (defun gdb-reset ()
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
1649 "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
1650 the source buffers."
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1651 (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
1652 (if (not (eq buffer gud-comint-buffer))
49249
7c4bc41333d1 Improve commentary.
Nick Roberts <nickrob@snap.net.nz>
parents: 49147
diff changeset
1653 (with-current-buffer buffer
52698
367c1b29dbee (gdb-var-list, gdb-var-changed, gdb-update-flag)
Nick Roberts <nickrob@snap.net.nz>
parents: 52443
diff changeset
1654 (if (memq gud-minor-mode '(gdba pdb))
49147
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
1655 (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
1656 (kill-buffer nil)
52177
57a5b7571acc (gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents: 52066
diff changeset
1657 (if (display-images-p)
49147
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
1658 (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
1659 (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
1660 (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
1661 (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
1662 (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
1663 (setq gud-running nil)
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
1664 (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
1665 (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
1666 (current-buffer))
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
1667 left-margin-width
8a40184e2f0e (gud-display): Use GDB command ptype instead of whatis
Nick Roberts <nickrob@snap.net.nz>
parents: 49039
diff changeset
1668 right-margin-width))))))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1669
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1670 (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
1671 "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
1672 buffers."
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1673 (goto-char (point-min))
51617
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
1674 (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
1675 (progn
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
1676 (if (looking-at "\\S-*:\\(\\S-*\\)")
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
1677 (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
1678 (looking-at "\\S-*")
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
1679 (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
1680 (search-forward "Located in ")
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
1681 (looking-at "\\S-*")
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
1682 (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
1683 (setq gdb-view-source nil))
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
1684 (delete-other-windows)
51787
10f90558dc89 (gdb-source-info): Display current frame when
Nick Roberts <nickrob@snap.net.nz>
parents: 51693
diff changeset
1685 (switch-to-buffer gud-comint-buffer)
51617
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
1686 (if gdb-many-windows
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
1687 (gdb-setup-windows)
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
1688 (gdb-display-breakpoints-buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1689 (delete-other-windows)
51617
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
1690 (split-window)
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
1691 (other-window 1)
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
1692 (if gdb-view-source
51787
10f90558dc89 (gdb-source-info): Display current frame when
Nick Roberts <nickrob@snap.net.nz>
parents: 51693
diff changeset
1693 (switch-to-buffer
10f90558dc89 (gdb-source-info): Display current frame when
Nick Roberts <nickrob@snap.net.nz>
parents: 51693
diff changeset
1694 (if gud-last-last-frame
10f90558dc89 (gdb-source-info): Display current frame when
Nick Roberts <nickrob@snap.net.nz>
parents: 51693
diff changeset
1695 (gud-find-file (car gud-last-last-frame))
10f90558dc89 (gdb-source-info): Display current frame when
Nick Roberts <nickrob@snap.net.nz>
parents: 51693
diff changeset
1696 (gud-find-file gdb-main-file)))
52328
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1697 (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
1698 (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
1699 (other-window 1)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1700
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
1701 ;;from put-image
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1702 (defun gdb-put-string (putstring pos)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1703 "Put string PUTSTRING in front of POS in the current buffer.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1704 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
1705 `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
1706 PUTSTRING."
52328
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1707 (let ((gdb-string "x")
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1708 (buffer (current-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1709 (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
1710 (prop (list (list 'margin 'left-margin) putstring)))
52328
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1711 (put-text-property 0 (length gdb-string) 'display prop gdb-string)
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1712 (overlay-put overlay 'put-break t)
52328
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1713 (overlay-put overlay 'before-string gdb-string))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1714
48662
d29870d63092 Fix up comment markers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48661
diff changeset
1715 ;;from remove-images
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1716 (defun gdb-remove-strings (start end &optional buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1717 "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
1718 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
1719 BUFFER nil or omitted means use the current buffer."
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1720 (unless buffer
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1721 (setq buffer (current-buffer)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1722 (let ((overlays (overlays-in start end)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1723 (while overlays
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1724 (let ((overlay (car overlays)))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1725 (when (overlay-get overlay 'put-break)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1726 (delete-overlay overlay)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1727 (setq overlays (cdr overlays)))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1728
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1729 (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
1730 "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
1731 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
1732 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
1733 \"gdb-arrow\" that has a `display' property whose value is
52328
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1734 PUTSTRING. POS may be an integer or marker."
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1735 (let ((gdb-string "gdb-arrow")
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1736 (buffer (current-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1737 (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
1738 (prop (list (list 'margin 'left-margin) putstring)))
52328
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1739 (put-text-property 0 (length gdb-string) 'display prop gdb-string)
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1740 (overlay-put overlay 'put-arrow t)
52328
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1741 (overlay-put overlay 'before-string gdb-string))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1742
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1743 (defun gdb-remove-arrow (&optional buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1744 "Remove arrow in BUFFER.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1745 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
1746 BUFFER nil or omitted means use the current buffer."
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1747 (unless buffer
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1748 (setq buffer (current-buffer)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1749 (let ((overlays (overlays-in (point-min) (point-max))))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1750 (while overlays
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1751 (let ((overlay (car overlays)))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1752 (when (overlay-get overlay 'put-arrow)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1753 (delete-overlay overlay)))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1754 (setq overlays (cdr overlays)))))
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1755
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1756 ;;
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1757 ;; Assembler buffer.
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1758 ;;
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1759 (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
1760 'gdb-assembler-buffer-name
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1761 'gdb-assembler-mode)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1762
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1763 (def-gdb-auto-updated-buffer gdb-assembler-buffer
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1764 gdb-invalidate-assembler
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1765 (concat "server disassemble " gdb-current-address "\n")
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1766 gdb-assembler-handler
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1767 gdb-assembler-custom)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1768
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1769 (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
1770 (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
1771 (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
1772 (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
1773 (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
1774 (progn
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1775 (gdb-remove-arrow)
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
1776 (goto-char (point-min))
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
1777 (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
1778 (progn
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
1779 (setq gdb-arrow-position (point))
cef03ad7bf21 (gud-display1): Keep the gdb command, "display", in
Nick Roberts <nickrob@snap.net.nz>
parents: 51529
diff changeset
1780 (gdb-put-arrow "=>" (point))))))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1781 ;; remove all breakpoint-icons in assembler buffer before updating.
52177
57a5b7571acc (gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents: 52066
diff changeset
1782 (if (display-images-p)
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
1783 (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
1784 (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
1785 (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1786 (goto-char (point-min))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1787 (while (< (point) (- (point-max) 1))
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1788 (forward-line 1)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1789 (if (looking-at "[^\t].*breakpoint")
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1790 (progn
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1791 (looking-at
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1792 "[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
1793 (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
1794 (setq address (match-string 2))
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
1795 ;; 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
1796 (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
1797 (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
1798 (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
1799 (goto-char (point-min))
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1800 (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
1801 (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
1802 (end (progn (end-of-line) (+ (point) 1))))
52177
57a5b7571acc (gdb-insert-field, gdb-array-format1)
Nick Roberts <nickrob@snap.net.nz>
parents: 52066
diff changeset
1803 (if (display-images-p)
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1804 (progn
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1805 (remove-images start end)
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1806 (if (eq ?y flag)
51227
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1807 (put-image breakpoint-enabled-icon
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1808 (+ start 1)
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1809 "breakpoint icon enabled"
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1810 'left-margin)
51227
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1811 (put-image breakpoint-disabled-icon
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1812 (+ start 1)
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1813 "breakpoint icon disabled"
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1814 'left-margin)))
51086
3b5b1167fdf4 (put-arrow): Rename gdb-put-arrow and simplify.
Nick Roberts <nickrob@snap.net.nz>
parents: 51028
diff changeset
1815 (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
1816 (if (eq ?y flag)
51227
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1817 (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
1818 (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
1819 (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
1820 (set-window-point (get-buffer-window buffer) gdb-arrow-position))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1821
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
1822 (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
1823 (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
1824 (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
1825 map))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1826
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1827 (defun gdb-assembler-mode ()
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1828 "Major mode for viewing code assembler.
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1829
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1830 \\{gdb-assembler-mode-map}"
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1831 (setq major-mode 'gdb-assembler-mode)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1832 (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
1833 (setq left-margin-width 2)
51227
a1e2454a02ec (gdb-info-breakpoints-custom, gdb-assembler-custom):
Nick Roberts <nickrob@snap.net.nz>
parents: 51172
diff changeset
1834 (setq fringes-outside-margins t)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1835 (setq buffer-read-only t)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1836 (use-local-map gdb-assembler-mode-map)
52328
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1837 (gdb-invalidate-assembler))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1838
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
1839 (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
1840 (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
1841 (concat "*Machine Code " (gdb-get-target-string) "*")))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1842
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
1843 (defun gdb-display-assembler-buffer ()
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
1844 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1845 (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
1846 (gdb-get-create-buffer 'gdb-assembler-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1847
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
1848 (defun gdb-frame-assembler-buffer ()
48659
4d69c0f01cc0 (gdb-inferior-io-mode-map): Remove (unused).
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 48641
diff changeset
1849 (interactive)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1850 (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
1851 (gdb-get-create-buffer 'gdb-assembler-buffer)))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1852
51028
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1853 ;; 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
1854 ;; 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
1855 (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
1856 (if (gdb-get-buffer 'gdb-assembler-buffer)
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1857 (progn
52328
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1858 (unless (string-equal gdb-current-frame gdb-previous-frame)
51529
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
1859 (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
1860 (gdb-get-pending-triggers)))
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
1861 (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
1862 gdb-previous-address)))
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
1863 (progn
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
1864 ;; 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
1865 (with-current-buffer gud-comint-buffer
52443
31a30e670e11 (gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents: 52401
diff changeset
1866 (let ((queue (gdb-get-input-queue)) (item))
51529
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
1867 (dolist (item queue)
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
1868 (if (equal (cdr item) '(gdb-assembler-handler))
52443
31a30e670e11 (gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents: 52401
diff changeset
1869 (gdb-set-input-queue
31a30e670e11 (gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents: 52401
diff changeset
1870 (delete item (gdb-get-input-queue)))))))
31a30e670e11 (gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents: 52401
diff changeset
1871 (gdb-enqueue-input
51529
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
1872 (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
1873 'gdb-assembler-handler))
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
1874 (gdb-set-pending-triggers
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
1875 (cons 'gdb-invalidate-assembler
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
1876 (gdb-get-pending-triggers)))
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
1877 (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
1878 (setq gdb-previous-frame gdb-current-frame)))))))
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1879
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1880 (defun gdb-get-current-frame ()
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1881 (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
1882 (progn
52443
31a30e670e11 (gud-display1): Use gud-call to prevent extra prompt
Nick Roberts <nickrob@snap.net.nz>
parents: 52401
diff changeset
1883 (gdb-enqueue-input
51529
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
1884 (list (concat "server info frame\n") 'gdb-frame-handler))
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49249
diff changeset
1885 (gdb-set-pending-triggers
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1886 (cons 'gdb-get-current-frame
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1887 (gdb-get-pending-triggers))))))
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1888
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1889 (defun gdb-frame-handler ()
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 49249
diff changeset
1890 (gdb-set-pending-triggers
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1891 (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
1892 (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
1893 (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
1894 (forward-line)
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
1895 (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
1896 (progn
323ddc93f3fe (gdb-info-frames-custom): Reverse contrast of face for
Nick Roberts <nickrob@snap.net.nz>
parents: 50962
diff changeset
1897 (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
1898 (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
1899 ;; 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
1900 (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
1901 (setq gdb-current-address
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
1902 (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
1903 (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
1904 (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
1905 (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
1906 (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
1907 (progn
51116
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
1908 (set-window-buffer
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
1909 gdb-source-window
cac5cb5d83ec (gdb-view-source, gdb-selected-view): New variables.
Nick Roberts <nickrob@snap.net.nz>
parents: 51086
diff changeset
1910 (gdb-get-create-buffer 'gdb-assembler-buffer))
52328
06d74a21fa32 (gdba): Remove gdb-quit (previously removed) from
Nick Roberts <nickrob@snap.net.nz>
parents: 52177
diff changeset
1911 ;;update with new frame for machine code if necessary
51529
39126c23006f (gdb-get-current-frame, gdb-frame-handler): Use Gdb
Nick Roberts <nickrob@snap.net.nz>
parents: 51227
diff changeset
1912 (gdb-invalidate-assembler)))))))
48955
1abfa35a3a5a (gdb-display-number-end): Make auto-display of
Nick Roberts <nickrob@snap.net.nz>
parents: 48921
diff changeset
1913
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1914 (provide 'gdb-ui)
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1915
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 52328
diff changeset
1916 ;;; arch-tag: e9fb00c5-74ef-469f-a088-37384caae352
48292
27d9e4538750 New file.
Nick Roberts <nickrob@snap.net.nz>
parents:
diff changeset
1917 ;;; gdb-ui.el ends here