annotate lisp/gdb-ui.el @ 54459:bdc0ecff8aec

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