annotate lisp/comint/gdb-highlight.el @ 155:43dd3413c7c7 r20-3b4

Import from CVS: tag r20-3b4
author cvs
date Mon, 13 Aug 2007 09:39:39 +0200
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
155
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1 ;;; gdb-highlight.el --- make gdb buffers be mouse-sensitive.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
3 ;;; Copyright (C) 1997 Jamie Zawinski <jwz@netscape.com>
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
5 ;; Author: Jamie Zawinski <jwz@netscape.com>
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
6 ;; Created: 16-Apr-1997
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
7 ;; Version: 1.2 (17-May-97)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
8 ;; Keywords: extensions, c, unix, tools, debugging
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
9
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
10 ;; This file is part of XEmacs.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
11
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
12 ;; XEmacs is free software; you can redistribute it and/or modify it
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
13 ;; under the terms of the GNU General Public License as published by
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
15 ;; any later version.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
16
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
17 ;; XEmacs is distributed in the hope that it will be useful, but
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
20 ;; General Public License for more details.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
21
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
23 ;; along with XEmacs; see the file COPYING. If not, write to the Free
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
24 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
25 ;; 02111-1307, USA.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
26
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
27 ;;; Synched up with: Not synched.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
28
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
29 ;;; Commentary:
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
30 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
31 ;; This package makes most objects printed in a *gdb* buffer be
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
32 ;; mouse-sensitive: as text shows up in the buffer, it is parsed,
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
33 ;; and objects which are recognized have context-sensitive commands
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
34 ;; attached to them. Generally, the types that are noticed are:
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
35 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
36 ;; = function and method names;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
37 ;; = variable and parameter names;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
38 ;; = structure and object slots;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
39 ;; = source file names;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
40 ;; = type names;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
41 ;; = breakpoint numbers;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
42 ;; = stack frame numbers.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
43 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
44 ;; Any time one of those objects is presented in the *gdb* buffer,
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
45 ;; it will be mousable. Clicking middle mouse button (button2) on
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
46 ;; it will take some default action -- edit the function, select
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
47 ;; the stack frame, disable the breakpoint, etc. Clicking the right
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
48 ;; mouse button (button3) will bring up a menu of commands, including
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
49 ;; commands specific to the object under the mouse, or other objects
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
50 ;; on the same line.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
51 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
52 ;; In addition to these context-sensitive commands are more general
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
53 ;; gdb commands which were previously inaccessible via the mouse
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
54 ;; (listing breakpoints, returning values, etc); and the general
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
55 ;; comint/shell-buffer commands which had been present before.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
56 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
57 ;; If you notice an object being presented which could (usefully)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
58 ;; be made mouse sensitive, but which currently is not, please let
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
59 ;; me know.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
60
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
61 ;;; Installation:
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
62 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
63 ;; To install, add this to your .emacs file:
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
64 ;; (add-hook 'gdb-mode-hook '(lambda () (require 'gdb-highlight)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
65
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
66 ;;; TODO:
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
67 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
68 ;; = It doesn't really work very well unless you've done `set width 0'
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
69 ;; in your .gdbinit. It would be nice if this were fixed.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
70 ;; (And with `set width 0', `set print pretty on' is the way to go.)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
71 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
72 ;; = In some contexts, the toggle-breakpoint command doesn't work,
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
73 ;; because this code doesn't know whether it's enabled. It should
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
74 ;; remember, or figure it out, or something.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
75 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
76 ;; = Make it possible to edit the `keep' state of breakpoints.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
77 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
78 ;; = Is it useful to make addresses clickable? If an address is
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
79 ;; always acompanied by a variable, then no.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
80 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
81 ;; = There has got to be a better way to implement `gdb-guess-file-name'.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
82 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
83 ;; = Make some new toolbar icons and put the most common commands on it.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
84 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
85 ;; = Maybe make gdb-toolbar-clear work more reliably by consulting a
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
86 ;; breakpoint-number extent?
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
87 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
88 ;; = I want breakpoint icons in my source files, just like in Energize.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
89 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
90 ;; = Add a command to quit-and-restart the debugger, with the same
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
91 ;; breakpoints and program-arguments. (This wouldn't be interesting
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
92 ;; if gdb didn't leak like a sieve...)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
93 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
94 ;; = Figure out some way to realize when extents are no longer interesting
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
95 ;; (stack frames and local variables that are no longer on the stack)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
96 ;; and make them no longer be mousable. This is tricky... Nuke them
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
97 ;; whenever a "run" command is seen?
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
98 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
99 ;; = Make C-x SPC in a source buffer use gdb-menu-command so that it will
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
100 ;; interrupt-and-continue the debugged program as necessary.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
101 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
102 ;; = Do stuff for watchpoints (but I never use them, myself.)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
103
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
104 ;;; WISHLIST:
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
105 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
106 ;; (extracted from my 13-May-1997 message to comp.emacs and
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
107 ;; comp.emacs.xemacs, news:33785828.5A524730@netscape.com)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
108 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
109 ;; 6.1. Make gdbsrc-mode not suck.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
110 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
111 ;; The idea behind gdbsrc-mode is on the side of the angels: one
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
112 ;; should be able to focus on the source code and not on the
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
113 ;; debugger buffer, absolutely. But the implementation is just
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
114 ;; awful.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
115 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
116 ;; First and foremost, it should not change "modes" (in the more
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
117 ;; general sense). Any commands that it defines should be on
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
118 ;; keys which are exclusively used for that purpose, not keys
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
119 ;; which are normally self-inserting. I can't be the only person
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
120 ;; who usually has occasion to actually *edit* the sources which
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
121 ;; the debugger has chosen to display! Switching into and out of
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
122 ;; gdbsrc-mode is prohibitive.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
123 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
124 ;; I want to be looking at my sources at all times, yet I don't
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
125 ;; want to have to give up my source-editing gestures. I think
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
126 ;; the right way to accomplish this is to put the gdbsrc commands
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
127 ;; on the toolbar and on popup menus; or to let the user define
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
128 ;; their own keys (I could see devoting my kp_enter key to
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
129 ;; "step", or something common like that.)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
130 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
131 ;; Also it's extremely frustrating that one can't turn off gdbsrc
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
132 ;; mode once it has been loaded, without exiting and restarting
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
133 ;; emacs; that alone means that I'd probably never take the time
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
134 ;; to learn how to use it, without first having taken the time to
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
135 ;; repair it...
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
136 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
137 ;; 6.2. Make it easier access to variable values.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
138 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
139 ;; I want to be able to double-click on a variable name to
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
140 ;; highlight it, and then drag it to the debugger window to have
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
141 ;; its value printed.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
142 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
143 ;; I want gestures that let me write as well as read: for
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
144 ;; example, to store value A into slot B.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
145 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
146 ;; 6.3. Make all breakpoints visible.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
147 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
148 ;; Any time there is a running gdb which has breakpoints, the
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
149 ;; buffers holding the lines on which those breakpoints are set
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
150 ;; should have icons in them. These icons should be context-
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
151 ;; sensitive: I should be able to pop up a menu to enable or
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
152 ;; disable them, to delete them, to change their commands or
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
153 ;; conditions.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
154 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
155 ;; I should also be able to MOVE them. It's annoying when you
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
156 ;; have a breakpoint with a complex condition or command on it,
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
157 ;; and then you realize that you really want it to be at a
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
158 ;; different location. I want to be able to drag-and-drop the
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
159 ;; icon to its new home.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
160 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
161 ;; 6.4. Make a debugger status display window.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
162 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
163 ;; o I want a window off to the side that shows persistent
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
164 ;; information -- it should have a pane which is a
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
165 ;; drag-editable, drag-reorderable representation of the
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
166 ;; elements on gdb's "display" list; they should be displayed
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
167 ;; here instead of being just dumped in with the rest of the
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
168 ;; output in the *gdb* buffer.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
169 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
170 ;; o I want a pane that displays the current call-stack and
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
171 ;; nothing else. I want a pane that displays the arguments
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
172 ;; and locals of the currently-selected frame and nothing
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
173 ;; else. I want these both to update as I move around on the
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
174 ;; stack.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
175 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
176 ;; Since the unfortunate reality is that excavating this
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
177 ;; information from gdb can be slow, it would be a good idea
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
178 ;; for these panes to have a toggle button on them which meant
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
179 ;; "stop updating", so that when I want to move fast, I can,
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
180 ;; but I can easily get the display back when I need it again.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
181 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
182 ;; The reason for all of this is that I spend entirely too much
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
183 ;; time scrolling around in the *gdb* buffer; with gdb-highlight,
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
184 ;; I can just click on a line in the backtrace output to go to
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
185 ;; that frame, but I find that I spend a lot of time *looking*
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
186 ;; for that backtrace: since it's mixed in with all the other
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
187 ;; random output, I waste time looking around for things (and
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
188 ;; usually just give up and type "bt" again, then thrash around
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
189 ;; as the buffer scrolls, and I try to find the lower frames that
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
190 ;; I'm interested in, as they have invariably scrolled off the
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
191 ;; window already...
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
192 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
193 ;; 6.5. Save and restore breakpoints across emacs/debugger sessions.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
194 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
195 ;; This would be especially handy given that gdb leaks like a
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
196 ;; sieve, and with a big program, I only get a few dozen
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
197 ;; relink-and-rerun attempts before gdb has blown my swap space.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
198 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
199 ;; 6.6. Keep breakpoints in sync with source lines.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
200 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
201 ;; When a program is recompiled and then reloaded into gdb, the
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
202 ;; breakpoints often end up in less-than-useful places. For
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
203 ;; example, when I edit text which occurs in a file anywhere
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
204 ;; before a breakpoint, emacs is aware that the line of the bp
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
205 ;; hasn't changed, but just that it is in a different place
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
206 ;; relative to the top of the file. Gdb doesn't know this, so
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
207 ;; your breakpoints end up getting set in the wrong places
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
208 ;; (usually the maximally inconvenient places, like *after* a
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
209 ;; loop instead of *inside* it). But emacs knows, so emacs
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
210 ;; should inform the debugger, and move the breakpoints back to
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
211 ;; the places they were intended to be.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
212 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
213 ;; (Possibly the OOBR stuff does some of this, but can't tell,
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
214 ;; because I've never been able to get it to do anything but beep at
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
215 ;; me and mumble about environments. I find it pretty funny that the
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
216 ;; manual keeps explaining to me how intuitive it is, without
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
217 ;; actually giving me a clue how to launch it...)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
218
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
219
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
220 ;;; Code:
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
221 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
222 ;; This code should be considered an example of how over-use of regular
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
223 ;; expressions leads to code that is an unreadable, unmaintainable mess,
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
224 ;; and why it's unfortunate that so much of emacs's speed depends on
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
225 ;; their use, rather than on the use of more traditional parsers.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
226
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
227 (require 'gdb)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
228
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
229 (define-key gdb-mode-map 'button3 'gdb-popup-menu)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
230 (defvar gdb-popup-menu
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
231 '("GDB Commands"
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
232 ["Up Stack" (gdb-menu-command "up" t) t]
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
233 ["Down Stack" (gdb-menu-command "down" t) t]
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
234 ["Next Line" (gdb-menu-command "next" t) t]
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
235 ["Next Line (Step In)" (gdb-menu-command "step" t) t]
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
236 ["Continue" (gdb-menu-command "continue" t) t]
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
237 ["Continue Until Return" (gdb-menu-command "finish" t) t]
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
238 ("Return..."
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
239 ["Return" (gdb-menu-command "return" t) t]
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
240 ["Return 0" (gdb-menu-command "return 0" t) t]
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
241 ["Return 1" (gdb-menu-command "return 1" t) t]
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
242 ["Return -1" (gdb-menu-command "return -1" t) t]
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
243 ["Return $" (gdb-menu-command "return $" t) t]
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
244 )
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
245 "---"
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
246 ["Backtrace" (gdb-menu-command "backtrace" t) t]
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
247 ["List Breakpoints" (gdb-menu-command "info breakpoints" t) t]
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
248 ["List Local Variables" (gdb-menu-command "info locals" t) t]
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
249 )
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
250 "Commands for the popup menu in gdb-mode.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
251 The comint-popup-menu is appended to this, and certain context-sensitive
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
252 commands may be prepended to it, depending on the location of the mouse
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
253 when the `gdb-popup-menu' command is invoked.")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
254
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
255
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
256 ;;; Faces and keymaps used for mousable tokens in the *gdb* buffer.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
257
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
258 (defvar gdb-highlight-face 'gdb-highlight-face) ; the base face
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
259 (defvar gdb-breakpoint-number-face 'gdb-breakpoint-number-face)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
260 ;(defvar gdb-breakpoint-keep-face 'gdb-breakpoint-keep-face)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
261 (defvar gdb-breakpoint-enabled-face 'gdb-breakpoint-enabled-face)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
262 (defvar gdb-function-name-face 'gdb-function-name-face)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
263 (defvar gdb-function-location-face 'gdb-function-location-face)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
264 (defvar gdb-variable-name-face 'gdb-variable-name-face)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
265 (defvar gdb-type-name-face 'gdb-type-name-face)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
266
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
267 (make-face 'gdb-highlight-face)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
268 (or (face-differs-from-default-p 'gdb-highlight-face)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
269 (make-face-italic 'gdb-highlight-face))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
270
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
271 (let ((faces '(gdb-breakpoint-number-face
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
272 gdb-breakpoint-enabled-face
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
273 ;gdb-breakpoint-keep-face
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
274 gdb-function-name-face
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
275 gdb-function-location-face
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
276 gdb-variable-name-face
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
277 gdb-type-name-face)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
278 (while faces
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
279 (make-face (car faces))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
280 (or (face-differs-from-default-p (car faces))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
281 (if (fboundp 'set-face-parent)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
282 (set-face-parent (car faces) 'gdb-highlight-face)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
283 (copy-face 'gdb-highlight-face (car faces))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
284 (setq faces (cdr faces))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
285
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
286
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
287 (defvar gdb-token-map ; the base map, inherited by all.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
288 (let ((m (make-sparse-keymap)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
289 (set-keymap-name m 'gdb-token-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
290 (define-key m 'button2 'undefined)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
291 ;;(define-key m 'button3 'gdb-token-popup)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
292 m))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
293
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
294 (defvar gdb-breakpoint-number-map
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
295 (let ((m (make-sparse-keymap)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
296 (set-keymap-name m 'gdb-breakpoint-number-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
297 (set-keymap-parent m gdb-token-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
298 ;; not sure if this is the most useful binding... maybe "delete" is better?
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
299 (define-key m 'button2 'gdb-mouse-disable-breakpoint)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
300 m))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
301
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
302 (defvar gdb-info-breakpoint-number-map
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
303 (let ((m (make-sparse-keymap)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
304 (set-keymap-name m 'gdb-breakpoint-number-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
305 (set-keymap-parent m gdb-token-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
306 ;; not sure if this is the most useful binding... maybe "delete" is better?
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
307 (define-key m 'button2 'gdb-mouse-toggle-breakpoint-enabled)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
308 m))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
309
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
310 ;(defvar gdb-breakpoint-keep-map
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
311 ; (let ((m (make-sparse-keymap)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
312 ; (set-keymap-name m 'gdb-breakpoint-keep-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
313 ; (set-keymap-parent m gdb-token-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
314 ; (define-key m 'button2 'gdb-token-mouse-toggle-keep)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
315 ; m))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
316
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
317 (defvar gdb-breakpoint-enabled-map
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
318 (let ((m (make-sparse-keymap)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
319 (set-keymap-name m 'gdb-breakpoint-enabled-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
320 (set-keymap-parent m gdb-token-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
321 (define-key m 'button2 'gdb-mouse-toggle-breakpoint-enabled)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
322 m))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
323
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
324 (defvar gdb-function-name-map
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
325 (let ((m (make-sparse-keymap)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
326 (set-keymap-name m 'gdb-function-name-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
327 (set-keymap-parent m gdb-token-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
328 (define-key m 'button2 'gdb-mouse-edit-function)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
329 m))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
330
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
331 (defvar gdb-function-location-map
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
332 (let ((m (make-sparse-keymap)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
333 (set-keymap-name m 'gdb-function-location-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
334 (set-keymap-parent m gdb-token-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
335 (define-key m 'button2 'gdb-mouse-edit-function-location)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
336 m))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
337
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
338 (defvar gdb-frame-number-map
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
339 (let ((m (make-sparse-keymap)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
340 (set-keymap-name m 'gdb-frame-number-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
341 (set-keymap-parent m gdb-token-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
342 (define-key m 'button2 'gdb-mouse-goto-frame)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
343 m))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
344
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
345 (defvar gdb-variable-name-map
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
346 (let ((m (make-sparse-keymap)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
347 (set-keymap-name m 'gdb-variable-name-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
348 (set-keymap-parent m gdb-token-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
349 (define-key m 'button2 'gdb-mouse-print-variable)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
350 m))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
351
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
352 (defvar gdb-type-name-map
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
353 (let ((m (make-sparse-keymap)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
354 (set-keymap-name m 'gdb-type-name-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
355 (set-keymap-parent m gdb-token-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
356 (define-key m 'button2 'gdb-mouse-print-type)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
357 m))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
358
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
359
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
360 ;;; Token definitions.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
361
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
362 ;; These properties enumerate the faces and keymaps that will be put over
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
363 ;; the tokens.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
364
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
365 (put 'gdb-frame-number-token 'gdb-token-face gdb-breakpoint-number-face)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
366 (put 'gdb-frame-number-token 'gdb-token-keymap gdb-frame-number-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
367
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
368 ;(put 'gdb-breakpoint-keep-token 'gdb-token-face gdb-breakpoint-keep-face)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
369 ;(put 'gdb-breakpoint-keep-token 'gdb-token-keymap gdb-breakpoint-keep-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
370
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
371 (put 'gdb-enabled-token 'gdb-token-face gdb-breakpoint-enabled-face)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
372 (put 'gdb-enabled-token 'gdb-token-keymap gdb-breakpoint-enabled-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
373
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
374 (put 'gdb-function-name-token 'gdb-token-face gdb-function-name-face)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
375 (put 'gdb-function-name-token 'gdb-token-keymap gdb-function-name-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
376
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
377 (put 'gdb-function-location-token 'gdb-token-face gdb-function-location-face)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
378 (put 'gdb-function-location-token 'gdb-token-keymap gdb-function-location-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
379
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
380 (put 'gdb-breakpoint-number-token 'gdb-token-face gdb-breakpoint-number-face)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
381 (put 'gdb-breakpoint-number-token 'gdb-token-keymap gdb-breakpoint-number-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
382 (put 'gdb-info-breakpoint-number-token 'gdb-token-face
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
383 gdb-breakpoint-number-face)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
384 (put 'gdb-info-breakpoint-number-token 'gdb-token-keymap
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
385 gdb-info-breakpoint-number-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
386
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
387 (put 'gdb-frame-number-token 'gdb-token-face gdb-breakpoint-number-face)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
388 (put 'gdb-frame-number-token 'gdb-token-keymap gdb-frame-number-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
389
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
390 (put 'gdb-variable-name-token 'gdb-token-face gdb-variable-name-face)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
391 (put 'gdb-variable-name-token 'gdb-token-keymap gdb-variable-name-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
392
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
393 (put 'gdb-type-name-token 'gdb-token-face gdb-type-name-face)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
394 (put 'gdb-type-name-token 'gdb-token-keymap gdb-type-name-map)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
395
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
396
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
397 ;;; These regular expressions control what text corresponds to which tokens.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
398
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
399 (defconst gdb-highlight-token-patterns
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
400 ;; "May god forgive me for what I have unleashed." -- Evil Dead II.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
401 (purecopy
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
402 (list
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
403 ;; Breakpoints output:
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
404 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
405 ;; Breakpoint 5, XCreateWindow () at Window.c:136
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
406 ;; Breakpoint 6, foobar (x=0x7fff3000 "baz") at blorp.c:5382
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
407 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
408 (list (concat "\\(Breakpoint " ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
409 "\\([0-9]+\\)" ; .2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
410 "\\), " ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
411 "\\(0x[0-9a-fA-F]+ in \\)?" ; 3
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
412 "\\(" ; 4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
413 "\\([a-zA-Z0-9_]+\\):[a-zA-Z0-9_:~]+" ; .5
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
414 "\\|" ; .
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
415 "[a-zA-Z0-9_]+" ; .
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
416 "\\)" ; 4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
417 "\\(" ; 6
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
418 " *\\((.*)\\)" ; .7
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
419 " at \\(" ; .8
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
420 "\\([^ \t\n:]+\\):" ; ..9
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
421 "\\([0-9]+\\)" ; ..10
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
422 "\\)" ; .8
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
423 "\\)?" ; 6
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
424 )
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
425 '(gdb-breakpoint-number-token ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
426 nil ; 2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
427 nil ; 3
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
428 gdb-function-name-token ; 4 (+5)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
429 gdb-type-name-token ; 5
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
430 nil ; 6
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
431 gdb-arglist-token ; 7
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
432 gdb-function-location-token ; 8 (9+10)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
433 ))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
434
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
435 ;; Output of the "Break" command:
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
436 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
437 ;; Breakpoint 1 at 0x4881d4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
438 ;; Breakpoint 6 at 0xfa50f68: file cuexit.c, line 58.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
439 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
440 (list (concat "\\(Breakpoint " ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
441 "\\([0-9]+\\)" ; .2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
442 "\\) at " ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
443 "\\(0x[0-9A-Fa-f]+\\)" ; 3
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
444 "\\(: file " ; 4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
445 "\\(" ; .5
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
446 "\\([^ \t\n:]+\\)" ; ..6
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
447 ", line \\([0-9]+\\)" ; ..7
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
448 "\\)" ; .5
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
449 "\\)?" ; 4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
450 )
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
451 '(gdb-breakpoint-number-token ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
452 nil ; 2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
453 nil ;gdb-address-token ; 3
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
454 nil ; 4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
455 gdb-function-location-token ; 5 (6+7)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
456 ))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
457
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
458 ;; Note: breakpoint 5 (disabled) also set at pc 0x40b420.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
459 ;; Note: breakpoint 5 also set at pc 0x40b420.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
460 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
461 (list (concat "Note: " ;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
462 "\\(breakpoint " ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
463 "\\([0-9]+\\)" ; .2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
464 "\\)" ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
465 )
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
466 '(gdb-breakpoint-number-token ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
467 nil ; 2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
468 ))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
469
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
470 ;; Stack Frames:
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
471 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
472 ;; 0xe1b8e0 in _OS_SELECT () at os_IRIX.s:50
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
473 ;; XCreateWindow () at Window.c:136
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
474 ;; #0 0x8e0db0 in _OS_SELECT () at os_IRIX.s:50
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
475 ;; #0 XCreateWindow () at Window.c:136
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
476 ;; Run till exit from #0 __ll_mul () at llmul.s:51
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
477 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
478 (list (concat "\\(Run till exit from \\)?" ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
479 "\\(" ; 2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
480 "#\\([0-9]+ *\\)" ; .3
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
481 "\\)?" ; 2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
482 "\\(" ; 4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
483 "\\(0x[0-9A-Fa-f]+\\)" ; .5
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
484 " in +\\)?" ; 4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
485 "\\(" ; 6
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
486 "\\([a-zA-Z0-9_]+\\):[a-zA-Z0-9_:~]+" ; .7
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
487 "\\|" ; 6
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
488 "[a-zA-Z0-9_]+" ;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
489 "\\) (" ; 6
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
490 "\\(" ; 8
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
491 "\\(.*\\)" ; .9
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
492 "\\bat \\(" ; .10
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
493 "\\([^ \t\n:]+\\):" ; ..11
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
494 "\\([0-9]+\\)" ; ..12
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
495 "\\)" ; .10
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
496 "\\)?" ; 8
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
497 )
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
498 '(nil ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
499 gdb-frame-number-token ; 2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
500 nil ; 3
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
501 nil ; 4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
502 nil ;gdb-address-token ; 5
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
503 gdb-function-name-token ; 6 (+7)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
504 gdb-type-name-token ; 7
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
505 nil ; 8
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
506 gdb-arglist-token ; 9
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
507 gdb-function-location-token ; 10 (11+12)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
508 ))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
509
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
510 ;; Info Breakpoints output:
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
511 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
512 ;; 1 breakpoint keep y 0x0fa50f68 in exit at exit.c:58
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
513 ;; 1 breakpoint keep y 0x000a1b00 <exit+4>
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
514 ;; 1 breakpoint keep y 0x0fa429ac <_write>
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
515 ;; 6 breakpoint keep y 0x00789490 in foo::bar(bad *) at x.cpp:99
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
516 ;; 7 breakpoint keep y 0x00789490 <foo::bar(bad *)+128>
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
517 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
518 (list (concat "\\([0-9]+ *\\) " ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
519 "\\(breakpoint *\\|watchpoint *\\) " ; 2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
520 "\\(keep *\\|del *\\|dis *\\) " ; 3
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
521 "\\([yn] *\\) " ; 4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
522 "\\(0x[0-9A-Fa-f]+\\) *" ; 5
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
523 "\\(in " ; 6
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
524 "\\(" ; .7
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
525 "[a-zA-Z0-9_]+" ; ..
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
526 "\\|" ; .7
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
527 "\\([a-zA-Z0-9_]+\\):[a-zA-Z0-9_:~]+" ; ..8
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
528 "\\)" ; .7
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
529 "\\((.*)\\)?" ; 9
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
530 " at " ; .
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
531 "\\(" ; .10
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
532 "\\([^ \t\n:]+\\):" ; ..11
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
533 "\\([0-9]+\\)" ; ..12
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
534 "\\)" ; .10
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
535 "\\|" ; 6
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
536 "<" ; .
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
537 "\\(" ; .13
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
538 "\\([a-zA-Z0-9_]+\\):[a-zA-Z0-9_:~]+" ; ..14
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
539 "\\|" ; .13
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
540 "[a-zA-Z0-9_]+" ; ..
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
541 "\\)" ; .13
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
542 "\\((.*)\\)?" ; .15
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
543 "[^>\n]*>" ; .
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
544 "\\)?" ; 6
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
545 )
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
546 '(gdb-info-breakpoint-number-token ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
547 nil ; 2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
548 nil ;gdb-breakpoint-keep-token ; 3
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
549 gdb-enabled-token ; 4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
550 nil ;gdb-address-token ; 5
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
551 nil ; 6
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
552 gdb-function-name-token ; 7 (+8)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
553 gdb-type-name-token ; 8
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
554 gdb-arglist-types-token ; 9
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
555 gdb-function-location-token ; 10 (11+12)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
556 nil ; 11
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
557 nil ; 12
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
558 gdb-function-name-token ; 13
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
559 gdb-type-name-token ; 14
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
560 gdb-arglist-types-token ; 15
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
561 ))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
562
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
563 ;; Whatis and Ptype output:
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
564 ;; type = struct _WidgetRec *
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
565 ;; type = struct _WidgetRec {
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
566 ;; type = int ()
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
567 ;; type = struct <undefined> *(struct <undefined> *, void *, void (*)())
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
568 ;; type = struct foo *(struct foo *, unsigned char, int)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
569 ;; type = unsigned int [4]
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
570 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
571 (list (concat "type = "
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
572 "\\(" ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
573 "\\(signed \\|unsigned \\)?" ; .2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
574 "\\(struct \\|class \\|union \\|enum \\)?" ; .3
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
575 "\\(<?[a-zA-Z_][a-zA-Z0-9_:]*>?\\)" ; .4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
576 "\\)" ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
577 "[ *]*" ;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
578 "\\(" ; 5
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
579 "{?$\\|" ; .
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
580 "\\[[0-9]*\\]$\\|" ; .
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
581 "\\((.*)\\)" ; .6
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
582 "\\)" ; 5
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
583 )
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
584 '(gdb-type-name-token ; 1 (2+3+4)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
585 nil ; 2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
586 nil ; 3
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
587 nil ; 4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
588 nil ; 5
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
589 gdb-arglist-types-token ; 6
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
590 ))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
591
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
592 ;; Ptype output:
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
593 ;; CorePart core;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
594 ;; void *constraints;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
595 ;; short x;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
596 ;; unsigned short width;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
597 ;; struct <undefined> *event_table;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
598 ;; XtTMRec tm;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
599 ;; void (*class_initialize)();
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
600 ;; unsigned char (*set_values)();
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
601 ;; unsigned char st_fstype[16];
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
602 ;; type = enum {XtGeometryYes, XtGeometryNo, XtGeometryAlmost}
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
603 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
604 (list (concat " *"
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
605 "\\(" ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
606 "\\(signed \\|unsigned \\)?" ; .2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
607 "\\(struct \\|class \\|union \\|enum \\)?" ; .3
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
608 "\\([a-zA-Z_][a-zA-Z0-9_:]*\\)" ; .4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
609 "\\)" ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
610 "[ *]*"
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
611 "\\((\\**\\)?" ; 5
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
612 "\\([a-zA-Z_][a-zA-Z0-9_:]*\\)" ; 6
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
613 "\\()()\\)?" ; 7
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
614 "\\( *\\[[0-9]*\\]\\)?" ; 8
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
615 "; *$"
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
616 )
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
617 '(gdb-type-name-token ; 1 (2+3+4)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
618 ))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
619
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
620 ;; Ptype output on C++ classes:
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
621 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
622 ;; virtual foo (int);
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
623 ;; unsigned int foo(void);
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
624 ;; static long unsigned int * foo(bar *, baz *, unsigned int);
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
625 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
626 ;; not handled:
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
627 ;; foo(bar *, _WidgetRec *, char const *, int);
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
628 ;; foo (foo &);
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
629 ;; foo & operator=(foo const &);
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
630 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
631 (list (concat " *"
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
632 "\\(static \\)?" ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
633 "\\(" ; 2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
634 "\\(signed \\|unsigned " ; .3
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
635 ;; #### not so sure about this:
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
636 "\\|long unsigned \\|short unsigned " ; .3
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
637 "\\)?" ; .3
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
638 "\\(struct \\|class \\|union \\|enum \\)?" ; .4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
639 "\\([a-zA-Z_][a-zA-Z0-9_:]*\\)" ; .5
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
640 "\\)" ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
641 "[ *&]+" ;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
642 " *\\([a-zA-Z_][a-zA-Z0-9_:]*\\)" ; 6
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
643 " *\\((.*)\\)" ; 7
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
644 "; *$" ;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
645 )
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
646 '(nil ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
647 gdb-type-name-token ; 2 (3+4+5)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
648 nil ; 3
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
649 nil ; 4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
650 nil ; 5
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
651 gdb-function-name-token ; 6
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
652 gdb-arglist-types-token ; 7
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
653 ))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
654
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
655 ;; Pointers to functions:
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
656 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
657 ;; $1 = {void ()} 0x4a1334 <fe_pulldown_cb>
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
658 ;; $2 = (void (*)()) 0x4a1334 <fe_pulldown_cb>
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
659 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
660 (list (concat ".* = "
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
661 "[({]"
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
662 "\\(" ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
663 "\\(signed \\|unsigned \\)?" ; .2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
664 "\\(struct \\|class \\|union \\|enum \\)?" ; .3
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
665 "\\([a-zA-Z_][a-zA-Z0-9_:]*\\)" ; .4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
666 "\\)" ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
667 " \\((\\*) ?\\)?" ; 5
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
668 "\\((.*)\\)" ; 6
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
669 "[)}] +" ;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
670 "\\(0x[0-9A-Fa-f]+\\) +" ; 7
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
671 "<\\([a-zA-Z_~][a-zA-Z0-9_:]*\\)" ; 8
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
672 "\\+?[0-9]+?>" ;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
673 )
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
674 '(gdb-type-name-token ; 1 (2+3+4)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
675 nil ; 2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
676 nil ; 3
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
677 nil ; 4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
678 nil ; 5
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
679 gdb-arglist-types-token ; 6
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
680 nil ;gdb-address-token ; 7
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
681 gdb-function-name-token ; 8
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
682 ))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
683
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
684 ;; Local variables and structures:
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
685 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
686 ;; shell = (struct _WidgetRec *) 0x10267350
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
687 ;; delete_response = 270955344
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
688 ;; allow_resize = 200 'È'
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
689 ;; is_modal = 47 '/'
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
690 ;; class_name = 0xf661d40 "TopLevelShell",
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
691 ;; static foo = 0x10791ec0,
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
692 ;; initialize = 0xf684770 <TopLevelInitialize>,
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
693 ;; av = {{
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
694 ;; name = "foo",
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
695 ;; value = 270349836
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
696 ;; }, {
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
697 ;; name = 0x12 <Address 0x12 out of bounds>,
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
698 ;; value = 0
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
699 ;; }, {
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
700 ;; name = 0x0,
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
701 ;; value = 0
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
702 ;; }}
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
703 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
704 (list (concat " *"
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
705 "\\(static \\)?" ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
706 "\\([$a-zA-Z_][a-zA-Z0-9_:]*\\) = " ; 2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
707 "\\((" ; 3
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
708 "\\(" ; .4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
709 "\\(signed \\|unsigned \\)?" ; ..5
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
710 "\\(struct \\|class \\|union \\|enum \\)?"; ..6
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
711 "\\([a-zA-Z_][a-zA-Z0-9_:]*\\)" ; ..7
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
712 "\\)" ; .4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
713 "[ *]*)" ;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
714 "\\)?" ; 3
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
715 "\\(" ; 8
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
716 ".*"
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
717 " <\\([a-zA-Z_~][a-zA-Z0-9_:]*\\)" ; .9
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
718 "\\+?[0-9]+?>" ; .
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
719 "\\)?" ; 8
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
720 )
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
721 '(nil ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
722 gdb-variable-name-token ; 2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
723 nil ; 3
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
724 gdb-type-name-token ; 4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
725 nil ; 5
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
726 nil ; 6
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
727 nil ; 7
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
728 nil ; 8
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
729 gdb-function-name-token ; 9
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
730 ))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
731
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
732 ;; Purify output:
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
733 ;; UMR: Uninitialized memory read:
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
734 ;; * This is occurring while in:
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
735 ;; SHA1_Update [algsha.c:137]
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
736 ;; * Reading 1 byte from 0xefffdb34 on the stack.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
737 (list (concat "[ \t]+"
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
738 "\\([a-zA-Z_~][a-zA-Z0-9_:]*\\)[ \t]*" ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
739 "\\[\\(" ; 2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
740 "\\([^ \t\n:]+\\):" ; .3
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
741 "\\([0-9]+\\)" ; .4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
742 "\\)\\]" ; 2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
743 )
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
744 '(gdb-function-name-token ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
745 gdb-function-location-token ; 2 (3+4)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
746 ))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
747
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
748 ;; Purify output:
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
749 ;; * Address 0xefffdb34 is 36 bytes past start of local variable \
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
750 ;; "data" in function fe_EventForRNG.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
751 (list (concat ".*\\bAddress "
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
752 "\\(0x[0-9A-Fa-f]+\\) +" ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
753 ".*\\bvariable \"" ;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
754 "\\([a-zA-Z_][a-zA-Z0-9_:]*\\)\"" ; 2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
755 "\\(" ; 3
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
756 ".*\\bfunction " ; .
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
757 "\\([a-zA-Z_~][a-zA-Z0-9_:]*\\)" ; .4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
758 "\\)?" ; 3
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
759 )
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
760 '(nil ;gdb-address-token ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
761 gdb-variable-name-token ; 2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
762 nil ; 3
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
763 gdb-function-name-token ; 4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
764 ))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
765 ))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
766 "Patterns to highlight in gdb buffers.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
767 Each element of this list takes the form
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
768 ( \"regexp\" ( token-1 token-2 ... ))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
769 where token-N is the token to place on the text matched
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
770 by sub-pattern N in the match data.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
771
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
772 The patterns should not begin with \"^\".")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
773
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
774
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
775 (defun gdb-highlight-line ()
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
776 "Highlight any tokens on the line which match gdb-highlight-token-patterns."
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
777 (map-extents #'(lambda (e ignore) (delete-extent e))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
778 nil
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
779 (point) (save-excursion (forward-line 1) (point))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
780 nil nil 'gdb-token)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
781 (while (looking-at comint-prompt-regexp)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
782 (goto-char (match-end 0)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
783 (if (eobp)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
784 nil
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
785 (let ((tokens gdb-highlight-token-patterns)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
786 (do-magic-variable-hack nil))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
787 (while tokens
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
788 (if (not (looking-at (car (car tokens))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
789 (setq tokens (cdr tokens))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
790 (let ((i 1)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
791 (types (nth 1 (car tokens))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
792 (if (eq (car types) 'gdb-variable-name-token)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
793 (setq do-magic-variable-hack t))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
794 (while types
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
795 (cond ((not (and (car types)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
796 (match-beginning i)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
797 nil)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
798 ((memq (car types) '(gdb-arglist-token
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
799 gdb-arglist-types-token))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
800 (gdb-highlight-arglist (car types)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
801 (match-beginning i)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
802 (match-end i)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
803 ((/= ?$ (char-after (match-beginning i)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
804 (gdb-highlight-token (car types)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
805 (match-beginning i)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
806 (match-end i))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
807 (setq i (1+ i)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
808 types (cdr types)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
809
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
810 (if (not do-magic-variable-hack)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
811 ;; we're done.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
812 (setq tokens nil)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
813 ;; else, do a grody hack to cope with multiple variables
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
814 ;; on the same line.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
815 (save-restriction
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
816 (let ((p (point))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
817 (ok nil))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
818 (end-of-line)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
819 (narrow-to-region p (point))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
820 (goto-char (match-end 0))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
821 (if (= (following-char) ?\{)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
822 (progn
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
823 (forward-char 1)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
824 (setq ok t))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
825 (setq p (scan-sexps (point) 1 nil t))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
826 (setq ok (if (null p)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
827 nil
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
828 (goto-char p)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
829 (if (or (= (following-char) ?\,)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
830 (= (following-char) ?\}))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
831 t
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
832 (setq p (scan-sexps (point) 1 nil t))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
833 (if (null p)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
834 nil
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
835 (goto-char p)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
836 t)))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
837 (if ok
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
838 ;; skip over the comma and go around again.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
839 (and (looking-at "}?[ \t]*,[ \t]*")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
840 (goto-char (match-end 0)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
841 ;; saw something unexpected; give up on this line.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
842 (setq tokens nil)))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
843 )))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
844 nil)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
845
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
846 (defun gdb-highlight-token (type start end)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
847 "Helper for gdb-highlight-line -- makes an extent for one matched token."
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
848 (let ((e (make-extent start end)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
849 (set-extent-property e 'gdb-token type)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
850 (set-extent-property e 'highlight 't)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
851 (set-extent-property e 'help-echo 'gdb-token-help-echo)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
852 (set-extent-property e 'face (get type 'gdb-token-face))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
853 (set-extent-property e 'keymap (get type 'gdb-token-keymap))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
854 e))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
855
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
856 (defun gdb-highlight-arglist (type start end)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
857 "Helper for gdb-highlight-line.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
858 Makes extents for variables or types in an arglist."
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
859 (save-match-data
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
860 (save-excursion
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
861 (goto-char end)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
862 (if (eq (preceding-char) ?\))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
863 (setq end (1- end)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
864 (goto-char start)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
865 (if (eq (following-char) ?\()
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
866 (forward-char 1))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
867 (set-extent-property (make-extent start end) 'gdb-token type)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
868
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
869 (cond
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
870 ((eq type 'gdb-arglist-token)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
871 (let* ((pat1 "\\([a-zA-Z_][a-zA-Z0-9_:]*\\)=")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
872 (pat2 ", \\([a-zA-Z_][a-zA-Z0-9_:]*\\)=")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
873 (pat pat1))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
874 (while(re-search-forward pat end t)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
875 (gdb-highlight-token 'gdb-variable-name-token
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
876 (match-beginning 1) (match-end 1))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
877 (cond ((looking-at
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
878 "0?x?[0-9A-Fa-f]+ <\\([a-zA-Z_~][a-zA-Z0-9_:]*\\)>")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
879 (goto-char (match-end 0))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
880 (gdb-highlight-token 'gdb-function-name-token
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
881 (match-beginning 1) (match-end 1))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
882 (setq pat pat2))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
883
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
884 ((eq type 'gdb-arglist-types-token)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
885 (let ((pat (eval-when-compile
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
886 (concat
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
887 "\\(" ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
888 "\\(signed \\|unsigned \\)?" ; .2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
889 "\\(struct \\|class \\|union \\|enum \\)?" ; .3
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
890 "\\(<?[a-zA-Z_~][a-zA-Z0-9_:]*>?\\)" ; .4
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
891 "\\)" ; 1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
892 "[ *]*"
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
893 "\\((\\*) *(.*)\\)?" ; 5
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
894 ))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
895 (while (< (point) end)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
896 (cond ((looking-at pat)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
897 (goto-char (match-end 0))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
898 (gdb-highlight-token 'gdb-type-name-token
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
899 (match-beginning 1) (match-end 1))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
900 (if (looking-at " *, *")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
901 (goto-char (match-end 0))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
902 (t
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
903 ;; error -- try to cope...
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
904 (search-forward "," (1+ end) t))))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
905 (t
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
906 (error "unknown arglist type %s" type)))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
907 nil)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
908
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
909 (defun gdb-token-help-echo (extent)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
910 "Used as the 'mouse-help property of gdb-token extents,
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
911 to describe the binding on button2."
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
912 (let* ((map (extent-property extent 'keymap))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
913 (key 'button2)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
914 (fn (and map (lookup-key map key)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
915 (doc (and fn (symbolp fn)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
916 (if (fboundp fn)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
917 (format "%s: %s" key (documentation fn))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
918 (format "Error: %s is undefined" fn)))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
919 (if doc
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
920 (save-match-data
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
921 (if (string-match "\n" doc)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
922 (setq doc (substring doc 0 (match-beginning 0))))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
923 (or doc
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
924 (concat "Error: no doc for "
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
925 (symbol-name (extent-property extent 'gdb-token))))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
926
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
927 (defun gdb-get-line-token-extents (tokens)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
928 "Given a list of gdb-tokens, returns this line's extents of those types.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
929 The returned value is a list of the same length as the `tokens' list, with
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
930 the corresponding extents in the corresponding positions. If an extent
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
931 isn't found, nil is placed in the result-list instead."
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
932 (setq tokens (append tokens nil))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
933 (let* ((result (make-list (length tokens) nil)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
934 (save-excursion
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
935 (beginning-of-line)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
936 (map-extents #'(lambda (e ignore)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
937 (let ((type (extent-property e 'gdb-token))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
938 (r1 tokens)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
939 (r2 result))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
940 (while r1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
941 (cond ((and (car r1) (eq type (car r1)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
942 (setcar r1 nil)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
943 (setcar r2 e)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
944 (setq r1 nil)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
945 (setq r1 (cdr r1)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
946 r2 (cdr r2))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
947 nil)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
948 nil
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
949 (point)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
950 (progn (forward-line 1) (point))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
951 nil nil
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
952 'gdb-token)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
953 result)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
954
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
955
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
956 ;;; Remembering directory names.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
957 ;;; gdb and gdb-mode conspire to hide from us the full file names of things
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
958 ;;; that are presented into the buffer; this is an attempt to circumvent that.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
959
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
960 (defvar gdb-highlight-last-directory nil)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
961 (defvar gdb-highlight-last-directory-table nil)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
962
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
963 (defun gdb-highlight-remember-directory ()
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
964 ;; When gdb deigns to give us a full pathname, and it's in a different
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
965 ;; directory than last time, cache it away on one of the nearby gdb-token
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
966 ;; extents. (We intern it to avoid hanging on to a lot of strings.)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
967 (cond ((and (boundp 'gdb-last-frame)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
968 (car gdb-last-frame))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
969 (cond ((not gdb-highlight-last-directory-table)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
970 (set (make-local-variable 'gdb-highlight-last-directory) nil)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
971 (set (make-local-variable 'gdb-highlight-last-directory-table)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
972 (make-vector 211 0))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
973 (let ((dir (file-name-directory (car gdb-last-frame))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
974 (setq dir (intern dir gdb-highlight-last-directory-table))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
975 (cond ((not (eq dir gdb-highlight-last-directory))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
976 (let ((extent (previous-extent (current-buffer))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
977 (setq gdb-highlight-last-directory dir)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
978 (while extent
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
979 (cond ((extent-property extent 'gdb-token)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
980 (set-extent-property extent 'gdb-directory dir)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
981 (setq extent nil))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
982 (t
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
983 (setq extent (previous-extent extent))))))))))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
984
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
985 (defun gdb-guess-directory ()
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
986 "Guess what directory gdb was talking about when it wrote the current line."
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
987 (let ((extent (or (map-extents #'(lambda (e ignore) e)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
988 (current-buffer) (point) (point-max))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
989 (previous-extent (current-buffer))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
990 (error "no extents")))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
991 (dir nil))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
992 (while extent
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
993 (setq dir (extent-property extent 'gdb-directory))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
994 (if dir
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
995 (setq extent nil)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
996 (setq extent (previous-extent extent))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
997 (if dir
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
998 (symbol-name dir)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
999 default-directory)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1000
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1001 (defun gdb-guess-file-name (file)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1002 "Given a directoryless file name printed by gdb, find the file.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1003 First it tries to expand the file relative to `gdb-guess-directory',
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1004 and if the resultant file doesn't exist, it tries every other directory
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1005 gdb has ever told us about, in no particular order."
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1006 (abbreviate-file-name
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1007 (if (file-name-absolute-p file)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1008 file
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1009 (let ((file2 (expand-file-name file (gdb-guess-directory))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1010 (if (file-exists-p file2)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1011 file2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1012 ;; Oh boy, gdb didn't tell us what directory it's in.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1013 ;; A-hunting we will go.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1014 (if (catch 'done
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1015 (mapatoms #'(lambda (dir)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1016 (setq file2 (expand-file-name file
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1017 (symbol-name dir)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1018 (if (file-exists-p file2)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1019 (throw 'done t)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1020 gdb-highlight-last-directory-table)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1021 nil)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1022 file2
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1023 (expand-file-name file)))))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1024
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1025
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1026 ;;; Commands which are invoked from bindings in the keymaps of the tokens.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1027
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1028 (defun gdb-mouse-toggle-breakpoint-enabled (event &optional what)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1029 "Toggle whether the breakpoint is enabled.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1030 Looks for a gdb-breakpoint extent on the line under the mouse,
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1031 and executes an `enable' or `disable' command as appropriate.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1032 Optional arg `what' may be 'enable, 'disable, or 'toggle (default.)"
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1033 (interactive "@*e")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1034 (let (number target enabled-p)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1035 (save-excursion
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1036 (mouse-set-point event)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1037 (let* ((extents (gdb-get-line-token-extents
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1038 '(gdb-breakpoint-number-token
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1039 gdb-info-breakpoint-number-token
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1040 gdb-enabled-token)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1041 (be (or (nth 0 extents) (nth 1 extents)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1042 (ee (nth 2 extents)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1043
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1044 (or be
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1045 (error "no breakpoint-number extent on this line"))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1046 (setq number
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1047 (buffer-substring (extent-start-position be)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1048 (extent-end-position be)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1049 (if (string-match " [0-9]+\\'" number)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1050 (setq number (substring number (1+ (match-beginning 0)))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1051 (setq number (string-to-int number))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1052 (or (> number 0)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1053 (error "couldn't find breakpoint number"))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1054 (if (null ee)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1055 (setq enabled-p 'unknown)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1056 (setq target (extent-start-position ee))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1057 (goto-char target)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1058 (setq enabled-p
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1059 (cond ((looking-at "[yY]\\b") t)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1060 ((looking-at "[nN]\\b") nil)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1061 (t (error "enabled is not y or n?")))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1062
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1063 (cond ((eq what 'enable)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1064 (setq enabled-p nil))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1065 ((eq what 'disable)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1066 (setq enabled-p t))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1067 ((or (eq what 'toggle) (null what))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1068 (if (eq enabled-p 'unknown)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1069 (error
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1070 "can't toggle breakpoint: don't know current state")))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1071 (t
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1072 (error "what must be enable, disable, toggle, or nil.")))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1073 ))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1074
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1075 (gdb-menu-command (format "%s %d"
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1076 (if enabled-p "disable" "enable")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1077 number)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1078 nil)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1079 (message "%s breakpoint %d."
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1080 (if enabled-p "Disabled" "Enabled")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1081 number)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1082 (cond (target
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1083 (save-excursion
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1084 (goto-char target)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1085 (insert (if enabled-p "n" "y"))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1086 (delete-char 1)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1087 ;; don't let shell-fonts or font-lock second-guess us.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1088 (remove-text-properties (1- (point)) (point) '(face))))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1089 nil)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1090
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1091 (defun gdb-mouse-enable-breakpoint (event)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1092 "Enable the breakpoint.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1093 Looks for a gdb-breakpoint extent on the line under the mouse,
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1094 and executes an `enable' command"
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1095 (interactive "@*e")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1096 (gdb-mouse-toggle-breakpoint-enabled event 'enable))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1097
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1098 (defun gdb-mouse-disable-breakpoint (event)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1099 "Disable the breakpoint.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1100 Looks for a gdb-breakpoint extent on the line under the mouse,
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1101 and executes a `disable' command"
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1102 (interactive "@*e")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1103 (gdb-mouse-toggle-breakpoint-enabled event 'disable))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1104
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1105
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1106 ;; compatibility hack...
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1107 (or (fboundp 'extent-object) (fset 'extent-object 'extent-buffer))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1108
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1109 (defun gdb-mouse-edit-function (event)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1110 "Edit the definition of this function (as with \\[find-tag])
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1111 Looks for a gdb-function-name extent on the line under the mouse,
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1112 and runs find-tag on the text under that extent."
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1113 (interactive "@*e")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1114 (let (extent)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1115 (save-excursion
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1116 (mouse-set-point event)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1117 (setq extent (or (car (gdb-get-line-token-extents
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1118 '(gdb-function-name-token)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1119 (error "no function-name extent on this line"))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1120 (find-tag
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1121 (buffer-substring (extent-start-position extent)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1122 (extent-end-position extent)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1123 (extent-object extent)))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1124
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1125
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1126 (defun gdb-mouse-edit-function-location (event)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1127 "Edit the source file of this function.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1128 Looks for a gdb-function-location extent on line of the mouse,
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1129 and parses the text under it."
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1130 (interactive "@*e")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1131 (let (file line)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1132 (save-excursion
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1133 (mouse-set-point event)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1134 (let ((extent (or (car (gdb-get-line-token-extents
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1135 '(gdb-function-location-token)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1136 (error "no function-location extent on this line"))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1137 (goto-char (extent-start-position extent))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1138 (or (looking-at "\\([^ \t\n:,]+\\):\\([0-9]+\\)")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1139 (looking-at "\\([^ \t\n:,]+\\),? line \\([0-9]+\\)")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1140 (error "no file position on this line"))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1141 (setq file (buffer-substring (match-beginning 1) (match-end 1))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1142 line (buffer-substring (match-beginning 2) (match-end 2)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1143 (setq file (gdb-guess-file-name file)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1144 line (string-to-int line))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1145 ))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1146 (if (file-exists-p file)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1147 (find-file-other-window file)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1148 (signal 'file-error (list "File not found" file)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1149 (goto-line line)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1150
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1151
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1152 (defun gdb-mouse-goto-frame (event)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1153 "Select this stack frame.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1154 Looks for a gdb-frame-number extent on the line of the mouse,
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1155 and executes a `frame' command to select that frame."
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1156 (interactive "@*e")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1157 (let (number)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1158 (save-excursion
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1159 (mouse-set-point event)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1160 (let ((extent (or (car (gdb-get-line-token-extents
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1161 '(gdb-frame-number-token)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1162 (error "no frame-number extent on this line"))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1163 (goto-char (extent-start-position extent))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1164 (if (eq (following-char) ?#)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1165 (forward-char 1))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1166 (setq number (string-to-int
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1167 (buffer-substring (point)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1168 (extent-end-position extent))))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1169 (gdb-menu-command (format "frame %d" number) t))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1170 nil)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1171
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1172
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1173 (defun gdb-mouse-get-variable-reference (event)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1174 "Returns a string which references the variable under the mouse.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1175 This works even if the variable is deep inside nested arrays or structures.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1176 If the variable seems to hold a pointer, then a \"*\" will be prepended."
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1177 (save-excursion
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1178 (let* ((extent (if (extentp event)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1179 event
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1180 (progn
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1181 (mouse-set-point event)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1182 (extent-at (point) nil 'gdb-token))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1183 dereference-p
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1184 name)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1185 (or (and extent
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1186 (eq (extent-property extent 'gdb-token)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1187 'gdb-variable-name-token))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1188 (error "not over a variable name"))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1189 (setq name (buffer-substring (extent-start-position extent)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1190 (extent-end-position extent)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1191 (save-excursion
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1192 (goto-char (extent-end-position extent))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1193 (if (and (looking-at " *= *\\(([^)]+)\\)? *0x[0-9a-fA-F]+") ; pointer
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1194 (progn
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1195 (goto-char (match-end 0))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1196 (not (looking-at " +\"")))) ; but not string
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1197 (setq dereference-p t))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1198
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1199 ;; Now, if this variable is buried in a structure, compose a complete
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1200 ;; reference-chain to it.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1201 (goto-char (extent-start-position extent))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1202
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1203 (let ((done nil))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1204 (while (not done)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1205 (skip-chars-backward " \t")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1206 (if (or (and (/= (preceding-char) ?\n)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1207 (/= (preceding-char) ?\,)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1208 (/= (preceding-char) ?\{))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1209 (<= (buffer-syntactic-context-depth) 0))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1210 (setq done t)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1211 (let ((p (scan-lists (point) -1 1)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1212 (if (null p)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1213 (setq done t)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1214 (goto-char (setq p (- p 3)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1215 (cond
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1216 ((looking-at " = {")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1217 (skip-chars-backward "a-zA-Z0-9_")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1218 (if (= (preceding-char) ?\$)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1219 (forward-char -1))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1220 (setq name (concat (buffer-substring (point) p) "." name)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1221
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1222 ((looking-at "}, +{")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1223 (forward-char 1)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1224 (let ((parse-sexp-ignore-comments nil)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1225 (count 0))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1226 (while (setq p (scan-sexps (point) -1 nil t))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1227 (goto-char p)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1228 (setq count (1+ count)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1229
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1230 (setq name (format "[%d].%s" count name))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1231
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1232 ;; up out of the list
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1233 (skip-chars-backward " \t\n")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1234 (if (= (preceding-char) ?\{)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1235 (forward-char -1))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1236
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1237 ;; we might be tightly nested in slot 0...
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1238 (while (= (preceding-char) ?\{)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1239 (forward-char -1)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1240 (setq name (concat "[0]" name)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1241
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1242 (skip-chars-backward " \t")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1243 (if (= (preceding-char) ?=) (forward-char -1))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1244 (skip-chars-backward " \t")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1245 (setq p (point))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1246 (skip-chars-backward "a-zA-Z0-9_")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1247 (if (= (preceding-char) ?\$)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1248 (forward-char -1))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1249
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1250 (setq name (concat (buffer-substring (point) p) name))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1251 ))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1252 (t
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1253 (setq done t)))))))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1254
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1255 (if dereference-p
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1256 (setq name (concat "*" name)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1257 name)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1258
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1259 (defun gdb-mouse-print-variable (event)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1260 "Print the value of this variable.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1261 Finds a variable under the mouse, and figures out whether it is inside of
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1262 a structure, and composes and executes a `print' command. If the variable
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1263 seems to hold a pointer, prints the object pointed to."
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1264 (interactive "@*e")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1265 (gdb-menu-command (concat "print "
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1266 (gdb-mouse-get-variable-reference event))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1267 t))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1268
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1269 (defun gdb-mouse-print-variable-type (event)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1270 "Describe the type of this variable.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1271 Finds a variable under the mouse, and figures out whether it is inside of
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1272 a structure, and composes and executes a `whatis' command. If the variable
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1273 seems to hold a pointer, describes the type of the object pointed to."
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1274 (interactive "@*e")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1275 (gdb-menu-command (concat "whatis "
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1276 (gdb-mouse-get-variable-reference event))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1277 t))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1278
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1279 (defun gdb-mouse-print-type (event)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1280 "Describe this type.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1281 Finds a type description under the mouse, and executes a `ptype' command."
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1282 (interactive "@*e")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1283 (let* ((extent (save-excursion
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1284 (mouse-set-point event)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1285 (extent-at (point) nil 'gdb-token)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1286 name)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1287 (or (and extent
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1288 (eq (extent-property extent 'gdb-token) 'gdb-type-name-token))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1289 (error "not over a type name"))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1290 (setq name (buffer-substring (extent-start-position extent)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1291 (extent-end-position extent)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1292 (gdb-menu-command (format "ptype %s" name)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1293 t))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1294 nil)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1295
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1296
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1297 ;;; Popup menus
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1298
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1299 (defun gdb-menu-command (command &optional scroll-to-bottom)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1300 "Sends the command to gdb.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1301 If gdb is not sitting at a prompt, interrupts it first
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1302 \(as if with \\[gdb-control-c-subjob]), executes the command, and then lets
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1303 the debugged program continue.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1304
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1305 If scroll-to-bottom is true, then point will be moved to after the new
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1306 output. Otherwise, an effort is made to avoid scrolling the window and
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1307 to keep point where it was."
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1308
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1309 ;; this is kinda like gdb-call except for the interrupt-first behavior,
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1310 ;; but also it leaves the commands in the buffer instead of trying to
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1311 ;; hide them.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1312
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1313 (let* ((proc (or (get-buffer-process (current-buffer))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1314 (error "no process in %s" (buffer-name (current-buffer)))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1315 (window (selected-window))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1316 wstart
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1317 (opoint (point))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1318 was-at-bottom
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1319 running-p)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1320
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1321 (if (not (eq (current-buffer) (window-buffer window)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1322 (setq window (get-buffer-window (current-buffer))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1323 (setq wstart (window-start window))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1324
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1325 (let ((pmark (process-mark proc)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1326 (setq was-at-bottom (>= (point) pmark))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1327 (goto-char pmark)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1328 (delete-region (point) (point-max)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1329
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1330 (setq running-p (bolp)) ; maybe not the best way to tell...
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1331
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1332 (cond (running-p
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1333 (message "Program is running -- interrupting first...")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1334 (gdb-control-c-subjob)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1335 (while (accept-process-output proc 1)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1336 ;; continue accepting output as long as it's arriving
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1337 )))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1338
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1339 (message "%s" command)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1340 (goto-char (process-mark proc))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1341 (insert command)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1342 (comint-send-input)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1343
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1344 ;; wait for the command to be accepted
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1345 (accept-process-output proc)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1346 (goto-char (process-mark proc))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1347
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1348 ;; continue, if we had interrupted
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1349 (cond (running-p
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1350 (insert "continue")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1351 (comint-send-input)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1352
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1353 (if scroll-to-bottom
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1354 (goto-char (process-mark proc))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1355
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1356 (set-window-start window wstart)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1357 (goto-char opoint)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1358 (if was-at-bottom
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1359 (if (pos-visible-in-window-p (process-mark proc) window)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1360 (goto-char (process-mark proc))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1361 (goto-char (window-end window))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1362 (forward-line -2))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1363 )
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1364 nil)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1365
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1366
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1367 (defun gdb-make-context-menu (event)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1368 "Returns a menu-desc corresponding to the stack-frame line under the mouse.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1369 Returns nil if not over a stack-frame."
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1370 (save-excursion
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1371 (mouse-set-point event)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1372 (let* ((extents (gdb-get-line-token-extents
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1373 '(gdb-breakpoint-number-token
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1374 gdb-info-breakpoint-number-token
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1375 gdb-enabled-token
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1376 gdb-frame-number-token
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1377 gdb-function-name-token
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1378 gdb-function-location-token
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1379 gdb-arglist-token
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1380 gdb-arglist-types-token
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1381 gdb-variable-name-token
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1382 gdb-type-name-token
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1383 )))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1384 (bnumber (or (nth 0 extents)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1385 (nth 1 extents)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1386 (enabled-p (nth 2 extents))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1387 (fnumber (nth 3 extents))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1388 (name (nth 4 extents))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1389 (loc (nth 5 extents))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1390 (al (nth 6 extents))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1391 (alt (nth 7 extents))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1392 (var (nth 8 extents))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1393 (type (nth 9 extents))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1394 (var-e var))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1395
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1396 ;; If this line has an arglist, only document variables and types
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1397 ;; if the mouse is directly over them.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1398 (if (or al alt)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1399 (setq var nil
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1400 type nil))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1401
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1402 ;; Always prefer the object under the mouse to one elsewhere on the line.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1403 (let* ((e (extent-at (point) nil 'gdb-token))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1404 (p (and e (extent-property e 'gdb-token))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1405 (cond ((eq p 'gdb-function-name-token) (setq name e))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1406 ((eq p 'gdb-variable-name-token) (setq var e var-e e))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1407 ((eq p 'gdb-type-name-token) (setq type e))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1408 ))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1409
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1410 ;; Extract the frame number (it may begin with "#".)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1411 (cond (fnumber
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1412 (goto-char (extent-start-position fnumber))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1413 (if (eq (following-char) ?#)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1414 (forward-char 1))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1415 (setq fnumber
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1416 (string-to-int
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1417 (buffer-substring (point)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1418 (extent-end-position fnumber))))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1419
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1420 ;; Extract the breakpoint number (it may begin with "Breakpoint ".)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1421 (cond (bnumber
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1422 (setq bnumber
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1423 (buffer-substring (extent-start-position bnumber)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1424 (extent-end-position bnumber)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1425 (if (string-match " [0-9]+\\'" bnumber)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1426 (setq bnumber (substring bnumber (1+ (match-beginning 0)))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1427 (setq bnumber (string-to-int bnumber))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1428 (or (> bnumber 0)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1429 (error "couldn't parse breakpoint number"))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1430
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1431 (cond ((null enabled-p)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1432 (setq enabled-p 'unknown))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1433 ((memq (char-after (extent-start-position enabled-p)) '(?y ?Y))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1434 (setq enabled-p 't))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1435 ((memq (char-after (extent-start-position enabled-p)) '(?n ?N))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1436 (setq enabled-p 'nil))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1437 (t
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1438 (setq enabled-p 'unknown)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1439
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1440 ;; Convert the extents to strings.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1441 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1442 (if name
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1443 (setq name (buffer-substring (extent-start-position name)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1444 (extent-end-position name))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1445 (if loc
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1446 (setq loc (buffer-substring (extent-start-position loc)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1447 (extent-end-position loc))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1448 (if var
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1449 (setq var (buffer-substring (extent-start-position var)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1450 (extent-end-position var))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1451 (if type
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1452 (setq type (buffer-substring (extent-start-position type)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1453 (extent-end-position type))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1454
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1455 ;; Return a menu description list.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1456 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1457 (nconc
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1458 (if (and bnumber (not (eq enabled-p 'nil)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1459 (list (vector (format "Disable Breakpoint %d"
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1460 bnumber)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1461 (list 'gdb-mouse-disable-breakpoint event)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1462 t)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1463 (if (and bnumber (not (eq enabled-p 't)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1464 (list (vector (format "Enable Breakpoint %d"
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1465 bnumber)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1466 (list 'gdb-mouse-enable-breakpoint event)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1467 t)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1468 (if bnumber
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1469 (list (vector (format "Delete Breakpoint %d" bnumber)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1470 (list 'gdb-menu-command (format "delete %d" bnumber)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1471 nil)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1472 t)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1473 (if var
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1474 (list (vector (format "Print Value of `%s'" var)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1475 (list 'gdb-mouse-print-variable var-e)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1476 t)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1477 (vector (format "Print Type of `%s'" var)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1478 (list 'gdb-mouse-print-variable-type var-e)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1479 t)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1480 (if name
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1481 (list (vector (format "Edit Definition of `%s'" name)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1482 (list 'gdb-mouse-edit-function event)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1483 t)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1484 (vector (format "Set Breakpoint on `%s'" name)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1485 (list 'gdb-menu-command (format "break %s" name) nil)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1486 t)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1487 (if loc
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1488 (list (vector (format "Visit Source Line (%s)" loc)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1489 (list 'gdb-mouse-edit-function-location event)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1490 t)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1491 (if type
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1492 (list (vector (format "Describe Type `%s'" type)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1493 (list 'gdb-menu-command (format "ptype %s" type) t)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1494 t)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1495 (if fnumber
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1496 (list (vector (format "Select Stack Frame %d" fnumber)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1497 (list 'gdb-menu-command (format "frame %d" fnumber) t)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1498 t)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1499 ))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1500
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1501
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1502 (defun gdb-popup-menu (event)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1503 "Pop up a context-sensitive menu of gdb-mode commands."
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1504 (interactive "_@e")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1505 (select-window (event-window event))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1506 (let (menu)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1507 (save-excursion
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1508 (setq menu (append (if (boundp 'gdb-popup-menu)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1509 (append (cdr gdb-popup-menu)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1510 '("---")))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1511 (if (boundp 'comint-popup-menu)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1512 (cdr comint-popup-menu))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1513 (let ((history (if (fboundp 'comint-make-history-menu)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1514 (comint-make-history-menu)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1515 (context (gdb-make-context-menu event)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1516 (if history
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1517 (setq menu
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1518 (append menu (list "---" (cons "Command History" history)))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1519 (if context
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1520 (setq menu (append context (cons "---" menu))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1521 )
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1522 (setq menu (cons (if (boundp 'gdb-popup-menu)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1523 (car gdb-popup-menu)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1524 "GDB Commands")
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1525 menu)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1526 (popup-menu menu event)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1527
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1528
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1529 ;;; Patch it in...
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1530
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1531 (or (fboundp 'gdb-highlight-orig-filter)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1532 (fset 'gdb-highlight-orig-filter (symbol-function 'gdb-filter)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1533
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1534 (defun gdb-highlight-filter (proc string)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1535 (let ((p (marker-position (process-mark proc))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1536 (prog1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1537 (gdb-highlight-orig-filter proc string)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1538
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1539 (save-match-data
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1540 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1541 ;; If there are no newlines in this string at all, then don't
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1542 ;; bother processing it -- we will pick up these characters on
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1543 ;; the next time around, when the line's newline gets inserted.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1544 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1545 (cond
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1546 ((string-match "\n" string)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1547 (save-excursion
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1548 (set-buffer (process-buffer proc))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1549 (goto-char p)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1550 (let ((p2 (marker-position (process-mark proc)))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1551 p3)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1552 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1553 ;; If gdb has given us a full pathname, remember it. (Do this
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1554 ;; before emitting any gdb-token extents, so that we attach it
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1555 ;; to the buffer *before* any of the extents to which it is
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1556 ;; known to correspond.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1557 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1558 (gdb-highlight-remember-directory)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1559 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1560 ;; Now highlight each line that has been written. If we wrote
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1561 ;; the last half of a line, re-highlight that whole line. (We
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1562 ;; need to do that so that the regexps will match properly;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1563 ;; the "\n" test above also depends on this behavior.)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1564 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1565 ;; But don't highlight lines longer than 5000 characters -- that
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1566 ;; probably means something is spewing, and we'll just get stuck
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1567 ;; hard in the regexp matcher.
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1568 ;;
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1569 (beginning-of-line)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1570 (while (< (point) p2)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1571 (goto-char (prog1
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1572 (point)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1573 (forward-line 1)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1574 (setq p3 (point))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1575 (if (< (- p3 (point)) 5000)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1576 (gdb-highlight-line))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1577 (goto-char p3))))))))))
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1578
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1579 (fset 'gdb-filter 'gdb-highlight-filter)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1580
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1581
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1582 (provide 'gdb-highlight)
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1583
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1584 ;;; gdb-highlight.el ends here
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1585
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1586 --------------4273DDB4BB90CEC3B645B5AC--
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1587
43dd3413c7c7 Import from CVS: tag r20-3b4
cvs
parents:
diff changeset
1588