annotate lisp/gdb-ui.el @ 49000:f3c5848184cb

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