Mercurial > emacs
annotate lisp/progmodes/gdb-mi.el @ 110577:71576987bc2d
* files.el (get-free-disk-space): Don't assume "df" output columns line up (Bug#6995).
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sat, 25 Sep 2010 16:16:35 -0400 |
parents | 93141d34a175 |
children | f2a5b5a7f017 |
rev | line source |
---|---|
107550
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1 ;;; gdb-mi.el --- User Interface for running GDB |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2 |
107552
d9250f687548
* gdb-mi.el: Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents:
107550
diff
changeset
|
3 ;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
107550
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
5 ;; Author: Nick Roberts <nickrob@gnu.org> |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
6 ;; Maintainer: FSF |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
7 ;; Keywords: unix, tools |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
8 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
10 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
11 ;; Homepage: http://www.emacswiki.org/emacs/GDB-MI |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
12 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
13 ;; GNU Emacs is free software: you can redistribute it and/or modify |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
14 ;; it under the terms of the GNU General Public License as published by |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
15 ;; the Free Software Foundation, either version 3 of the License, or |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
16 ;; (at your option) any later version. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
17 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
18 ;; GNU Emacs is distributed in the hope that it will be useful, |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
21 ;; GNU General Public License for more details. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
22 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
23 ;; You should have received a copy of the GNU General Public License |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
25 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
26 ;;; Credits: |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
27 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
28 ;; This file was written by by Nick Roberts following the general design |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
29 ;; used in gdb-ui.el for Emacs 22.1 - 23.1. It is currently being developed |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
30 ;; by Dmitry Dzhus <dima@sphinx.net.ru> as part of the Google Summer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
31 ;; of Code 2009 Project "Emacs GDB/MI migration". |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
32 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
33 ;;; Commentary: |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
34 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
35 ;; This mode acts as a graphical user interface to GDB. You can interact with |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
36 ;; GDB through the GUD buffer in the usual way, but there are also further |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
37 ;; buffers which control the execution and describe the state of your program. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
38 ;; It separates the input/output of your program from that of GDB and displays |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
39 ;; expressions and their current values in their own buffers. It also uses |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
40 ;; features of Emacs 21 such as the fringe/display margin for breakpoints, and |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
41 ;; the toolbar (see the GDB Graphical Interface section in the Emacs info |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
42 ;; manual). |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
43 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
44 ;; M-x gdb will start the debugger. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
45 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
46 ;; This file uses GDB/MI as the primary interface to GDB. It is still under |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
47 ;; development and is part of a process to migrate Emacs from annotations (as |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
48 ;; used in gdb-ui.el) to GDB/MI. It runs gdb with GDB/MI (-interp=mi) and |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
49 ;; access CLI using "-interpreter-exec console cli-command". This code works |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
50 ;; without gdb-ui.el and uses MI tokens instead of queues. Eventually MI |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
51 ;; should be asynchronous. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
52 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
53 ;; This mode will PARTLY WORK WITH RECENT GDB RELEASES (status in modeline |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
54 ;; doesn't update properly when execution commands are issued from GUD buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
55 ;; and WORKS BEST when GDB runs asynchronously: maint set linux-async on. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
56 ;; |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
57 ;; You need development version of GDB 7.0 for the thread buffer to work. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
58 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
59 ;; This file replaces gdb-ui.el and is for development with GDB. Use the |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
60 ;; release branch of Emacs 22 for the latest version of gdb-ui.el. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
61 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
62 ;; Windows Platforms: |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
63 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
64 ;; If you are using Emacs and GDB on Windows you will need to flush the buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
65 ;; explicitly in your program if you want timely display of I/O in Emacs. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
66 ;; Alternatively you can make the output stream unbuffered, for example, by |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
67 ;; using a macro: |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
68 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
69 ;; #ifdef UNBUFFERED |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
70 ;; setvbuf (stdout, (char *) NULL, _IONBF, 0); |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
71 ;; #endif |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
72 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
73 ;; and compiling with -DUNBUFFERED while debugging. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
74 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
75 ;; If you are using Cygwin GDB and find that the source is not being displayed |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
76 ;; in Emacs when you step through it, possible solutions are to: |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
77 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
78 ;; 1) Use Cygwin X Windows and Cygwin Emacs. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
79 ;; (Since 22.1 Emacs builds under Cygwin.) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
80 ;; 2) Use MinGW GDB instead. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
81 ;; 3) Use cygwin-mount.el |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
82 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
83 ;;; Mac OSX: |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
84 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
85 ;; GDB in Emacs on Mac OSX works best with FSF GDB as Apple have made |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
86 ;; some changes to the version that they include as part of Mac OSX. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
87 ;; This requires GDB version 7.0 or later (estimated release date Aug 2009) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
88 ;; as earlier versions don not compile on Mac OSX. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
89 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
90 ;;; Known Bugs: |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
91 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
92 ;; 1) Stack buffer doesn't parse MI output if you stop in a routine without |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
93 ;; line information, e.g., a routine in libc (just a TODO item). |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
94 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
95 ;; TODO: |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
96 ;; 2) Watch windows to work with threads. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
97 ;; 3) Use treebuffer.el instead of the speedbar for watch-expressions? |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
98 ;; 4) Mark breakpoint locations on scroll-bar of source buffer? |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
99 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
100 ;;; Code: |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
101 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
102 (require 'gud) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
103 (require 'json) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
104 (require 'bindat) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
105 (eval-when-compile (require 'cl)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
106 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
107 (defvar tool-bar-map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
108 (defvar speedbar-initial-expansion-list-name) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
109 (defvar speedbar-frame) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
110 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
111 (defvar gdb-memory-address "main") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
112 (defvar gdb-memory-last-address nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
113 "Last successfully accessed memory address.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
114 (defvar gdb-memory-next-page nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
115 "Address of next memory page for program memory buffer.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
116 (defvar gdb-memory-prev-page nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
117 "Address of previous memory page for program memory buffer.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
118 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
119 (defvar gdb-thread-number nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
120 "Main current thread. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
121 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
122 Invalidation triggers use this variable to query GDB for |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
123 information on the specified thread by wrapping GDB/MI commands |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
124 in `gdb-current-context-command'. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
125 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
126 This variable may be updated implicitly by GDB via `gdb-stopped' |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
127 or explicitly by `gdb-select-thread'. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
128 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
129 Only `gdb-setq-thread-number' should be used to change this |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
130 value.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
131 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
132 (defvar gdb-frame-number nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
133 "Selected frame level for main current thread. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
134 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
135 Updated according to the following rules: |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
136 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
137 When a thread is selected or current thread stops, set to \"0\". |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
138 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
139 When current thread goes running (and possibly exits eventually), |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
140 set to nil. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
141 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
142 May be manually changed by user with `gdb-select-frame'.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
143 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
144 (defvar gdb-frame-address nil "Identity of frame for watch expression.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
145 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
146 ;; Used to show overlay arrow in source buffer. All set in |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
147 ;; gdb-get-main-selected-frame. Disassembly buffer should not use |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
148 ;; these but rely on buffer-local thread information instead. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
149 (defvar gdb-selected-frame nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
150 "Name of selected function for main current thread.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
151 (defvar gdb-selected-file nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
152 "Name of selected file for main current thread.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
153 (defvar gdb-selected-line nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
154 "Number of selected line for main current thread.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
155 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
156 (defvar gdb-threads-list nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
157 "Associative list of threads provided by \"-thread-info\" MI command. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
158 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
159 Keys are thread numbers (in strings) and values are structures as |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
160 returned from -thread-info by `gdb-json-partial-output'. Updated in |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
161 `gdb-thread-list-handler-custom'.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
162 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
163 (defvar gdb-running-threads-count nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
164 "Number of currently running threads. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
165 |
110561 | 166 If nil, no information is available. |
107550
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
167 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
168 Updated in `gdb-thread-list-handler-custom'.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
169 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
170 (defvar gdb-stopped-threads-count nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
171 "Number of currently stopped threads. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
172 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
173 See also `gdb-running-threads-count'.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
174 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
175 (defvar gdb-breakpoints-list nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
176 "Associative list of breakpoints provided by \"-break-list\" MI command. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
177 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
178 Keys are breakpoint numbers (in string) and values are structures |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
179 as returned from \"-break-list\" by `gdb-json-partial-output' |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
180 \(\"body\" field is used). Updated in |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
181 `gdb-breakpoints-list-handler-custom'.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
182 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
183 (defvar gdb-current-language nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
184 (defvar gdb-var-list nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
185 "List of variables in watch window. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
186 Each element has the form (VARNUM EXPRESSION NUMCHILD TYPE VALUE STATUS HAS_MORE FP) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
187 where STATUS is nil (`unchanged'), `changed' or `out-of-scope', FP the frame |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
188 address for root variables.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
189 (defvar gdb-main-file nil "Source file from which program execution begins.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
190 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
191 ;; Overlay arrow markers |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
192 (defvar gdb-stack-position nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
193 (defvar gdb-thread-position nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
194 (defvar gdb-disassembly-position nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
195 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
196 (defvar gdb-location-alist nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
197 "Alist of breakpoint numbers and full filenames. Only used for files that |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
198 Emacs can't find.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
199 (defvar gdb-active-process nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
200 "GUD tooltips display variable values when t, and macro definitions otherwise.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
201 (defvar gdb-error "Non-nil when GDB is reporting an error.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
202 (defvar gdb-macro-info nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
203 "Non-nil if GDB knows that the inferior includes preprocessor macro info.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
204 (defvar gdb-register-names nil "List of register names.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
205 (defvar gdb-changed-registers nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
206 "List of changed register numbers (strings).") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
207 (defvar gdb-buffer-fringe-width nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
208 (defvar gdb-last-command nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
209 (defvar gdb-prompt-name nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
210 (defvar gdb-token-number 0) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
211 (defvar gdb-handler-alist '()) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
212 (defvar gdb-handler-number nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
213 (defvar gdb-source-file-list nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
214 "List of source files for the current executable.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
215 (defvar gdb-first-done-or-error t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
216 (defvar gdb-source-window nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
217 (defvar gdb-inferior-status nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
218 (defvar gdb-continuation nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
219 (defvar gdb-version nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
220 (defvar gdb-filter-output nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
221 "Message to be shown in GUD console. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
222 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
223 This variable is updated in `gdb-done-or-error' and returned by |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
224 `gud-gdbmi-marker-filter'.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
225 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
226 (defvar gdb-non-stop nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
227 "Indicates whether current GDB session is using non-stop mode. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
228 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
229 It is initialized to `gdb-non-stop-setting' at the beginning of |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
230 every GDB session.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
231 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
232 (defvar gdb-buffer-type nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
233 "One of the symbols bound in `gdb-buffer-rules'.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
234 (make-variable-buffer-local 'gdb-buffer-type) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
235 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
236 (defvar gdb-output-sink 'nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
237 "The disposition of the output of the current gdb command. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
238 Possible values are these symbols: |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
239 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
240 `user' -- gdb output should be copied to the GUD buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
241 for the user to see. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
242 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
243 `emacs' -- output should be collected in the partial-output-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
244 for subsequent processing by a command. This is the |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
245 disposition of output generated by commands that |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
246 gdb mode sends to gdb on its own behalf.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
247 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
248 ;; Pending triggers prevent congestion: Emacs won't send two similar |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
249 ;; consecutive requests. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
250 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
251 (defvar gdb-pending-triggers '() |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
252 "A list of trigger functions which have not yet been handled. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
253 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
254 Elements are either function names or pairs (buffer . function)") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
255 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
256 (defmacro gdb-add-pending (item) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
257 `(push ,item gdb-pending-triggers)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
258 (defmacro gdb-pending-p (item) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
259 `(member ,item gdb-pending-triggers)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
260 (defmacro gdb-delete-pending (item) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
261 `(setq gdb-pending-triggers |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
262 (delete ,item gdb-pending-triggers))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
263 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
264 (defmacro gdb-wait-for-pending (&rest body) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
265 "Wait until `gdb-pending-triggers' is empty and evaluate FORM. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
266 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
267 This function checks `gdb-pending-triggers' value every |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
268 `gdb-wait-for-pending' seconds." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
269 (run-with-timer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
270 0.5 nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
271 `(lambda () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
272 (if (not gdb-pending-triggers) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
273 (progn ,@body) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
274 (gdb-wait-for-pending ,@body))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
275 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
276 ;; Publish-subscribe |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
277 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
278 (defmacro gdb-add-subscriber (publisher subscriber) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
279 "Register new PUBLISHER's SUBSCRIBER. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
280 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
281 SUBSCRIBER must be a pair, where cdr is a function of one |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
282 argument (see `gdb-emit-signal')." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
283 `(add-to-list ',publisher ,subscriber t)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
284 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
285 (defmacro gdb-delete-subscriber (publisher subscriber) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
286 "Unregister SUBSCRIBER from PUBLISHER." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
287 `(setq ,publisher (delete ,subscriber |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
288 ,publisher))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
289 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
290 (defun gdb-get-subscribers (publisher) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
291 publisher) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
292 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
293 (defun gdb-emit-signal (publisher &optional signal) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
294 "Call cdr for each subscriber of PUBLISHER with SIGNAL as argument." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
295 (dolist (subscriber (gdb-get-subscribers publisher)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
296 (funcall (cdr subscriber) signal))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
297 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
298 (defvar gdb-buf-publisher '() |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
299 "Used to invalidate GDB buffers by emitting a signal in |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
300 `gdb-update'. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
301 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
302 Must be a list of pairs with cars being buffers and cdr's being |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
303 valid signal handlers.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
304 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
305 (defgroup gdb nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
306 "GDB graphical interface" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
307 :group 'tools |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
308 :link '(info-link "(emacs)GDB Graphical Interface") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
309 :version "23.2") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
310 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
311 (defgroup gdb-non-stop nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
312 "GDB non-stop debugging settings" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
313 :group 'gdb |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
314 :version "23.2") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
315 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
316 (defgroup gdb-buffers nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
317 "GDB buffers" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
318 :group 'gdb |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
319 :version "23.2") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
320 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
321 (defcustom gdb-debug-log-max 128 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
322 "Maximum size of `gdb-debug-log'. If nil, size is unlimited." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
323 :group 'gdb |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
324 :type '(choice (integer :tag "Number of elements") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
325 (const :tag "Unlimited" nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
326 :version "22.1") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
327 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
328 (defcustom gdb-non-stop-setting t |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
329 "When in non-stop mode, stopped threads can be examined while |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
330 other threads continue to execute. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
331 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
332 GDB session needs to be restarted for this setting to take |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
333 effect." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
334 :type 'boolean |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
335 :group 'gdb-non-stop |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
336 :version "23.2") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
337 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
338 ;; TODO Some commands can't be called with --all (give a notice about |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
339 ;; it in setting doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
340 (defcustom gdb-gud-control-all-threads t |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
341 "When enabled, GUD execution commands affect all threads when |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
342 in non-stop mode. Otherwise, only current thread is affected." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
343 :type 'boolean |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
344 :group 'gdb-non-stop |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
345 :version "23.2") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
346 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
347 (defcustom gdb-switch-reasons t |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
348 "List of stop reasons which cause Emacs to switch to the thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
349 which caused the stop. When t, switch to stopped thread no matter |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
350 what the reason was. When nil, never switch to stopped thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
351 automatically. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
352 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
353 This setting is used in non-stop mode only. In all-stop mode, |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
354 Emacs always switches to the thread which caused the stop." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
355 ;; exited, exited-normally and exited-signalled are not |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
356 ;; thread-specific stop reasons and therefore are not included in |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
357 ;; this list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
358 :type '(choice |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
359 (const :tag "All reasons" t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
360 (set :tag "Selection of reasons..." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
361 (const :tag "A breakpoint was reached." "breakpoint-hit") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
362 (const :tag "A watchpoint was triggered." "watchpoint-trigger") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
363 (const :tag "A read watchpoint was triggered." "read-watchpoint-trigger") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
364 (const :tag "An access watchpoint was triggered." "access-watchpoint-trigger") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
365 (const :tag "Function finished execution." "function-finished") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
366 (const :tag "Location reached." "location-reached") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
367 (const :tag "Watchpoint has gone out of scope" "watchpoint-scope") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
368 (const :tag "End of stepping range reached." "end-stepping-range") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
369 (const :tag "Signal received (like interruption)." "signal-received")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
370 (const :tag "None" nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
371 :group 'gdb-non-stop |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
372 :version "23.2" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
373 :link '(info-link "(gdb)GDB/MI Async Records")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
374 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
375 (defcustom gdb-stopped-hooks nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
376 "This variable holds a list of functions to be called whenever |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
377 GDB stops. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
378 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
379 Each function takes one argument, a parsed MI response, which |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
380 contains fields of corresponding MI *stopped async record: |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
381 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
382 ((stopped-threads . \"all\") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
383 (thread-id . \"1\") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
384 (frame (line . \"38\") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
385 (fullname . \"/home/sphinx/projects/gsoc/server.c\") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
386 (file . \"server.c\") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
387 (args ((value . \"0x804b038\") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
388 (name . \"arg\"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
389 (func . \"hello\") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
390 (addr . \"0x0804869e\")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
391 (reason . \"end-stepping-range\")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
392 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
393 Note that \"reason\" is only present in non-stop debugging mode. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
394 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
395 `bindat-get-field' may be used to access the fields of response. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
396 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
397 Each function is called after the new current thread was selected |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
398 and GDB buffers were updated in `gdb-stopped'." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
399 :type '(repeat function) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
400 :group 'gdb |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
401 :version "23.2" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
402 :link '(info-link "(gdb)GDB/MI Async Records")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
403 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
404 (defcustom gdb-switch-when-another-stopped t |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
405 "When nil, Emacs won't switch to stopped thread if some other |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
406 stopped thread is already selected." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
407 :type 'boolean |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
408 :group 'gdb-non-stop |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
409 :version "23.2") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
410 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
411 (defcustom gdb-stack-buffer-locations t |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
412 "Show file information or library names in stack buffers." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
413 :type 'boolean |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
414 :group 'gdb-buffers |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
415 :version "23.2") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
416 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
417 (defcustom gdb-stack-buffer-addresses nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
418 "Show frame addresses in stack buffers." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
419 :type 'boolean |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
420 :group 'gdb-buffers |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
421 :version "23.2") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
422 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
423 (defcustom gdb-thread-buffer-verbose-names t |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
424 "Show long thread names in threads buffer." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
425 :type 'boolean |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
426 :group 'gdb-buffers |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
427 :version "23.2") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
428 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
429 (defcustom gdb-thread-buffer-arguments t |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
430 "Show function arguments in threads buffer." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
431 :type 'boolean |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
432 :group 'gdb-buffers |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
433 :version "23.2") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
434 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
435 (defcustom gdb-thread-buffer-locations t |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
436 "Show file information or library names in threads buffer." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
437 :type 'boolean |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
438 :group 'gdb-buffers |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
439 :version "23.2") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
440 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
441 (defcustom gdb-thread-buffer-addresses nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
442 "Show addresses for thread frames in threads buffer." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
443 :type 'boolean |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
444 :group 'gdb-buffers |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
445 :version "23.2") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
446 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
447 (defcustom gdb-show-threads-by-default nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
448 "Show threads list buffer instead of breakpoints list by |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
449 default." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
450 :type 'boolean |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
451 :group 'gdb-buffers |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
452 :version "23.2") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
453 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
454 (defvar gdb-debug-log nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
455 "List of commands sent to and replies received from GDB. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
456 Most recent commands are listed first. This list stores only the last |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
457 `gdb-debug-log-max' values. This variable is used to debug GDB-MI.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
458 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
459 ;;;###autoload |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
460 (defcustom gdb-enable-debug nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
461 "Non-nil means record the process input and output in `gdb-debug-log'." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
462 :type 'boolean |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
463 :group 'gdb |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
464 :version "22.1") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
465 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
466 (defcustom gdb-cpp-define-alist-program "gcc -E -dM -" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
467 "Shell command for generating a list of defined macros in a source file. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
468 This list is used to display the #define directive associated |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
469 with an identifier as a tooltip. It works in a debug session with |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
470 GDB, when `gud-tooltip-mode' is t. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
471 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
472 Set `gdb-cpp-define-alist-flags' for any include paths or |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
473 predefined macros." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
474 :type 'string |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
475 :group 'gdb |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
476 :version "22.1") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
477 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
478 (defcustom gdb-cpp-define-alist-flags "" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
479 "Preprocessor flags for `gdb-cpp-define-alist-program'." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
480 :type 'string |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
481 :group 'gdb |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
482 :version "22.1") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
483 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
484 (defcustom gdb-create-source-file-list t |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
485 "Non-nil means create a list of files from which the executable was built. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
486 Set this to nil if the GUD buffer displays \"initializing...\" in the mode |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
487 line for a long time when starting, possibly because your executable was |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
488 built from a large number of files. This allows quicker initialization |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
489 but means that these files are not automatically enabled for debugging, |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
490 e.g., you won't be able to click in the fringe to set a breakpoint until |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
491 execution has already stopped there." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
492 :type 'boolean |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
493 :group 'gdb |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
494 :version "23.1") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
495 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
496 (defcustom gdb-show-main nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
497 "Non-nil means display source file containing the main routine at startup. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
498 Also display the main routine in the disassembly buffer if present." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
499 :type 'boolean |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
500 :group 'gdb |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
501 :version "22.1") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
502 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
503 (defun gdb-force-mode-line-update (status) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
504 (let ((buffer gud-comint-buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
505 (if (and buffer (buffer-name buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
506 (with-current-buffer buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
507 (setq mode-line-process |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
508 (format ":%s [%s]" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
509 (process-status (get-buffer-process buffer)) status)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
510 ;; Force mode line redisplay soon. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
511 (force-mode-line-update))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
512 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
513 (defun gdb-enable-debug (arg) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
514 "Toggle logging of transaction between Emacs and Gdb. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
515 The log is stored in `gdb-debug-log' as an alist with elements |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
516 whose cons is send, send-item or recv and whose cdr is the string |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
517 being transferred. This list may grow up to a size of |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
518 `gdb-debug-log-max' after which the oldest element (at the end of |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
519 the list) is deleted every time a new one is added (at the front)." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
520 (interactive "P") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
521 (setq gdb-enable-debug |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
522 (if (null arg) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
523 (not gdb-enable-debug) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
524 (> (prefix-numeric-value arg) 0))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
525 (message (format "Logging of transaction %sabled" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
526 (if gdb-enable-debug "en" "dis")))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
527 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
528 ;; These two are used for menu and toolbar |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
529 (defun gdb-control-all-threads () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
530 "Switch to non-stop/A mode." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
531 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
532 (setq gdb-gud-control-all-threads t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
533 ;; Actually forcing the tool-bar to update. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
534 (force-mode-line-update) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
535 (message "Now in non-stop/A mode.")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
536 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
537 (defun gdb-control-current-thread () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
538 "Switch to non-stop/T mode." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
539 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
540 (setq gdb-gud-control-all-threads nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
541 ;; Actually forcing the tool-bar to update. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
542 (force-mode-line-update) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
543 (message "Now in non-stop/T mode.")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
544 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
545 (defun gdb-find-watch-expression () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
546 (let* ((var (nth (- (line-number-at-pos (point)) 2) gdb-var-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
547 (varnum (car var)) expr array) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
548 (string-match "\\(var[0-9]+\\)\\.\\(.*\\)" varnum) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
549 (let ((var1 (assoc (match-string 1 varnum) gdb-var-list)) var2 varnumlet |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
550 (component-list (split-string (match-string 2 varnum) "\\." t))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
551 (setq expr (nth 1 var1)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
552 (setq varnumlet (car var1)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
553 (dolist (component component-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
554 (setq var2 (assoc varnumlet gdb-var-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
555 (setq expr (concat expr |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
556 (if (string-match ".*\\[[0-9]+\\]$" (nth 3 var2)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
557 (concat "[" component "]") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
558 (concat "." component)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
559 (setq varnumlet (concat varnumlet "." component))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
560 expr))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
561 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
562 ;; noall is used for commands which don't take --all, but only |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
563 ;; --thread. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
564 (defun gdb-gud-context-command (command &optional noall) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
565 "When `gdb-non-stop' is t, add --thread option to COMMAND if |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
566 `gdb-gud-control-all-threads' is nil and --all option otherwise. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
567 If NOALL is t, always add --thread option no matter what |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
568 `gdb-gud-control-all-threads' value is. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
569 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
570 When `gdb-non-stop' is nil, return COMMAND unchanged." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
571 (if gdb-non-stop |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
572 (if (and gdb-gud-control-all-threads |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
573 (not noall) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
574 (string-equal gdb-version "7.0+")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
575 (concat command " --all ") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
576 (gdb-current-context-command command)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
577 command)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
578 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
579 (defmacro gdb-gud-context-call (cmd1 &optional cmd2 noall noarg) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
580 "`gud-call' wrapper which adds --thread/--all options between |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
581 CMD1 and CMD2. NOALL is the same as in `gdb-gud-context-command'. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
582 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
583 NOARG must be t when this macro is used outside `gud-def'" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
584 `(gud-call |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
585 (concat (gdb-gud-context-command ,cmd1 ,noall) " " ,cmd2) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
586 ,(when (not noarg) 'arg))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
587 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
588 ;;;###autoload |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
589 (defun gdb (command-line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
590 "Run gdb on program FILE in buffer *gud-FILE*. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
591 The directory containing FILE becomes the initial working directory |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
592 and source-file directory for your debugger. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
593 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
594 If `gdb-many-windows' is nil (the default value) then gdb just |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
595 pops up the GUD buffer unless `gdb-show-main' is t. In this case |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
596 it starts with two windows: one displaying the GUD buffer and the |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
597 other with the source file with the main routine of the inferior. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
598 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
599 If `gdb-many-windows' is t, regardless of the value of |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
600 `gdb-show-main', the layout below will appear. Keybindings are |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
601 shown in some of the buffers. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
602 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
603 Watch expressions appear in the speedbar/slowbar. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
604 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
605 The following commands help control operation : |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
606 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
607 `gdb-many-windows' - Toggle the number of windows gdb uses. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
608 `gdb-restore-windows' - To restore the window layout. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
609 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
610 See Info node `(emacs)GDB Graphical Interface' for a more |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
611 detailed description of this mode. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
612 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
613 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
614 +----------------------------------------------------------------------+ |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
615 | GDB Toolbar | |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
616 +-----------------------------------+----------------------------------+ |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
617 | GUD buffer (I/O of GDB) | Locals buffer | |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
618 | | | |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
619 | | | |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
620 | | | |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
621 +-----------------------------------+----------------------------------+ |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
622 | Source buffer | I/O buffer (of debugged program) | |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
623 | | (comint-mode) | |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
624 | | | |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
625 | | | |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
626 | | | |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
627 | | | |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
628 | | | |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
629 | | | |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
630 +-----------------------------------+----------------------------------+ |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
631 | Stack buffer | Breakpoints buffer | |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
632 | RET gdb-select-frame | SPC gdb-toggle-breakpoint | |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
633 | | RET gdb-goto-breakpoint | |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
634 | | D gdb-delete-breakpoint | |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
635 +-----------------------------------+----------------------------------+" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
636 ;; |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
637 (interactive (list (gud-query-cmdline 'gdb))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
638 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
639 (when (and gud-comint-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
640 (buffer-name gud-comint-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
641 (get-buffer-process gud-comint-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
642 (with-current-buffer gud-comint-buffer (eq gud-minor-mode 'gdba))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
643 (gdb-restore-windows) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
644 (error |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
645 "Multiple debugging requires restarting in text command mode")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
646 ;; |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
647 (gud-common-init command-line nil 'gud-gdbmi-marker-filter) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
648 (set (make-local-variable 'gud-minor-mode) 'gdbmi) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
649 (setq comint-input-sender 'gdb-send) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
650 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
651 (gud-def gud-tbreak "tbreak %f:%l" "\C-t" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
652 "Set temporary breakpoint at current line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
653 (gud-def gud-jump |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
654 (progn (gud-call "tbreak %f:%l") (gud-call "jump %f:%l")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
655 "\C-j" "Set execution address to current line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
656 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
657 (gud-def gud-up "up %p" "<" "Up N stack frames (numeric arg).") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
658 (gud-def gud-down "down %p" ">" "Down N stack frames (numeric arg).") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
659 (gud-def gud-print "print %e" "\C-p" "Evaluate C expression at point.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
660 (gud-def gud-pstar "print* %e" nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
661 "Evaluate C dereferenced pointer expression at point.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
662 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
663 (gud-def gud-step (gdb-gud-context-call "-exec-step" "%p" t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
664 "\C-s" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
665 "Step one source line with display.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
666 (gud-def gud-stepi (gdb-gud-context-call "-exec-step-instruction" "%p" t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
667 "\C-i" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
668 "Step one instruction with display.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
669 (gud-def gud-next (gdb-gud-context-call "-exec-next" "%p" t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
670 "\C-n" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
671 "Step one line (skip functions).") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
672 (gud-def gud-nexti (gdb-gud-context-call "-exec-next-instruction" "%p" t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
673 nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
674 "Step one instruction (skip functions).") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
675 (gud-def gud-cont (gdb-gud-context-call "-exec-continue") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
676 "\C-r" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
677 "Continue with display.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
678 (gud-def gud-finish (gdb-gud-context-call "-exec-finish" nil t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
679 "\C-f" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
680 "Finish executing current function.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
681 (gud-def gud-run "-exec-run" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
682 nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
683 "Run the program.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
684 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
685 (gud-def gud-break (if (not (string-match "Disassembly" mode-name)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
686 (gud-call "break %f:%l" arg) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
687 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
688 (beginning-of-line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
689 (forward-char 2) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
690 (gud-call "break *%a" arg))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
691 "\C-b" "Set breakpoint at current line or address.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
692 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
693 (gud-def gud-remove (if (not (string-match "Disassembly" mode-name)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
694 (gud-call "clear %f:%l" arg) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
695 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
696 (beginning-of-line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
697 (forward-char 2) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
698 (gud-call "clear *%a" arg))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
699 "\C-d" "Remove breakpoint at current line or address.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
700 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
701 ;; -exec-until doesn't support --all yet |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
702 (gud-def gud-until (if (not (string-match "Disassembly" mode-name)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
703 (gud-call "-exec-until %f:%l" arg) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
704 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
705 (beginning-of-line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
706 (forward-char 2) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
707 (gud-call "-exec-until *%a" arg))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
708 "\C-u" "Continue to current line or address.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
709 ;; TODO Why arg here? |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
710 (gud-def |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
711 gud-go (gud-call (if gdb-active-process |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
712 (gdb-gud-context-command "-exec-continue") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
713 "-exec-run") arg) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
714 nil "Start or continue execution.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
715 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
716 ;; For debugging Emacs only. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
717 (gud-def gud-pp |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
718 (gud-call |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
719 (concat |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
720 "pp1 " (if (eq (buffer-local-value |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
721 'major-mode (window-buffer)) 'speedbar-mode) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
722 (gdb-find-watch-expression) "%e")) arg) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
723 nil "Print the Emacs s-expression.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
724 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
725 (define-key gud-minor-mode-map [left-margin mouse-1] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
726 'gdb-mouse-set-clear-breakpoint) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
727 (define-key gud-minor-mode-map [left-fringe mouse-1] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
728 'gdb-mouse-set-clear-breakpoint) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
729 (define-key gud-minor-mode-map [left-margin C-mouse-1] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
730 'gdb-mouse-toggle-breakpoint-margin) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
731 (define-key gud-minor-mode-map [left-fringe C-mouse-1] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
732 'gdb-mouse-toggle-breakpoint-fringe) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
733 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
734 (define-key gud-minor-mode-map [left-margin drag-mouse-1] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
735 'gdb-mouse-until) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
736 (define-key gud-minor-mode-map [left-fringe drag-mouse-1] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
737 'gdb-mouse-until) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
738 (define-key gud-minor-mode-map [left-margin mouse-3] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
739 'gdb-mouse-until) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
740 (define-key gud-minor-mode-map [left-fringe mouse-3] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
741 'gdb-mouse-until) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
742 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
743 (define-key gud-minor-mode-map [left-margin C-drag-mouse-1] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
744 'gdb-mouse-jump) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
745 (define-key gud-minor-mode-map [left-fringe C-drag-mouse-1] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
746 'gdb-mouse-jump) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
747 (define-key gud-minor-mode-map [left-fringe C-mouse-3] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
748 'gdb-mouse-jump) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
749 (define-key gud-minor-mode-map [left-margin C-mouse-3] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
750 'gdb-mouse-jump) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
751 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
752 (local-set-key "\C-i" 'gud-gdb-complete-command) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
753 (setq gdb-first-prompt t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
754 (setq gud-running nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
755 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
756 (gdb-update) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
757 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
758 (run-hooks 'gdb-mode-hook)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
759 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
760 (defun gdb-init-1 () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
761 ;; (re-)initialise |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
762 (setq gdb-selected-frame nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
763 gdb-frame-number nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
764 gdb-thread-number nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
765 gdb-var-list nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
766 gdb-pending-triggers nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
767 gdb-output-sink 'user |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
768 gdb-location-alist nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
769 gdb-source-file-list nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
770 gdb-last-command nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
771 gdb-token-number 0 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
772 gdb-handler-alist '() |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
773 gdb-handler-number nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
774 gdb-prompt-name nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
775 gdb-first-done-or-error t |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
776 gdb-buffer-fringe-width (car (window-fringes)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
777 gdb-debug-log nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
778 gdb-source-window nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
779 gdb-inferior-status nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
780 gdb-continuation nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
781 gdb-buf-publisher '() |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
782 gdb-threads-list '() |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
783 gdb-breakpoints-list '() |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
784 gdb-register-names '() |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
785 gdb-non-stop gdb-non-stop-setting) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
786 ;; |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
787 (setq gdb-buffer-type 'gdbmi) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
788 ;; |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
789 (gdb-force-mode-line-update |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
790 (propertize "initializing..." 'face font-lock-variable-name-face)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
791 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
792 (gdb-get-buffer-create 'gdb-inferior-io) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
793 (gdb-clear-inferior-io) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
794 (set-process-filter (get-process "gdb-inferior") 'gdb-inferior-filter) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
795 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
796 ;; Needs GDB 6.4 onwards |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
797 (list (concat "-inferior-tty-set " |
109577
8a7bf813ce36
* net/tramp.el (tramp-handle-start-file-process): Check only for
Michael Albinus <michael.albinus@gmx.de>
parents:
107552
diff
changeset
|
798 (or |
8a7bf813ce36
* net/tramp.el (tramp-handle-start-file-process): Check only for
Michael Albinus <michael.albinus@gmx.de>
parents:
107552
diff
changeset
|
799 ;; The process can run on a remote host. |
8a7bf813ce36
* net/tramp.el (tramp-handle-start-file-process): Check only for
Michael Albinus <michael.albinus@gmx.de>
parents:
107552
diff
changeset
|
800 (process-get (get-process "gdb-inferior") 'remote-tty) |
8a7bf813ce36
* net/tramp.el (tramp-handle-start-file-process): Check only for
Michael Albinus <michael.albinus@gmx.de>
parents:
107552
diff
changeset
|
801 (process-tty-name (get-process "gdb-inferior")))) |
107550
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
802 'ignore)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
803 (if (eq window-system 'w32) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
804 (gdb-input (list "-gdb-set new-console off" 'ignore))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
805 (gdb-input (list "-gdb-set height 0" 'ignore)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
806 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
807 (when gdb-non-stop |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
808 (gdb-input (list "-gdb-set non-stop 1" 'gdb-non-stop-handler))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
809 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
810 ;; find source file and compilation directory here |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
811 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
812 ; Needs GDB 6.2 onwards. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
813 (list "-file-list-exec-source-files" 'gdb-get-source-file-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
814 (if gdb-create-source-file-list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
815 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
816 ; Needs GDB 6.0 onwards. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
817 (list "-file-list-exec-source-file" 'gdb-get-source-file))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
818 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
819 (list "-gdb-show prompt" 'gdb-get-prompt))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
820 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
821 (defun gdb-non-stop-handler () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
822 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
823 (if (re-search-forward "No symbol" nil t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
824 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
825 (message "This version of GDB doesn't support non-stop mode. Turning it off.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
826 (setq gdb-non-stop nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
827 (setq gdb-version "pre-7.0")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
828 (setq gdb-version "7.0+") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
829 (gdb-input (list "-gdb-set target-async 1" 'ignore)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
830 (gdb-input (list "-enable-pretty-printing" 'ignore)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
831 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
832 (defvar gdb-define-alist nil "Alist of #define directives for GUD tooltips.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
833 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
834 (defun gdb-create-define-alist () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
835 "Create an alist of #define directives for GUD tooltips." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
836 (let* ((file (buffer-file-name)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
837 (output |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
838 (with-output-to-string |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
839 (with-current-buffer standard-output |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
840 (and file |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
841 (file-exists-p file) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
842 ;; call-process doesn't work with remote file names. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
843 (not (file-remote-p default-directory)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
844 (call-process shell-file-name file |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
845 (list t nil) nil "-c" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
846 (concat gdb-cpp-define-alist-program " " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
847 gdb-cpp-define-alist-flags)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
848 (define-list (split-string output "\n" t)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
849 (name)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
850 (setq gdb-define-alist nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
851 (dolist (define define-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
852 (setq name (nth 1 (split-string define "[( ]"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
853 (push (cons name define) gdb-define-alist)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
854 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
855 (declare-function tooltip-show "tooltip" (text &optional use-echo-area)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
856 (defvar tooltip-use-echo-area) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
857 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
858 (defun gdb-tooltip-print (expr) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
859 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
860 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
861 (if (re-search-forward ".*value=\\(\".*\"\\)" nil t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
862 (tooltip-show |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
863 (concat expr " = " (read (match-string 1))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
864 (or gud-tooltip-echo-area tooltip-use-echo-area |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
865 (not (display-graphic-p))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
866 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
867 ;; If expr is a macro for a function don't print because of possible dangerous |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
868 ;; side-effects. Also printing a function within a tooltip generates an |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
869 ;; unexpected starting annotation (phase error). |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
870 (defun gdb-tooltip-print-1 (expr) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
871 (with-current-buffer (gdb-get-buffer 'gdb-partial-output-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
872 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
873 (if (search-forward "expands to: " nil t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
874 (unless (looking-at "\\S-+.*(.*).*") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
875 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
876 (list (concat "-data-evaluate-expression " expr) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
877 `(lambda () (gdb-tooltip-print ,expr)))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
878 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
879 (defun gdb-init-buffer () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
880 (set (make-local-variable 'gud-minor-mode) 'gdbmi) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
881 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
882 (when gud-tooltip-mode |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
883 (make-local-variable 'gdb-define-alist) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
884 (gdb-create-define-alist) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
885 (add-hook 'after-save-hook 'gdb-create-define-alist nil t))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
886 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
887 (defmacro gdb-if-arrow (arrow-position &rest body) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
888 `(if ,arrow-position |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
889 (let ((buffer (marker-buffer ,arrow-position)) (line)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
890 (if (equal buffer (window-buffer (posn-window end))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
891 (with-current-buffer buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
892 (when (or (equal start end) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
893 (equal (posn-point start) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
894 (marker-position ,arrow-position))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
895 ,@body)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
896 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
897 (defun gdb-mouse-until (event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
898 "Continue running until a source line past the current line. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
899 The destination source line can be selected either by clicking |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
900 with mouse-3 on the fringe/margin or dragging the arrow |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
901 with mouse-1 (default bindings)." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
902 (interactive "e") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
903 (let ((start (event-start event)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
904 (end (event-end event))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
905 (gdb-if-arrow gud-overlay-arrow-position |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
906 (setq line (line-number-at-pos (posn-point end))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
907 (gud-call (concat "until " (number-to-string line)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
908 (gdb-if-arrow gdb-disassembly-position |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
909 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
910 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
911 (forward-line (1- (line-number-at-pos (posn-point end)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
912 (forward-char 2) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
913 (gud-call (concat "until *%a")))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
914 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
915 (defun gdb-mouse-jump (event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
916 "Set execution address/line. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
917 The destination source line can be selected either by clicking with C-mouse-3 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
918 on the fringe/margin or dragging the arrow with C-mouse-1 (default bindings). |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
919 Unlike `gdb-mouse-until' the destination address can be before the current |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
920 line, and no execution takes place." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
921 (interactive "e") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
922 (let ((start (event-start event)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
923 (end (event-end event))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
924 (gdb-if-arrow gud-overlay-arrow-position |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
925 (setq line (line-number-at-pos (posn-point end))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
926 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
927 (gud-call (concat "tbreak " (number-to-string line))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
928 (gud-call (concat "jump " (number-to-string line))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
929 (gdb-if-arrow gdb-disassembly-position |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
930 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
931 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
932 (forward-line (1- (line-number-at-pos (posn-point end)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
933 (forward-char 2) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
934 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
935 (gud-call (concat "tbreak *%a")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
936 (gud-call (concat "jump *%a"))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
937 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
938 (defcustom gdb-show-changed-values t |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
939 "If non-nil change the face of out of scope variables and changed values. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
940 Out of scope variables are suppressed with `shadow' face. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
941 Changed values are highlighted with the face `font-lock-warning-face'." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
942 :type 'boolean |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
943 :group 'gdb |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
944 :version "22.1") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
945 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
946 (defcustom gdb-max-children 40 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
947 "Maximum number of children before expansion requires confirmation." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
948 :type 'integer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
949 :group 'gdb |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
950 :version "22.1") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
951 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
952 (defcustom gdb-delete-out-of-scope t |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
953 "If non-nil delete watch expressions automatically when they go out of scope." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
954 :type 'boolean |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
955 :group 'gdb |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
956 :version "22.2") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
957 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
958 (defcustom gdb-speedbar-auto-raise nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
959 "If non-nil raise speedbar every time display of watch expressions is\ |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
960 updated." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
961 :type 'boolean |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
962 :group 'gdb |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
963 :version "22.1") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
964 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
965 (defcustom gdb-use-colon-colon-notation nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
966 "If non-nil use FUN::VAR format to display variables in the speedbar." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
967 :type 'boolean |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
968 :group 'gdb |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
969 :version "22.1") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
970 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
971 (defun gdb-speedbar-auto-raise (arg) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
972 "Toggle automatic raising of the speedbar for watch expressions. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
973 With prefix argument ARG, automatically raise speedbar if ARG is |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
974 positive, otherwise don't automatically raise it." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
975 (interactive "P") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
976 (setq gdb-speedbar-auto-raise |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
977 (if (null arg) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
978 (not gdb-speedbar-auto-raise) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
979 (> (prefix-numeric-value arg) 0))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
980 (message (format "Auto raising %sabled" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
981 (if gdb-speedbar-auto-raise "en" "dis")))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
982 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
983 (define-key gud-minor-mode-map "\C-c\C-w" 'gud-watch) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
984 (define-key global-map (concat gud-key-prefix "\C-w") 'gud-watch) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
985 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
986 (declare-function tooltip-identifier-from-point "tooltip" (point)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
987 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
988 (defun gud-watch (&optional arg event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
989 "Watch expression at point. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
990 With arg, enter name of variable to be watched in the minibuffer." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
991 (interactive (list current-prefix-arg last-input-event)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
992 (let ((minor-mode (buffer-local-value 'gud-minor-mode gud-comint-buffer))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
993 (if (eq minor-mode 'gdbmi) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
994 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
995 (if event (posn-set-point (event-end event))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
996 (require 'tooltip) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
997 (save-selected-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
998 (let ((expr |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
999 (if arg |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1000 (completing-read "Name of variable: " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1001 'gud-gdb-complete-command) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1002 (if (and transient-mark-mode mark-active) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1003 (buffer-substring (region-beginning) (region-end)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1004 (concat (if (eq major-mode 'gdb-registers-mode) "$") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1005 (tooltip-identifier-from-point (point))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1006 (set-text-properties 0 (length expr) nil expr) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1007 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1008 (list (concat"-var-create - * " expr "") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1009 `(lambda () (gdb-var-create-handler ,expr))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1010 (message "gud-watch is a no-op in this mode.")))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1011 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1012 (defun gdb-var-create-handler (expr) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1013 (let* ((result (gdb-json-partial-output))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1014 (if (not (bindat-get-field result 'msg)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1015 (let ((var |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1016 (list (bindat-get-field result 'name) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1017 (if (and (string-equal gdb-current-language "c") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1018 gdb-use-colon-colon-notation gdb-selected-frame) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1019 (setq expr (concat gdb-selected-frame "::" expr)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1020 expr) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1021 (bindat-get-field result 'numchild) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1022 (bindat-get-field result 'type) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1023 (bindat-get-field result 'value) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1024 nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1025 (bindat-get-field result 'has_more) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1026 gdb-frame-address))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1027 (push var gdb-var-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1028 (speedbar 1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1029 (unless (string-equal |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1030 speedbar-initial-expansion-list-name "GUD") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1031 (speedbar-change-initial-expansion-list "GUD"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1032 (message-box "No symbol \"%s\" in current context." expr)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1033 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1034 (defun gdb-speedbar-update () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1035 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1036 (not (gdb-pending-p 'gdb-speedbar-timer))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1037 ;; Dummy command to update speedbar even when idle. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1038 (gdb-input (list "-environment-pwd" 'gdb-speedbar-timer-fn)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1039 ;; Keep gdb-pending-triggers non-nil till end. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1040 (gdb-add-pending 'gdb-speedbar-timer))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1041 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1042 (defun gdb-speedbar-timer-fn () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1043 (if gdb-speedbar-auto-raise |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1044 (raise-frame speedbar-frame)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1045 (gdb-delete-pending 'gdb-speedbar-timer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1046 (speedbar-timer-fn)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1047 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1048 (defun gdb-var-evaluate-expression-handler (varnum changed) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1049 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1050 (re-search-forward ".*value=\\(\".*\"\\)" nil t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1051 (let ((var (assoc varnum gdb-var-list))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1052 (when var |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1053 (if changed (setcar (nthcdr 5 var) 'changed)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1054 (setcar (nthcdr 4 var) (read (match-string 1))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1055 (gdb-speedbar-update)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1056 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1057 ; Uses "-var-list-children --all-values". Needs GDB 6.1 onwards. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1058 (defun gdb-var-list-children (varnum) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1059 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1060 (list (concat "-var-update " varnum) 'ignore)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1061 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1062 (list (concat "-var-list-children --all-values " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1063 varnum) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1064 `(lambda () (gdb-var-list-children-handler ,varnum))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1065 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1066 (defun gdb-var-list-children-handler (varnum) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1067 (let* ((var-list nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1068 (output (bindat-get-field (gdb-json-partial-output "child"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1069 (children (bindat-get-field output 'children))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1070 (catch 'child-already-watched |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1071 (dolist (var gdb-var-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1072 (if (string-equal varnum (car var)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1073 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1074 ;; With dynamic varobjs numchild may have increased. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1075 (setcar (nthcdr 2 var) (bindat-get-field output 'numchild)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1076 (push var var-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1077 (dolist (child children) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1078 (let ((varchild (list (bindat-get-field child 'name) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1079 (bindat-get-field child 'exp) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1080 (bindat-get-field child 'numchild) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1081 (bindat-get-field child 'type) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1082 (bindat-get-field child 'value) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1083 nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1084 (bindat-get-field child 'has_more)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1085 (if (assoc (car varchild) gdb-var-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1086 (throw 'child-already-watched nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1087 (push varchild var-list)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1088 (push var var-list))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1089 (setq gdb-var-list (nreverse var-list)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1090 (gdb-speedbar-update)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1091 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1092 (defun gdb-var-set-format (format) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1093 "Set the output format for a variable displayed in the speedbar." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1094 (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1095 (varnum (car var))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1096 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1097 (list (concat "-var-set-format " varnum " " format) 'ignore)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1098 (gdb-var-update))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1099 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1100 (defun gdb-var-delete-1 (var varnum) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1101 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1102 (list (concat "-var-delete " varnum) 'ignore)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1103 (setq gdb-var-list (delq var gdb-var-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1104 (dolist (varchild gdb-var-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1105 (if (string-match (concat (car var) "\\.") (car varchild)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1106 (setq gdb-var-list (delq varchild gdb-var-list))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1107 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1108 (defun gdb-var-delete () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1109 "Delete watch expression at point from the speedbar." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1110 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1111 (let ((text (speedbar-line-text))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1112 (string-match "\\(\\S-+\\)" text) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1113 (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1114 (varnum (car var))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1115 (if (string-match "\\." (car var)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1116 (message-box "Can only delete a root expression") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1117 (gdb-var-delete-1 var varnum))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1118 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1119 (defun gdb-var-delete-children (varnum) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1120 "Delete children of variable object at point from the speedbar." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1121 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1122 (list (concat "-var-delete -c " varnum) 'ignore))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1123 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1124 (defun gdb-edit-value (text token indent) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1125 "Assign a value to a variable displayed in the speedbar." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1126 (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1127 (varnum (car var)) (value)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1128 (setq value (read-string "New value: ")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1129 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1130 (list (concat "-var-assign " varnum " " value) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1131 `(lambda () (gdb-edit-value-handler ,value)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1132 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1133 (defconst gdb-error-regexp "\\^error,msg=\\(\".+\"\\)") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1134 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1135 (defun gdb-edit-value-handler (value) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1136 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1137 (if (re-search-forward gdb-error-regexp nil t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1138 (message-box "Invalid number or expression (%s)" value))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1139 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1140 ; Uses "-var-update --all-values". Needs GDB 6.4 onwards. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1141 (defun gdb-var-update () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1142 (if (not (gdb-pending-p 'gdb-var-update)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1143 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1144 (list "-var-update --all-values *" 'gdb-var-update-handler))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1145 (gdb-add-pending 'gdb-var-update)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1146 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1147 (defun gdb-var-update-handler () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1148 (let ((changelist (bindat-get-field (gdb-json-partial-output) 'changelist))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1149 (dolist (var gdb-var-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1150 (setcar (nthcdr 5 var) nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1151 (let ((temp-var-list gdb-var-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1152 (dolist (change changelist) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1153 (let* ((varnum (bindat-get-field change 'name)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1154 (var (assoc varnum gdb-var-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1155 (new-num (bindat-get-field change 'new_num_children))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1156 (when var |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1157 (let ((scope (bindat-get-field change 'in_scope)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1158 (has-more (bindat-get-field change 'has_more))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1159 (cond ((string-equal scope "false") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1160 (if gdb-delete-out-of-scope |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1161 (gdb-var-delete-1 var varnum) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1162 (setcar (nthcdr 5 var) 'out-of-scope))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1163 ((string-equal scope "true") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1164 (setcar (nthcdr 6 var) has-more) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1165 (when (and (or (not has-more) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1166 (string-equal has-more "0")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1167 (not new-num) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1168 (string-equal (nth 2 var) "0")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1169 (setcar (nthcdr 4 var) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1170 (bindat-get-field change 'value)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1171 (setcar (nthcdr 5 var) 'changed))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1172 ((string-equal scope "invalid") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1173 (gdb-var-delete-1 var varnum))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1174 (let ((var-list nil) var1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1175 (children (bindat-get-field change 'new_children))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1176 (if new-num |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1177 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1178 (setq var1 (pop temp-var-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1179 (while var1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1180 (if (string-equal varnum (car var1)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1181 (let ((new (string-to-number new-num)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1182 (previous (string-to-number (nth 2 var1)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1183 (setcar (nthcdr 2 var1) new-num) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1184 (push var1 var-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1185 (cond ((> new previous) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1186 ;; Add new children to list. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1187 (dotimes (dummy previous) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1188 (push (pop temp-var-list) var-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1189 (dolist (child children) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1190 (let ((varchild |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1191 (list (bindat-get-field child 'name) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1192 (bindat-get-field child 'exp) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1193 (bindat-get-field child 'numchild) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1194 (bindat-get-field child 'type) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1195 (bindat-get-field child 'value) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1196 'changed |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1197 (bindat-get-field child 'has_more)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1198 (push varchild var-list)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1199 ;; Remove deleted children from list. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1200 ((< new previous) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1201 (dotimes (dummy new) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1202 (push (pop temp-var-list) var-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1203 (dotimes (dummy (- previous new)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1204 (pop temp-var-list))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1205 (push var1 var-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1206 (setq var1 (pop temp-var-list))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1207 (setq gdb-var-list (nreverse var-list))))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1208 (setq gdb-pending-triggers |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1209 (delq 'gdb-var-update gdb-pending-triggers)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1210 (gdb-speedbar-update)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1211 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1212 (defun gdb-speedbar-expand-node (text token indent) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1213 "Expand the node the user clicked on. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1214 TEXT is the text of the button we clicked on, a + or - item. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1215 TOKEN is data related to this node. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1216 INDENT is the current indentation depth." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1217 (cond ((string-match "+" text) ;expand this node |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1218 (let* ((var (assoc token gdb-var-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1219 (expr (nth 1 var)) (children (nth 2 var))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1220 (if (or (<= (string-to-number children) gdb-max-children) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1221 (y-or-n-p |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1222 (format "%s has %s children. Continue? " expr children))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1223 (gdb-var-list-children token)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1224 ((string-match "-" text) ;contract this node |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1225 (dolist (var gdb-var-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1226 (if (string-match (concat token "\\.") (car var)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1227 (setq gdb-var-list (delq var gdb-var-list)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1228 (gdb-var-delete-children token) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1229 (speedbar-change-expand-button-char ?+) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1230 (speedbar-delete-subblock indent)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1231 (t (error "Ooops... not sure what to do"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1232 (speedbar-center-buffer-smartly)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1233 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1234 (defun gdb-get-target-string () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1235 (with-current-buffer gud-comint-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1236 gud-target-name)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1237 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1238 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1239 ;; |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1240 ;; gdb buffers. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1241 ;; |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1242 ;; Each buffer has a TYPE -- a symbol that identifies the function |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1243 ;; of that particular buffer. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1244 ;; |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1245 ;; The usual gdb interaction buffer is given the type `gdbmi' and |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1246 ;; is constructed specially. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1247 ;; |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1248 ;; Others are constructed by gdb-get-buffer-create and |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1249 ;; named according to the rules set forth in the gdb-buffer-rules |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1250 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1251 (defvar gdb-buffer-rules '()) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1252 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1253 (defun gdb-rules-name-maker (rules-entry) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1254 (cadr rules-entry)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1255 (defun gdb-rules-buffer-mode (rules-entry) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1256 (nth 2 rules-entry)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1257 (defun gdb-rules-update-trigger (rules-entry) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1258 (nth 3 rules-entry)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1259 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1260 (defun gdb-update-buffer-name () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1261 "Rename current buffer according to name-maker associated with |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1262 it in `gdb-buffer-rules'." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1263 (let ((f (gdb-rules-name-maker (assoc gdb-buffer-type |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1264 gdb-buffer-rules)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1265 (when f (rename-buffer (funcall f))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1266 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1267 (defun gdb-current-buffer-rules () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1268 "Get `gdb-buffer-rules' entry for current buffer type." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1269 (assoc gdb-buffer-type gdb-buffer-rules)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1270 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1271 (defun gdb-current-buffer-thread () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1272 "Get thread object of current buffer from `gdb-threads-list'. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1273 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1274 When current buffer is not bound to any thread, return main |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1275 thread." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1276 (cdr (assoc gdb-thread-number gdb-threads-list))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1277 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1278 (defun gdb-current-buffer-frame () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1279 "Get current stack frame object for thread of current buffer." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1280 (bindat-get-field (gdb-current-buffer-thread) 'frame)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1281 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1282 (defun gdb-buffer-type (buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1283 "Get value of `gdb-buffer-type' for BUFFER." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1284 (with-current-buffer buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1285 gdb-buffer-type)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1286 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1287 (defun gdb-buffer-shows-main-thread-p () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1288 "Return t if current GDB buffer shows main selected thread and |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1289 is not bound to it." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1290 (current-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1291 (not (local-variable-p 'gdb-thread-number))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1292 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1293 (defun gdb-get-buffer (buffer-type &optional thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1294 "Get a specific GDB buffer. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1295 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1296 In that buffer, `gdb-buffer-type' must be equal to BUFFER-TYPE |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1297 and `gdb-thread-number' (if provided) must be equal to THREAD." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1298 (catch 'found |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1299 (dolist (buffer (buffer-list) nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1300 (with-current-buffer buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1301 (when (and (eq gdb-buffer-type buffer-type) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1302 (or (not thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1303 (equal gdb-thread-number thread))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1304 (throw 'found buffer)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1305 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1306 (defun gdb-get-buffer-create (buffer-type &optional thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1307 "Create a new GDB buffer of the type specified by BUFFER-TYPE. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1308 The buffer-type should be one of the cars in `gdb-buffer-rules'. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1309 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1310 If THREAD is non-nil, it is assigned to `gdb-thread-number' |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1311 buffer-local variable of the new buffer. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1312 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1313 Buffer mode and name are selected according to buffer type. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1314 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1315 If buffer has trigger associated with it in `gdb-buffer-rules', |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1316 this trigger is subscribed to `gdb-buf-publisher' and called with |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1317 'update argument." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1318 (or (gdb-get-buffer buffer-type thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1319 (let ((rules (assoc buffer-type gdb-buffer-rules)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1320 (new (generate-new-buffer "limbo"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1321 (with-current-buffer new |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1322 (let ((mode (gdb-rules-buffer-mode rules)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1323 (trigger (gdb-rules-update-trigger rules))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1324 (when mode (funcall mode)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1325 (setq gdb-buffer-type buffer-type) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1326 (when thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1327 (set (make-local-variable 'gdb-thread-number) thread)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1328 (set (make-local-variable 'gud-minor-mode) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1329 (buffer-local-value 'gud-minor-mode gud-comint-buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1330 (set (make-local-variable 'tool-bar-map) gud-tool-bar-map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1331 (rename-buffer (funcall (gdb-rules-name-maker rules))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1332 (when trigger |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1333 (gdb-add-subscriber gdb-buf-publisher |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1334 (cons (current-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1335 (gdb-bind-function-to-buffer trigger (current-buffer)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1336 (funcall trigger 'start)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1337 (current-buffer)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1338 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1339 (defun gdb-bind-function-to-buffer (expr buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1340 "Return a function which will evaluate EXPR in BUFFER." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1341 `(lambda (&rest args) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1342 (with-current-buffer ,buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1343 (apply ',expr args)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1344 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1345 ;; Used to define all gdb-frame-*-buffer functions except |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1346 ;; `gdb-frame-io-buffer' |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1347 (defmacro def-gdb-frame-for-buffer (name buffer &optional doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1348 "Define a function NAME which shows gdb BUFFER in a separate frame. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1349 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1350 DOC is an optional documentation string." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1351 `(defun ,name (&optional thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1352 ,(when doc doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1353 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1354 (let ((special-display-regexps (append special-display-regexps '(".*"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1355 (special-display-frame-alist gdb-frame-parameters)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1356 (display-buffer (gdb-get-buffer-create ,buffer thread))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1357 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1358 (defmacro def-gdb-display-buffer (name buffer &optional doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1359 "Define a function NAME which shows gdb BUFFER. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1360 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1361 DOC is an optional documentation string." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1362 `(defun ,name (&optional thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1363 ,(when doc doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1364 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1365 (gdb-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1366 (gdb-get-buffer-create ,buffer thread) t))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1367 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1368 ;; Used to display windows with thread-bound buffers |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1369 (defmacro def-gdb-preempt-display-buffer (name buffer &optional doc |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1370 split-horizontal) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1371 `(defun ,name (&optional thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1372 ,(when doc doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1373 (message thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1374 (gdb-preempt-existing-or-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1375 (gdb-get-buffer-create ,buffer thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1376 ,split-horizontal))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1377 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1378 ;; This assoc maps buffer type symbols to rules. Each rule is a list of |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1379 ;; at least one and possible more functions. The functions have these |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1380 ;; roles in defining a buffer type: |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1381 ;; |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1382 ;; NAME - Return a name for this buffer type. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1383 ;; |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1384 ;; The remaining function(s) are optional: |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1385 ;; |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1386 ;; MODE - called in a new buffer with no arguments, should establish |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1387 ;; the proper mode for the buffer. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1388 ;; |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1389 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1390 (defun gdb-set-buffer-rules (buffer-type &rest rules) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1391 (let ((binding (assoc buffer-type gdb-buffer-rules))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1392 (if binding |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1393 (setcdr binding rules) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1394 (push (cons buffer-type rules) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1395 gdb-buffer-rules)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1396 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1397 (defun gdb-parent-mode () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1398 "Generic mode to derive all other GDB buffer modes from." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1399 (kill-all-local-variables) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1400 (setq buffer-read-only t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1401 (buffer-disable-undo) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1402 ;; Delete buffer from gdb-buf-publisher when it's killed |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1403 ;; (if it has an associated update trigger) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1404 (add-hook |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1405 'kill-buffer-hook |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1406 (function |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1407 (lambda () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1408 (let ((trigger (gdb-rules-update-trigger |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1409 (gdb-current-buffer-rules)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1410 (when trigger |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1411 (gdb-delete-subscriber |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1412 gdb-buf-publisher |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1413 ;; This should match gdb-add-subscriber done in |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1414 ;; gdb-get-buffer-create |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1415 (cons (current-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1416 (gdb-bind-function-to-buffer trigger (current-buffer)))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1417 nil t)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1418 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1419 ;; Partial-output buffer : This accumulates output from a command executed on |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1420 ;; behalf of emacs (rather than the user). |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1421 ;; |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1422 (gdb-set-buffer-rules 'gdb-partial-output-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1423 'gdb-partial-output-name) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1424 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1425 (defun gdb-partial-output-name () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1426 (concat " *partial-output-" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1427 (gdb-get-target-string) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1428 "*")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1429 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1430 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1431 (gdb-set-buffer-rules 'gdb-inferior-io |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1432 'gdb-inferior-io-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1433 'gdb-inferior-io-mode) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1434 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1435 (defun gdb-inferior-io-name () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1436 (concat "*input/output of " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1437 (gdb-get-target-string) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1438 "*")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1439 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1440 (defun gdb-display-io-buffer () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1441 "Display IO of debugged program in a separate window." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1442 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1443 (gdb-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1444 (gdb-get-buffer-create 'gdb-inferior-io) t)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1445 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1446 (defconst gdb-frame-parameters |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1447 '((height . 14) (width . 80) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1448 (unsplittable . t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1449 (tool-bar-lines . nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1450 (menu-bar-lines . nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1451 (minibuffer . nil))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1452 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1453 (defun gdb-frame-io-buffer () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1454 "Display IO of debugged program in a new frame." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1455 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1456 (let ((special-display-regexps (append special-display-regexps '(".*"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1457 (special-display-frame-alist gdb-frame-parameters)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1458 (display-buffer (gdb-get-buffer-create 'gdb-inferior-io)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1459 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1460 (defvar gdb-inferior-io-mode-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1461 (let ((map (make-sparse-keymap))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1462 (define-key map "\C-c\C-c" 'gdb-io-interrupt) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1463 (define-key map "\C-c\C-z" 'gdb-io-stop) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1464 (define-key map "\C-c\C-\\" 'gdb-io-quit) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1465 (define-key map "\C-c\C-d" 'gdb-io-eof) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1466 (define-key map "\C-d" 'gdb-io-eof) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1467 map)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1468 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1469 ;; We want to use comint because it has various nifty and familiar features. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1470 (define-derived-mode gdb-inferior-io-mode comint-mode "Inferior I/O" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1471 "Major mode for gdb inferior-io. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1472 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1473 The following commands are available: |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1474 \\{gdb-inferior-io-mode-map}" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1475 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1476 :syntax-table nil :abbrev-table nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1477 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1478 (make-comint-in-buffer "gdb-inferior" (current-buffer) nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1479 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1480 (defun gdb-inferior-filter (proc string) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1481 (unless (string-equal string "") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1482 (gdb-display-buffer (gdb-get-buffer-create 'gdb-inferior-io) t)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1483 (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1484 (comint-output-filter proc string))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1485 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1486 (defun gdb-io-interrupt () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1487 "Interrupt the program being debugged." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1488 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1489 (interrupt-process |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1490 (get-buffer-process gud-comint-buffer) comint-ptyp)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1491 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1492 (defun gdb-io-quit () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1493 "Send quit signal to the program being debugged." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1494 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1495 (quit-process |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1496 (get-buffer-process gud-comint-buffer) comint-ptyp)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1497 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1498 (defun gdb-io-stop () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1499 "Stop the program being debugged." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1500 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1501 (stop-process |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1502 (get-buffer-process gud-comint-buffer) comint-ptyp)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1503 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1504 (defun gdb-io-eof () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1505 "Send end-of-file to the program being debugged." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1506 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1507 (process-send-eof |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1508 (get-buffer-process gud-comint-buffer))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1509 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1510 (defun gdb-clear-inferior-io () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1511 (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1512 (erase-buffer))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1513 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1514 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1515 (defconst breakpoint-xpm-data |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1516 "/* XPM */ |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1517 static char *magick[] = { |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1518 /* columns rows colors chars-per-pixel */ |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1519 \"10 10 2 1\", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1520 \" c red\", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1521 \"+ c None\", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1522 /* pixels */ |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1523 \"+++ +++\", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1524 \"++ ++\", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1525 \"+ +\", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1526 \" \", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1527 \" \", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1528 \" \", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1529 \" \", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1530 \"+ +\", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1531 \"++ ++\", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1532 \"+++ +++\", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1533 };" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1534 "XPM data used for breakpoint icon.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1535 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1536 (defconst breakpoint-enabled-pbm-data |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1537 "P1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1538 10 10\", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1539 0 0 0 0 1 1 1 1 0 0 0 0 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1540 0 0 0 1 1 1 1 1 1 0 0 0 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1541 0 0 1 1 1 1 1 1 1 1 0 0 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1542 0 1 1 1 1 1 1 1 1 1 1 0 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1543 0 1 1 1 1 1 1 1 1 1 1 0 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1544 0 1 1 1 1 1 1 1 1 1 1 0 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1545 0 1 1 1 1 1 1 1 1 1 1 0 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1546 0 0 1 1 1 1 1 1 1 1 0 0 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1547 0 0 0 1 1 1 1 1 1 0 0 0 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1548 0 0 0 0 1 1 1 1 0 0 0 0" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1549 "PBM data used for enabled breakpoint icon.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1550 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1551 (defconst breakpoint-disabled-pbm-data |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1552 "P1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1553 10 10\", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1554 0 0 1 0 1 0 1 0 0 0 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1555 0 1 0 1 0 1 0 1 0 0 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1556 1 0 1 0 1 0 1 0 1 0 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1557 0 1 0 1 0 1 0 1 0 1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1558 1 0 1 0 1 0 1 0 1 0 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1559 0 1 0 1 0 1 0 1 0 1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1560 1 0 1 0 1 0 1 0 1 0 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1561 0 1 0 1 0 1 0 1 0 1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1562 0 0 1 0 1 0 1 0 1 0 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1563 0 0 0 1 0 1 0 1 0 0" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1564 "PBM data used for disabled breakpoint icon.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1565 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1566 (defvar breakpoint-enabled-icon nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1567 "Icon for enabled breakpoint in display margin.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1568 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1569 (defvar breakpoint-disabled-icon nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1570 "Icon for disabled breakpoint in display margin.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1571 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1572 (declare-function define-fringe-bitmap "fringe.c" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1573 (bitmap bits &optional height width align)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1574 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1575 (and (display-images-p) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1576 ;; Bitmap for breakpoint in fringe |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1577 (define-fringe-bitmap 'breakpoint |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1578 "\x3c\x7e\xff\xff\xff\xff\x7e\x3c") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1579 ;; Bitmap for gud-overlay-arrow in fringe |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1580 (define-fringe-bitmap 'hollow-right-triangle |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1581 "\xe0\x90\x88\x84\x84\x88\x90\xe0")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1582 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1583 (defface breakpoint-enabled |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1584 '((t |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1585 :foreground "red1" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1586 :weight bold)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1587 "Face for enabled breakpoint icon in fringe." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1588 :group 'gdb) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1589 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1590 (defface breakpoint-disabled |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1591 '((((class color) (min-colors 88)) :foreground "grey70") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1592 ;; Ensure that on low-color displays that we end up something visible. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1593 (((class color) (min-colors 8) (background light)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1594 :foreground "black") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1595 (((class color) (min-colors 8) (background dark)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1596 :foreground "white") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1597 (((type tty) (class mono)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1598 :inverse-video t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1599 (t :background "gray")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1600 "Face for disabled breakpoint icon in fringe." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1601 :group 'gdb) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1602 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1603 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1604 (defun gdb-send (proc string) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1605 "A comint send filter for gdb." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1606 (with-current-buffer gud-comint-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1607 (let ((inhibit-read-only t)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1608 (remove-text-properties (point-min) (point-max) '(face)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1609 ;; mimic <RET> key to repeat previous command in GDB |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1610 (if (not (string= "" string)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1611 (setq gdb-last-command string) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1612 (if gdb-last-command (setq string gdb-last-command))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1613 (if gdb-enable-debug |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1614 (push (cons 'mi-send (concat string "\n")) gdb-debug-log)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1615 (if (string-match "^-" string) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1616 ;; MI command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1617 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1618 (setq gdb-first-done-or-error t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1619 (process-send-string proc (concat string "\n"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1620 ;; CLI command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1621 (if (string-match "\\\\$" string) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1622 (setq gdb-continuation (concat gdb-continuation string "\n")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1623 (setq gdb-first-done-or-error t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1624 (process-send-string proc (concat "-interpreter-exec console \"" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1625 gdb-continuation string "\"\n")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1626 (setq gdb-continuation nil)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1627 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1628 (defun gdb-input (item) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1629 (if gdb-enable-debug (push (cons 'send-item item) gdb-debug-log)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1630 (setq gdb-token-number (1+ gdb-token-number)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1631 (setcar item (concat (number-to-string gdb-token-number) (car item))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1632 (push (cons gdb-token-number (car (cdr item))) gdb-handler-alist) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1633 (process-send-string (get-buffer-process gud-comint-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1634 (concat (car item) "\n"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1635 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1636 ;; NOFRAME is used for gud execution control commands |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1637 (defun gdb-current-context-command (command) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1638 "Add --thread to gdb COMMAND when needed." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1639 (if (and gdb-thread-number |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1640 (string-equal gdb-version "7.0+")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1641 (concat command " --thread " gdb-thread-number) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1642 command)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1643 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1644 (defun gdb-current-context-buffer-name (name) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1645 "Add thread information and asterisks to string NAME. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1646 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1647 If `gdb-thread-number' is nil, just wrap NAME in asterisks." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1648 (concat "*" name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1649 (if (local-variable-p 'gdb-thread-number) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1650 (format " (bound to thread %s)" gdb-thread-number) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1651 "") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1652 "*")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1653 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1654 (defun gdb-current-context-mode-name (mode) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1655 "Add thread information to MODE which is to be used as |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1656 `mode-name'." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1657 (concat mode |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1658 (if gdb-thread-number |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1659 (format " [thread %s]" gdb-thread-number) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1660 ""))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1661 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1662 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1663 (defcustom gud-gdb-command-name "gdb -i=mi" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1664 "Default command to execute an executable under the GDB debugger." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1665 :type 'string |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1666 :group 'gdb) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1667 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1668 (defun gdb-resync() |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1669 (setq gud-running nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1670 (setq gdb-output-sink 'user) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1671 (setq gdb-pending-triggers nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1672 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1673 (defun gdb-update () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1674 "Update buffers showing status of debug session." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1675 (when gdb-first-prompt |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1676 (gdb-force-mode-line-update |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1677 (propertize "initializing..." 'face font-lock-variable-name-face)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1678 (gdb-init-1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1679 (setq gdb-first-prompt nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1680 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1681 (gdb-get-main-selected-frame) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1682 ;; We may need to update gdb-threads-list so we can use |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1683 (gdb-get-buffer-create 'gdb-threads-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1684 ;; gdb-break-list is maintained in breakpoints handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1685 (gdb-get-buffer-create 'gdb-breakpoints-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1686 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1687 (gdb-emit-signal gdb-buf-publisher 'update) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1688 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1689 (gdb-get-changed-registers) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1690 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1691 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1692 (dolist (var gdb-var-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1693 (setcar (nthcdr 5 var) nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1694 (gdb-var-update))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1695 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1696 ;; gdb-setq-thread-number and gdb-update-gud-running are decoupled |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1697 ;; because we may need to update current gud-running value without |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1698 ;; changing current thread (see gdb-running) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1699 (defun gdb-setq-thread-number (number) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1700 "Only this function must be used to change `gdb-thread-number' |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1701 value to NUMBER, because `gud-running' and `gdb-frame-number' |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1702 need to be updated appropriately when current thread changes." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1703 ;; GDB 6.8 and earlier always output thread-id="0" when stopping. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1704 (unless (string-equal number "0") (setq gdb-thread-number number)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1705 (setq gdb-frame-number "0") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1706 (gdb-update-gud-running)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1707 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1708 (defun gdb-update-gud-running () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1709 "Set `gud-running' according to the state of current thread. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1710 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1711 `gdb-frame-number' is set to 0 if current thread is now stopped. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1712 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1713 Note that when `gdb-gud-control-all-threads' is t, `gud-running' |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1714 cannot be reliably used to determine whether or not execution |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1715 control buttons should be shown in menu or toolbar. Use |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1716 `gdb-running-threads-count' and `gdb-stopped-threads-count' |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1717 instead. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1718 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1719 For all-stop mode, thread information is unavailable while target |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1720 is running." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1721 (let ((old-value gud-running)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1722 (setq gud-running |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1723 (string= (bindat-get-field (gdb-current-buffer-thread) 'state) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1724 "running")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1725 ;; Set frame number to "0" when _current_ threads stops |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1726 (when (and (gdb-current-buffer-thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1727 (not (eq gud-running old-value))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1728 (setq gdb-frame-number "0")))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1729 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1730 (defun gdb-show-run-p () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1731 "Return t if \"Run/continue\" should be shown on the toolbar." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1732 (or (not gdb-active-process) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1733 (and (or |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1734 (not gdb-gud-control-all-threads) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1735 (not gdb-non-stop)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1736 (not gud-running)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1737 (and gdb-gud-control-all-threads |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1738 (> gdb-stopped-threads-count 0)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1739 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1740 (defun gdb-show-stop-p () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1741 "Return t if \"Stop\" should be shown on the toolbar." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1742 (or (and (or |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1743 (not gdb-gud-control-all-threads) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1744 (not gdb-non-stop)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1745 gud-running) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1746 (and gdb-gud-control-all-threads |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1747 (> gdb-running-threads-count 0)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1748 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1749 ;; GUD displays the selected GDB frame. This might might not be the current |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1750 ;; GDB frame (after up, down etc). If no GDB frame is visible but the last |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1751 ;; visited breakpoint is, use that window. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1752 (defun gdb-display-source-buffer (buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1753 (let* ((last-window (if gud-last-last-frame |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1754 (get-buffer-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1755 (gud-find-file (car gud-last-last-frame))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1756 (source-window (or last-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1757 (if (and gdb-source-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1758 (window-live-p gdb-source-window)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1759 gdb-source-window)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1760 (when source-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1761 (setq gdb-source-window source-window) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1762 (set-window-buffer source-window buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1763 source-window)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1764 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1765 (defun gdb-car< (a b) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1766 (< (car a) (car b))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1767 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1768 (defvar gdbmi-record-list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1769 '((gdb-gdb . "(gdb) \n") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1770 (gdb-done . "\\([0-9]*\\)\\^done,?\\(.*?\\)\n") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1771 (gdb-starting . "\\([0-9]*\\)\\^running\n") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1772 (gdb-error . "\\([0-9]*\\)\\^error,\\(.*?\\)\n") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1773 (gdb-console . "~\\(\".*?\"\\)\n") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1774 (gdb-internals . "&\\(\".*?\"\\)\n") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1775 (gdb-stopped . "\\*stopped,?\\(.*?\\)\n") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1776 (gdb-running . "\\*running,\\(.*?\n\\)") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1777 (gdb-thread-created . "=thread-created,\\(.*?\n\\)") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1778 (gdb-thread-selected . "=thread-selected,\\(.*?\\)\n") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1779 (gdb-thread-exited . "=thread-exited,\\(.*?\n\\)") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1780 (gdb-ignored-notification . "=[-[:alpha:]]+,?\\(.*?\\)\n") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1781 (gdb-shell . "\\(\\(?:^.+\n\\)+\\)"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1782 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1783 (defun gud-gdbmi-marker-filter (string) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1784 "Filter GDB/MI output." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1785 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1786 ;; Record transactions if logging is enabled. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1787 (when gdb-enable-debug |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1788 (push (cons 'recv string) gdb-debug-log) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1789 (if (and gdb-debug-log-max |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1790 (> (length gdb-debug-log) gdb-debug-log-max)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1791 (setcdr (nthcdr (1- gdb-debug-log-max) gdb-debug-log) nil))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1792 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1793 ;; Recall the left over gud-marker-acc from last time |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1794 (setq gud-marker-acc (concat gud-marker-acc string)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1795 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1796 ;; Start accumulating output for the GUD buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1797 (setq gdb-filter-output "") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1798 (let ((output-record) (output-record-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1799 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1800 ;; Process all the complete markers in this chunk. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1801 (dolist (gdbmi-record gdbmi-record-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1802 (while (string-match (cdr gdbmi-record) gud-marker-acc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1803 (push (list (match-beginning 0) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1804 (car gdbmi-record) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1805 (match-string 1 gud-marker-acc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1806 (match-string 2 gud-marker-acc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1807 (match-end 0)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1808 output-record-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1809 (setq gud-marker-acc |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1810 (concat (substring gud-marker-acc 0 (match-beginning 0)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1811 ;; Pad with spaces to preserve position. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1812 (make-string (length (match-string 0 gud-marker-acc)) 32) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1813 (substring gud-marker-acc (match-end 0)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1814 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1815 (setq output-record-list (sort output-record-list 'gdb-car<)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1816 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1817 (dolist (output-record output-record-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1818 (let ((record-type (cadr output-record)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1819 (arg1 (nth 2 output-record)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1820 (arg2 (nth 3 output-record))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1821 (if (eq record-type 'gdb-error) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1822 (gdb-done-or-error arg2 arg1 'error) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1823 (if (eq record-type 'gdb-done) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1824 (gdb-done-or-error arg2 arg1 'done) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1825 ;; Suppress "No registers." since GDB 6.8 and earlier duplicates MI |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1826 ;; error message on internal stream. Don't print to GUD buffer. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1827 (unless (and (eq record-type 'gdb-internals) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1828 (string-equal (read arg1) "No registers.\n")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1829 (funcall record-type arg1)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1830 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1831 (setq gdb-output-sink 'user) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1832 ;; Remove padding. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1833 (string-match "^ *" gud-marker-acc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1834 (setq gud-marker-acc (substring gud-marker-acc (match-end 0))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1835 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1836 gdb-filter-output)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1837 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1838 (defun gdb-gdb (output-field)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1839 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1840 (defun gdb-shell (output-field) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1841 (let ((gdb-output-sink gdb-output-sink)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1842 (setq gdb-filter-output |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1843 (concat output-field gdb-filter-output)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1844 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1845 (defun gdb-ignored-notification (output-field)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1846 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1847 ;; gdb-invalidate-threads is defined to accept 'update-threads signal |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1848 (defun gdb-thread-created (output-field)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1849 (defun gdb-thread-exited (output-field) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1850 "Handle =thread-exited async record: unset `gdb-thread-number' |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1851 if current thread exited and update threads list." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1852 (let* ((thread-id (bindat-get-field (gdb-json-string output-field) 'id))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1853 (if (string= gdb-thread-number thread-id) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1854 (gdb-setq-thread-number nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1855 ;; When we continue current thread and it quickly exits, |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1856 ;; gdb-pending-triggers left after gdb-running disallow us to |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1857 ;; properly call -thread-info without --thread option. Thus we |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1858 ;; need to use gdb-wait-for-pending. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1859 (gdb-wait-for-pending |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1860 (gdb-emit-signal gdb-buf-publisher 'update-threads)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1861 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1862 (defun gdb-thread-selected (output-field) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1863 "Handler for =thread-selected MI output record. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1864 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1865 Sets `gdb-thread-number' to new id." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1866 (let* ((result (gdb-json-string output-field)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1867 (thread-id (bindat-get-field result 'id))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1868 (gdb-setq-thread-number thread-id) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1869 ;; Typing `thread N` in GUD buffer makes GDB emit `^done` followed |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1870 ;; by `=thread-selected` notification. `^done` causes `gdb-update` |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1871 ;; as usually. Things happen to fast and second call (from |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1872 ;; gdb-thread-selected handler) gets cut off by our beloved |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1873 ;; gdb-pending-triggers. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1874 ;; Solution is `gdb-wait-for-pending` macro: it guarantees that its |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1875 ;; body will get executed when `gdb-pending-triggers` is empty. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1876 (gdb-wait-for-pending |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1877 (gdb-update)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1878 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1879 (defun gdb-running (output-field) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1880 (let* ((thread-id (bindat-get-field (gdb-json-string output-field) 'thread-id))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1881 ;; We reset gdb-frame-number to nil if current thread has gone |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1882 ;; running. This can't be done in gdb-thread-list-handler-custom |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1883 ;; because we need correct gdb-frame-number by the time |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1884 ;; -thread-info command is sent. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1885 (when (or (string-equal thread-id "all") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1886 (string-equal thread-id gdb-thread-number)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1887 (setq gdb-frame-number nil))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1888 (setq gdb-inferior-status "running") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1889 (gdb-force-mode-line-update |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1890 (propertize gdb-inferior-status 'face font-lock-type-face)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1891 (when (not gdb-non-stop) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1892 (setq gud-running t)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1893 (setq gdb-active-process t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1894 (gdb-emit-signal gdb-buf-publisher 'update-threads)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1895 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1896 (defun gdb-starting (output-field) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1897 ;; CLI commands don't emit ^running at the moment so use gdb-running too. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1898 (setq gdb-inferior-status "running") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1899 (gdb-force-mode-line-update |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1900 (propertize gdb-inferior-status 'face font-lock-type-face)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1901 (setq gdb-active-process t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1902 (setq gud-running t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1903 ;; GDB doesn't seem to respond to -thread-info before first stop or |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1904 ;; thread exit (even in non-stop mode), so this is useless. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1905 ;; Behaviour may change in the future. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1906 (gdb-emit-signal gdb-buf-publisher 'update-threads)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1907 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1908 ;; -break-insert -t didn't give a reason before gdb 6.9 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1909 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1910 (defun gdb-stopped (output-field) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1911 "Given the contents of *stopped MI async record, select new |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1912 current thread and update GDB buffers." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1913 ;; Reason is available with target-async only |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1914 (let* ((result (gdb-json-string output-field)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1915 (reason (bindat-get-field result 'reason)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1916 (thread-id (bindat-get-field result 'thread-id))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1917 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1918 ;; -data-list-register-names needs to be issued for any stopped |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1919 ;; thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1920 (when (not gdb-register-names) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1921 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1922 (list (concat "-data-list-register-names" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1923 (if (string-equal gdb-version "7.0+") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1924 (concat" --thread " thread-id))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1925 'gdb-register-names-handler))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1926 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1927 ;;; Don't set gud-last-frame here as it's currently done in gdb-frame-handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1928 ;;; because synchronous GDB doesn't give these fields with CLI. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1929 ;;; (when file |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1930 ;;; (setq |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1931 ;;; ;; Extract the frame position from the marker. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1932 ;;; gud-last-frame (cons file |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1933 ;;; (string-to-number |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1934 ;;; (match-string 6 gud-marker-acc))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1935 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1936 (setq gdb-inferior-status (or reason "unknown")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1937 (gdb-force-mode-line-update |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1938 (propertize gdb-inferior-status 'face font-lock-warning-face)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1939 (if (string-equal reason "exited-normally") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1940 (setq gdb-active-process nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1941 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1942 ;; Select new current thread. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1943 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1944 ;; Don't switch if we have no reasons selected |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1945 (when gdb-switch-reasons |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1946 ;; Switch from another stopped thread only if we have |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1947 ;; gdb-switch-when-another-stopped: |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1948 (when (or gdb-switch-when-another-stopped |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1949 (not (string= "stopped" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1950 (bindat-get-field (gdb-current-buffer-thread) 'state)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1951 ;; Switch if current reason has been selected or we have no |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1952 ;; reasons |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1953 (if (or (eq gdb-switch-reasons t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1954 (member reason gdb-switch-reasons)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1955 (when (not (string-equal gdb-thread-number thread-id)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1956 (message (concat "Switched to thread " thread-id)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1957 (gdb-setq-thread-number thread-id)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1958 (message (format "Thread %s stopped" thread-id))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1959 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1960 ;; Print "(gdb)" to GUD console |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1961 (when gdb-first-done-or-error |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1962 (setq gdb-filter-output (concat gdb-filter-output gdb-prompt-name))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1963 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1964 ;; In non-stop, we update information as soon as another thread gets |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1965 ;; stopped |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1966 (when (or gdb-first-done-or-error |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1967 gdb-non-stop) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1968 ;; In all-stop this updates gud-running properly as well. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1969 (gdb-update) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1970 (setq gdb-first-done-or-error nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1971 (run-hook-with-args 'gdb-stopped-hooks result))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1972 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1973 ;; Remove the trimmings from log stream containing debugging messages |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1974 ;; being produced by GDB's internals, use warning face and send to GUD |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1975 ;; buffer. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1976 (defun gdb-internals (output-field) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1977 (setq gdb-filter-output |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1978 (gdb-concat-output |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1979 gdb-filter-output |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1980 (let ((error-message |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1981 (read output-field))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1982 (put-text-property |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1983 0 (length error-message) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1984 'face font-lock-warning-face |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1985 error-message) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1986 error-message)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1987 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1988 ;; Remove the trimmings from the console stream and send to GUD buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1989 ;; (frontend MI commands should not print to this stream) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1990 (defun gdb-console (output-field) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1991 (setq gdb-filter-output |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1992 (gdb-concat-output |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1993 gdb-filter-output |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1994 (read output-field)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1995 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1996 (defun gdb-done-or-error (output-field token-number type) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1997 (if (string-equal token-number "") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1998 ;; Output from command entered by user |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1999 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2000 (setq gdb-output-sink 'user) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2001 (setq token-number nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2002 ;; MI error - send to minibuffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2003 (when (eq type 'error) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2004 ;; Skip "msg=" from `output-field' |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2005 (message (read (substring output-field 4))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2006 ;; Don't send to the console twice. (If it is a console error |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2007 ;; it is also in the console stream.) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2008 (setq output-field nil))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2009 ;; Output from command from frontend. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2010 (setq gdb-output-sink 'emacs)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2011 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2012 (gdb-clear-partial-output) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2013 (when gdb-first-done-or-error |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2014 (unless (or token-number gud-running) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2015 (setq gdb-filter-output (concat gdb-filter-output gdb-prompt-name))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2016 (gdb-update) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2017 (setq gdb-first-done-or-error nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2018 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2019 (setq gdb-filter-output |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2020 (gdb-concat-output gdb-filter-output output-field)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2021 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2022 (if token-number |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2023 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2024 (with-current-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2025 (gdb-get-buffer-create 'gdb-partial-output-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2026 (funcall |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2027 (cdr (assoc (string-to-number token-number) gdb-handler-alist)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2028 (setq gdb-handler-alist |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2029 (assq-delete-all token-number gdb-handler-alist))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2030 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2031 (defun gdb-concat-output (so-far new) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2032 (let ((sink gdb-output-sink)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2033 (cond |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2034 ((eq sink 'user) (concat so-far new)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2035 ((eq sink 'emacs) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2036 (gdb-append-to-partial-output new) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2037 so-far)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2038 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2039 (defun gdb-append-to-partial-output (string) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2040 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2041 (goto-char (point-max)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2042 (insert string))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2043 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2044 (defun gdb-clear-partial-output () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2045 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2046 (erase-buffer))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2047 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2048 (defun gdb-jsonify-buffer (&optional fix-key fix-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2049 "Prepare GDB/MI output in current buffer for parsing with `json-read'. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2050 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2051 Field names are wrapped in double quotes and equal signs are |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2052 replaced with semicolons. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2053 |
110561 | 2054 If FIX-KEY is non-nil, strip all \"FIX-KEY=\" occurrences from |
107550
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2055 partial output. This is used to get rid of useless keys in lists |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2056 in MI messages, e.g.: [key=.., key=..]. -stack-list-frames and |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2057 -break-info are examples of MI commands which issue such |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2058 responses. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2059 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2060 If FIX-LIST is non-nil, \"FIX-LIST={..}\" is replaced with |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2061 \"FIX-LIST=[..]\" prior to parsing. This is used to fix broken |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2062 -break-info output when it contains breakpoint script field |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2063 incompatible with GDB/MI output syntax." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2064 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2065 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2066 (when fix-key |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2067 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2068 (while (re-search-forward (concat "[\\[,]\\(" fix-key "=\\)") nil t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2069 (replace-match "" nil nil nil 1)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2070 (when fix-list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2071 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2072 ;; Find positions of braces which enclose broken list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2073 (while (re-search-forward (concat fix-list "={\"") nil t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2074 (let ((p1 (goto-char (- (point) 2))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2075 (p2 (progn (forward-sexp) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2076 (1- (point))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2077 ;; Replace braces with brackets |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2078 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2079 (goto-char p1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2080 (delete-char 1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2081 (insert "[") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2082 (goto-char p2) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2083 (delete-char 1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2084 (insert "]")))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2085 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2086 (insert "{") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2087 (while (re-search-forward |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2088 "\\([[:alnum:]-_]+\\)=\\({\\|\\[\\|\"\"\\|\".*?[^\\]\"\\)" nil t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2089 (replace-match "\"\\1\":\\2" nil nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2090 (goto-char (point-max)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2091 (insert "}"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2092 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2093 (defun gdb-json-read-buffer (&optional fix-key fix-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2094 "Prepare and parse GDB/MI output in current buffer with `json-read'. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2095 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2096 FIX-KEY and FIX-LIST work as in `gdb-jsonify-buffer'." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2097 (gdb-jsonify-buffer fix-key fix-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2098 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2099 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2100 (let ((json-array-type 'list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2101 (json-read)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2102 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2103 (defun gdb-json-string (string &optional fix-key fix-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2104 "Prepare and parse STRING containing GDB/MI output with `json-read'. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2105 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2106 FIX-KEY and FIX-LIST work as in `gdb-jsonify-buffer'." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2107 (with-temp-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2108 (insert string) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2109 (gdb-json-read-buffer fix-key fix-list))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2110 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2111 (defun gdb-json-partial-output (&optional fix-key fix-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2112 "Prepare and parse gdb-partial-output-buffer with `json-read'. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2113 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2114 FIX-KEY and FIX-KEY work as in `gdb-jsonify-buffer'." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2115 (with-current-buffer (gdb-get-buffer-create 'gdb-partial-output-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2116 (gdb-json-read-buffer fix-key fix-list))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2117 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2118 (defun gdb-line-posns (line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2119 "Return a pair of LINE beginning and end positions." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2120 (let ((offset (1+ (- line (line-number-at-pos))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2121 (cons |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2122 (line-beginning-position offset) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2123 (line-end-position offset)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2124 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2125 (defmacro gdb-mark-line (line variable) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2126 "Set VARIABLE marker to point at beginning of LINE. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2127 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2128 If current window has no fringes, inverse colors on LINE. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2129 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2130 Return position where LINE begins." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2131 `(save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2132 (let* ((posns (gdb-line-posns ,line)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2133 (start-posn (car posns)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2134 (end-posn (cdr posns))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2135 (set-marker ,variable (copy-marker start-posn)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2136 (when (not (> (car (window-fringes)) 0)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2137 (put-text-property start-posn end-posn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2138 'font-lock-face '(:inverse-video t))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2139 start-posn))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2140 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2141 (defun gdb-pad-string (string padding) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2142 (format (concat "%" (number-to-string padding) "s") string)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2143 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2144 ;; gdb-table struct is a way to programmatically construct simple |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2145 ;; tables. It help to reliably align columns of data in GDB buffers |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2146 ;; and provides |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2147 (defstruct |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2148 gdb-table |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2149 (column-sizes nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2150 (rows nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2151 (row-properties nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2152 (right-align nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2153 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2154 (defun gdb-mapcar* (function &rest seqs) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2155 "Apply FUNCTION to each element of SEQS, and make a list of the results. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2156 If there are several SEQS, FUNCTION is called with that many |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2157 arugments, and mapping stops as sson as the shortest list runs |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2158 out." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2159 (let ((shortest (apply #'min (mapcar #'length seqs)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2160 (mapcar (lambda (i) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2161 (apply function |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2162 (mapcar |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2163 (lambda (seq) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2164 (nth i seq)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2165 seqs))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2166 (number-sequence 0 (1- shortest))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2167 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2168 (defun gdb-table-add-row (table row &optional properties) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2169 "Add ROW of string to TABLE and recalculate column sizes. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2170 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2171 When non-nil, PROPERTIES will be added to the whole row when |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2172 calling `gdb-table-string'." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2173 (let ((rows (gdb-table-rows table)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2174 (row-properties (gdb-table-row-properties table)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2175 (column-sizes (gdb-table-column-sizes table)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2176 (right-align (gdb-table-right-align table))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2177 (when (not column-sizes) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2178 (setf (gdb-table-column-sizes table) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2179 (make-list (length row) 0))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2180 (setf (gdb-table-rows table) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2181 (append rows (list row))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2182 (setf (gdb-table-row-properties table) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2183 (append row-properties (list properties))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2184 (setf (gdb-table-column-sizes table) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2185 (gdb-mapcar* (lambda (x s) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2186 (let ((new-x |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2187 (max (abs x) (string-width (or s ""))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2188 (if right-align new-x (- new-x)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2189 (gdb-table-column-sizes table) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2190 row)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2191 ;; Avoid trailing whitespace at eol |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2192 (if (not (gdb-table-right-align table)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2193 (setcar (last (gdb-table-column-sizes table)) 0)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2194 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2195 (defun gdb-table-string (table &optional sep) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2196 "Return TABLE as a string with columns separated with SEP." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2197 (let ((column-sizes (gdb-table-column-sizes table)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2198 (res "")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2199 (mapconcat |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2200 'identity |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2201 (gdb-mapcar* |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2202 (lambda (row properties) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2203 (apply 'propertize |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2204 (mapconcat 'identity |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2205 (gdb-mapcar* (lambda (s x) (gdb-pad-string s x)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2206 row column-sizes) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2207 sep) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2208 properties)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2209 (gdb-table-rows table) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2210 (gdb-table-row-properties table)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2211 "\n"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2212 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2213 ;; bindat-get-field goes deep, gdb-get-many-fields goes wide |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2214 (defun gdb-get-many-fields (struct &rest fields) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2215 "Return a list of FIELDS values from STRUCT." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2216 (let ((values)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2217 (dolist (field fields values) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2218 (setq values (append values (list (bindat-get-field struct field))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2219 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2220 (defmacro def-gdb-auto-update-trigger (trigger-name gdb-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2221 handler-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2222 &optional signal-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2223 "Define a trigger TRIGGER-NAME which sends GDB-COMMAND and sets |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2224 HANDLER-NAME as its handler. HANDLER-NAME is bound to current |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2225 buffer with `gdb-bind-function-to-buffer'. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2226 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2227 If SIGNAL-LIST is non-nil, GDB-COMMAND is sent only when the |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2228 defined trigger is called with an argument from SIGNAL-LIST. It's |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2229 not recommended to define triggers with empty SIGNAL-LIST. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2230 Normally triggers should respond at least to 'update signal. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2231 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2232 Normally the trigger defined by this command must be called from |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2233 the buffer where HANDLER-NAME must work. This should be done so |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2234 that buffer-local thread number may be used in GDB-COMMAND (by |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2235 calling `gdb-current-context-command'). |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2236 `gdb-bind-function-to-buffer' is used to achieve this, see |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2237 `gdb-get-buffer-create'. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2238 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2239 Triggers defined by this command are meant to be used as a |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2240 trigger argument when describing buffer types with |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2241 `gdb-set-buffer-rules'." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2242 `(defun ,trigger-name (&optional signal) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2243 (when |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2244 (or (not ,signal-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2245 (memq signal ,signal-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2246 (when (not (gdb-pending-p |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2247 (cons (current-buffer) ',trigger-name))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2248 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2249 (list ,gdb-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2250 (gdb-bind-function-to-buffer ',handler-name (current-buffer)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2251 (gdb-add-pending (cons (current-buffer) ',trigger-name)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2252 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2253 ;; Used by disassembly buffer only, the rest use |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2254 ;; def-gdb-trigger-and-handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2255 (defmacro def-gdb-auto-update-handler (handler-name trigger-name custom-defun |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2256 &optional nopreserve) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2257 "Define a handler HANDLER-NAME for TRIGGER-NAME with CUSTOM-DEFUN. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2258 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2259 Handlers are normally called from the buffers they put output in. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2260 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2261 Delete ((current-buffer) . TRIGGER-NAME) from |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2262 `gdb-pending-triggers', erase current buffer and evaluate |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2263 CUSTOM-DEFUN. Then `gdb-update-buffer-name' is called. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2264 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2265 If NOPRESERVE is non-nil, window point is not restored after CUSTOM-DEFUN." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2266 `(defun ,handler-name () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2267 (gdb-delete-pending (cons (current-buffer) ',trigger-name)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2268 (let* ((buffer-read-only nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2269 (window (get-buffer-window (current-buffer) 0)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2270 (start (window-start window)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2271 (p (window-point window))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2272 (erase-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2273 (,custom-defun) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2274 (gdb-update-buffer-name) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2275 ,(when (not nopreserve) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2276 '(set-window-start window start) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2277 '(set-window-point window p))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2278 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2279 (defmacro def-gdb-trigger-and-handler (trigger-name gdb-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2280 handler-name custom-defun |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2281 &optional signal-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2282 "Define trigger and handler. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2283 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2284 TRIGGER-NAME trigger is defined to send GDB-COMMAND. See |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2285 `def-gdb-auto-update-trigger'. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2286 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2287 HANDLER-NAME handler uses customization of CUSTOM-DEFUN. See |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2288 `def-gdb-auto-update-handler'." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2289 `(progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2290 (def-gdb-auto-update-trigger ,trigger-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2291 ,gdb-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2292 ,handler-name ,signal-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2293 (def-gdb-auto-update-handler ,handler-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2294 ,trigger-name ,custom-defun))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2295 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2296 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2297 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2298 ;; Breakpoint buffer : This displays the output of `-break-list'. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2299 (def-gdb-trigger-and-handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2300 gdb-invalidate-breakpoints "-break-list" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2301 gdb-breakpoints-list-handler gdb-breakpoints-list-handler-custom |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2302 '(start update)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2303 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2304 (gdb-set-buffer-rules |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2305 'gdb-breakpoints-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2306 'gdb-breakpoints-buffer-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2307 'gdb-breakpoints-mode |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2308 'gdb-invalidate-breakpoints) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2309 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2310 (defun gdb-breakpoints-list-handler-custom () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2311 (let ((breakpoints-list (bindat-get-field |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2312 (gdb-json-partial-output "bkpt" "script") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2313 'BreakpointTable 'body)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2314 (table (make-gdb-table))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2315 (setq gdb-breakpoints-list nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2316 (gdb-table-add-row table '("Num" "Type" "Disp" "Enb" "Addr" "Hits" "What")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2317 (dolist (breakpoint breakpoints-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2318 (add-to-list 'gdb-breakpoints-list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2319 (cons (bindat-get-field breakpoint 'number) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2320 breakpoint)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2321 (let ((at (bindat-get-field breakpoint 'at)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2322 (pending (bindat-get-field breakpoint 'pending)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2323 (func (bindat-get-field breakpoint 'func)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2324 (type (bindat-get-field breakpoint 'type))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2325 (gdb-table-add-row table |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2326 (list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2327 (bindat-get-field breakpoint 'number) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2328 type |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2329 (bindat-get-field breakpoint 'disp) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2330 (let ((flag (bindat-get-field breakpoint 'enabled))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2331 (if (string-equal flag "y") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2332 (propertize "y" 'font-lock-face font-lock-warning-face) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2333 (propertize "n" 'font-lock-face font-lock-comment-face))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2334 (bindat-get-field breakpoint 'addr) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2335 (bindat-get-field breakpoint 'times) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2336 (if (string-match ".*watchpoint" type) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2337 (bindat-get-field breakpoint 'what) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2338 (or pending at |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2339 (concat "in " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2340 (propertize func 'font-lock-face font-lock-function-name-face) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2341 (gdb-frame-location breakpoint))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2342 ;; Add clickable properties only for breakpoints with file:line |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2343 ;; information |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2344 (append (list 'gdb-breakpoint breakpoint) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2345 (when func '(help-echo "mouse-2, RET: visit breakpoint" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2346 mouse-face highlight)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2347 (insert (gdb-table-string table " ")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2348 (gdb-place-breakpoints))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2349 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2350 ;; Put breakpoint icons in relevant margins (even those set in the GUD buffer). |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2351 (defun gdb-place-breakpoints () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2352 (let ((flag) (bptno)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2353 ;; Remove all breakpoint-icons in source buffers but not assembler buffer. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2354 (dolist (buffer (buffer-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2355 (with-current-buffer buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2356 (if (and (eq gud-minor-mode 'gdbmi) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2357 (not (string-match "\\` ?\\*.+\\*\\'" (buffer-name)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2358 (gdb-remove-breakpoint-icons (point-min) (point-max))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2359 (dolist (breakpoint gdb-breakpoints-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2360 (let* ((breakpoint (cdr breakpoint)) ; gdb-breakpoints-list is |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2361 ; an associative list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2362 (line (bindat-get-field breakpoint 'line))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2363 (when line |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2364 (let ((file (bindat-get-field breakpoint 'fullname)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2365 (flag (bindat-get-field breakpoint 'enabled)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2366 (bptno (bindat-get-field breakpoint 'number))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2367 (unless (file-exists-p file) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2368 (setq file (cdr (assoc bptno gdb-location-alist)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2369 (if (and file |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2370 (not (string-equal file "File not found"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2371 (with-current-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2372 (find-file-noselect file 'nowarn) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2373 (gdb-init-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2374 ;; Only want one breakpoint icon at each location. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2375 (gdb-put-breakpoint-icon (string-equal flag "y") bptno |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2376 (string-to-number line))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2377 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2378 (list (concat "list " file ":1") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2379 'ignore)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2380 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2381 (list "-file-list-exec-source-file" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2382 `(lambda () (gdb-get-location |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2383 ,bptno ,line ,flag))))))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2384 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2385 (defvar gdb-source-file-regexp "fullname=\"\\(.*?\\)\"") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2386 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2387 (defun gdb-get-location (bptno line flag) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2388 "Find the directory containing the relevant source file. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2389 Put in buffer and place breakpoint icon." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2390 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2391 (catch 'file-not-found |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2392 (if (re-search-forward gdb-source-file-regexp nil t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2393 (delete (cons bptno "File not found") gdb-location-alist) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2394 (push (cons bptno (match-string 1)) gdb-location-alist) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2395 (gdb-resync) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2396 (unless (assoc bptno gdb-location-alist) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2397 (push (cons bptno "File not found") gdb-location-alist) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2398 (message-box "Cannot find source file for breakpoint location. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2399 Add directory to search path for source files using the GDB command, dir.")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2400 (throw 'file-not-found nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2401 (with-current-buffer (find-file-noselect (match-string 1)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2402 (gdb-init-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2403 ;; only want one breakpoint icon at each location |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2404 (gdb-put-breakpoint-icon (eq flag ?y) bptno (string-to-number line))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2405 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2406 (add-hook 'find-file-hook 'gdb-find-file-hook) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2407 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2408 (defun gdb-find-file-hook () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2409 "Set up buffer for debugging if file is part of the source code |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2410 of the current session." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2411 (if (and (buffer-name gud-comint-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2412 ;; in case gud or gdb-ui is just loaded |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2413 gud-comint-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2414 (eq (buffer-local-value 'gud-minor-mode gud-comint-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2415 'gdbmi)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2416 (if (member buffer-file-name gdb-source-file-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2417 (with-current-buffer (find-buffer-visiting buffer-file-name) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2418 (gdb-init-buffer))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2419 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2420 (declare-function gud-remove "gdb-mi" t t) ; gud-def |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2421 (declare-function gud-break "gdb-mi" t t) ; gud-def |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2422 (declare-function fringe-bitmaps-at-pos "fringe.c" (&optional pos window)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2423 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2424 (defun gdb-mouse-set-clear-breakpoint (event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2425 "Set/clear breakpoint in left fringe/margin at mouse click. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2426 If not in a source or disassembly buffer just set point." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2427 (interactive "e") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2428 (mouse-minibuffer-check event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2429 (let ((posn (event-end event))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2430 (with-selected-window (posn-window posn) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2431 (if (or (buffer-file-name) (eq major-mode 'gdb-disassembly-mode)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2432 (if (numberp (posn-point posn)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2433 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2434 (goto-char (posn-point posn)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2435 (if (or (posn-object posn) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2436 (eq (car (fringe-bitmaps-at-pos (posn-point posn))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2437 'breakpoint)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2438 (gud-remove nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2439 (gud-break nil))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2440 (posn-set-point posn)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2441 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2442 (defun gdb-mouse-toggle-breakpoint-margin (event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2443 "Enable/disable breakpoint in left margin with mouse click." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2444 (interactive "e") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2445 (mouse-minibuffer-check event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2446 (let ((posn (event-end event))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2447 (if (numberp (posn-point posn)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2448 (with-selected-window (posn-window posn) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2449 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2450 (goto-char (posn-point posn)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2451 (if (posn-object posn) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2452 (gud-basic-call |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2453 (let ((bptno (get-text-property |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2454 0 'gdb-bptno (car (posn-string posn))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2455 (concat |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2456 (if (get-text-property |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2457 0 'gdb-enabled (car (posn-string posn))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2458 "-break-disable " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2459 "-break-enable ") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2460 bptno))))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2461 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2462 (defun gdb-mouse-toggle-breakpoint-fringe (event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2463 "Enable/disable breakpoint in left fringe with mouse click." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2464 (interactive "e") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2465 (mouse-minibuffer-check event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2466 (let* ((posn (event-end event)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2467 (pos (posn-point posn)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2468 obj) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2469 (when (numberp pos) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2470 (with-selected-window (posn-window posn) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2471 (with-current-buffer (window-buffer (selected-window)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2472 (goto-char pos) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2473 (dolist (overlay (overlays-in pos pos)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2474 (when (overlay-get overlay 'put-break) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2475 (setq obj (overlay-get overlay 'before-string)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2476 (when (stringp obj) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2477 (gud-basic-call |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2478 (concat |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2479 (if (get-text-property 0 'gdb-enabled obj) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2480 "-break-disable " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2481 "-break-enable ") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2482 (get-text-property 0 'gdb-bptno obj))))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2483 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2484 (defun gdb-breakpoints-buffer-name () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2485 (concat "*breakpoints of " (gdb-get-target-string) "*")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2486 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2487 (def-gdb-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2488 gdb-display-breakpoints-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2489 'gdb-breakpoints-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2490 "Display status of user-settable breakpoints.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2491 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2492 (def-gdb-frame-for-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2493 gdb-frame-breakpoints-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2494 'gdb-breakpoints-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2495 "Display status of user-settable breakpoints in a new frame.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2496 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2497 (defvar gdb-breakpoints-mode-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2498 (let ((map (make-sparse-keymap)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2499 (menu (make-sparse-keymap "Breakpoints"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2500 (define-key menu [quit] '("Quit" . gdb-delete-frame-or-window)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2501 (define-key menu [goto] '("Goto" . gdb-goto-breakpoint)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2502 (define-key menu [delete] '("Delete" . gdb-delete-breakpoint)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2503 (define-key menu [toggle] '("Toggle" . gdb-toggle-breakpoint)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2504 (suppress-keymap map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2505 (define-key map [menu-bar breakpoints] (cons "Breakpoints" menu)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2506 (define-key map " " 'gdb-toggle-breakpoint) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2507 (define-key map "D" 'gdb-delete-breakpoint) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2508 ;; Don't bind "q" to kill-this-buffer as we need it for breakpoint icons. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2509 (define-key map "q" 'gdb-delete-frame-or-window) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2510 (define-key map "\r" 'gdb-goto-breakpoint) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2511 (define-key map "\t" '(lambda () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2512 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2513 (gdb-set-window-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2514 (gdb-get-buffer-create 'gdb-threads-buffer) t))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2515 (define-key map [mouse-2] 'gdb-goto-breakpoint) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2516 (define-key map [follow-link] 'mouse-face) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2517 map)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2518 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2519 (defun gdb-delete-frame-or-window () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2520 "Delete frame if there is only one window. Otherwise delete the window." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2521 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2522 (if (one-window-p) (delete-frame) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2523 (delete-window))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2524 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2525 ;;from make-mode-line-mouse-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2526 (defun gdb-make-header-line-mouse-map (mouse function) "\ |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2527 Return a keymap with single entry for mouse key MOUSE on the header line. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2528 MOUSE is defined to run function FUNCTION with no args in the buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2529 corresponding to the mode line clicked." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2530 (let ((map (make-sparse-keymap))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2531 (define-key map (vector 'header-line mouse) function) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2532 (define-key map (vector 'header-line 'down-mouse-1) 'ignore) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2533 map)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2534 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2535 (defmacro gdb-propertize-header (name buffer help-echo mouse-face face) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2536 `(propertize ,name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2537 'help-echo ,help-echo |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2538 'mouse-face ',mouse-face |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2539 'face ',face |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2540 'local-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2541 (gdb-make-header-line-mouse-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2542 'mouse-1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2543 (lambda (event) (interactive "e") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2544 (save-selected-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2545 (select-window (posn-window (event-start event))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2546 (gdb-set-window-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2547 (gdb-get-buffer-create ',buffer) t) ))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2548 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2549 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2550 ;; uses "-thread-info". Needs GDB 7.0 onwards. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2551 ;;; Threads view |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2552 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2553 (defun gdb-threads-buffer-name () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2554 (concat "*threads of " (gdb-get-target-string) "*")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2555 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2556 (def-gdb-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2557 gdb-display-threads-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2558 'gdb-threads-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2559 "Display GDB threads.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2560 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2561 (def-gdb-frame-for-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2562 gdb-frame-threads-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2563 'gdb-threads-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2564 "Display GDB threads in a new frame.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2565 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2566 (def-gdb-trigger-and-handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2567 gdb-invalidate-threads (gdb-current-context-command "-thread-info") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2568 gdb-thread-list-handler gdb-thread-list-handler-custom |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2569 '(start update update-threads)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2570 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2571 (gdb-set-buffer-rules |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2572 'gdb-threads-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2573 'gdb-threads-buffer-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2574 'gdb-threads-mode |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2575 'gdb-invalidate-threads) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2576 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2577 (defvar gdb-threads-font-lock-keywords |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2578 '(("in \\([^ ]+\\)" (1 font-lock-function-name-face)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2579 (" \\(stopped\\)" (1 font-lock-warning-face)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2580 (" \\(running\\)" (1 font-lock-string-face)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2581 ("\\(\\(\\sw\\|[_.]\\)+\\)=" (1 font-lock-variable-name-face))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2582 "Font lock keywords used in `gdb-threads-mode'.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2583 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2584 (defvar gdb-threads-mode-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2585 (let ((map (make-sparse-keymap))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2586 (define-key map "\r" 'gdb-select-thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2587 (define-key map "f" 'gdb-display-stack-for-thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2588 (define-key map "F" 'gdb-frame-stack-for-thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2589 (define-key map "l" 'gdb-display-locals-for-thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2590 (define-key map "L" 'gdb-frame-locals-for-thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2591 (define-key map "r" 'gdb-display-registers-for-thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2592 (define-key map "R" 'gdb-frame-registers-for-thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2593 (define-key map "d" 'gdb-display-disassembly-for-thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2594 (define-key map "D" 'gdb-frame-disassembly-for-thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2595 (define-key map "i" 'gdb-interrupt-thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2596 (define-key map "c" 'gdb-continue-thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2597 (define-key map "s" 'gdb-step-thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2598 (define-key map "\t" '(lambda () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2599 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2600 (gdb-set-window-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2601 (gdb-get-buffer-create 'gdb-breakpoints-buffer) t))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2602 (define-key map [mouse-2] 'gdb-select-thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2603 (define-key map [follow-link] 'mouse-face) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2604 map)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2605 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2606 (defvar gdb-threads-header |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2607 (list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2608 (gdb-propertize-header "Breakpoints" gdb-breakpoints-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2609 "mouse-1: select" mode-line-highlight mode-line-inactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2610 " " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2611 (gdb-propertize-header "Threads" gdb-threads-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2612 nil nil mode-line))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2613 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2614 (define-derived-mode gdb-threads-mode gdb-parent-mode "Threads" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2615 "Major mode for GDB threads. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2616 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2617 \\{gdb-threads-mode-map}" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2618 (setq gdb-thread-position (make-marker)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2619 (add-to-list 'overlay-arrow-variable-list 'gdb-thread-position) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2620 (setq header-line-format gdb-threads-header) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2621 (set (make-local-variable 'font-lock-defaults) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2622 '(gdb-threads-font-lock-keywords)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2623 (run-mode-hooks 'gdb-threads-mode-hook) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2624 'gdb-invalidate-threads) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2625 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2626 (defun gdb-thread-list-handler-custom () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2627 (let ((threads-list (bindat-get-field (gdb-json-partial-output) 'threads)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2628 (table (make-gdb-table)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2629 (marked-line nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2630 (setq gdb-threads-list nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2631 (setq gdb-running-threads-count 0) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2632 (setq gdb-stopped-threads-count 0) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2633 (set-marker gdb-thread-position nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2634 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2635 (dolist (thread (reverse threads-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2636 (let ((running (string-equal (bindat-get-field thread 'state) "running"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2637 (add-to-list 'gdb-threads-list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2638 (cons (bindat-get-field thread 'id) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2639 thread)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2640 (if running |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2641 (incf gdb-running-threads-count) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2642 (incf gdb-stopped-threads-count)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2643 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2644 (gdb-table-add-row table |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2645 (list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2646 (bindat-get-field thread 'id) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2647 (concat |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2648 (if gdb-thread-buffer-verbose-names |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2649 (concat (bindat-get-field thread 'target-id) " ") "") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2650 (bindat-get-field thread 'state) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2651 ;; Include frame information for stopped threads |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2652 (if (not running) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2653 (concat |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2654 " in " (bindat-get-field thread 'frame 'func) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2655 (if gdb-thread-buffer-arguments |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2656 (concat |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2657 " (" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2658 (let ((args (bindat-get-field thread 'frame 'args))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2659 (mapconcat |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2660 (lambda (arg) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2661 (apply 'format `("%s=%s" ,@(gdb-get-many-fields arg 'name 'value)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2662 args ",")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2663 ")") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2664 "") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2665 (if gdb-thread-buffer-locations |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2666 (gdb-frame-location (bindat-get-field thread 'frame)) "") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2667 (if gdb-thread-buffer-addresses |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2668 (concat " at " (bindat-get-field thread 'frame 'addr)) "")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2669 ""))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2670 (list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2671 'gdb-thread thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2672 'mouse-face 'highlight |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2673 'help-echo "mouse-2, RET: select thread"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2674 (when (string-equal gdb-thread-number |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2675 (bindat-get-field thread 'id)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2676 (setq marked-line (length gdb-threads-list)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2677 (insert (gdb-table-string table " ")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2678 (when marked-line |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2679 (gdb-mark-line marked-line gdb-thread-position))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2680 ;; We update gud-running here because we need to make sure that |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2681 ;; gdb-threads-list is up-to-date |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2682 (gdb-update-gud-running) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2683 (gdb-emit-signal gdb-buf-publisher 'update-disassembly)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2684 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2685 (defmacro def-gdb-thread-buffer-command (name custom-defun &optional doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2686 "Define a NAME command which will act upon thread on the current line. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2687 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2688 CUSTOM-DEFUN may use locally bound `thread' variable, which will |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2689 be the value of 'gdb-thread property of the current line. If |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2690 'gdb-thread is nil, error is signaled." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2691 `(defun ,name (&optional event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2692 ,(when doc doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2693 (interactive (list last-input-event)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2694 (if event (posn-set-point (event-end event))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2695 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2696 (beginning-of-line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2697 (let ((thread (get-text-property (point) 'gdb-thread))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2698 (if thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2699 ,custom-defun |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2700 (error "Not recognized as thread line")))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2701 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2702 (defmacro def-gdb-thread-buffer-simple-command (name buffer-command &optional doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2703 "Define a NAME which will call BUFFER-COMMAND with id of thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2704 on the current line." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2705 `(def-gdb-thread-buffer-command ,name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2706 (,buffer-command (bindat-get-field thread 'id)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2707 ,doc)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2708 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2709 (def-gdb-thread-buffer-command gdb-select-thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2710 (let ((new-id (bindat-get-field thread 'id))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2711 (gdb-setq-thread-number new-id) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2712 (gdb-input (list (concat "-thread-select " new-id) 'ignore)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2713 (gdb-update)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2714 "Select the thread at current line of threads buffer.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2715 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2716 (def-gdb-thread-buffer-simple-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2717 gdb-display-stack-for-thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2718 gdb-preemptively-display-stack-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2719 "Display stack buffer for the thread at current line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2720 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2721 (def-gdb-thread-buffer-simple-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2722 gdb-display-locals-for-thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2723 gdb-preemptively-display-locals-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2724 "Display locals buffer for the thread at current line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2725 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2726 (def-gdb-thread-buffer-simple-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2727 gdb-display-registers-for-thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2728 gdb-preemptively-display-registers-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2729 "Display registers buffer for the thread at current line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2730 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2731 (def-gdb-thread-buffer-simple-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2732 gdb-display-disassembly-for-thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2733 gdb-preemptively-display-disassembly-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2734 "Display disassembly buffer for the thread at current line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2735 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2736 (def-gdb-thread-buffer-simple-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2737 gdb-frame-stack-for-thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2738 gdb-frame-stack-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2739 "Display a new frame with stack buffer for the thread at |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2740 current line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2741 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2742 (def-gdb-thread-buffer-simple-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2743 gdb-frame-locals-for-thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2744 gdb-frame-locals-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2745 "Display a new frame with locals buffer for the thread at |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2746 current line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2747 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2748 (def-gdb-thread-buffer-simple-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2749 gdb-frame-registers-for-thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2750 gdb-frame-registers-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2751 "Display a new frame with registers buffer for the thread at |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2752 current line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2753 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2754 (def-gdb-thread-buffer-simple-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2755 gdb-frame-disassembly-for-thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2756 gdb-frame-disassembly-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2757 "Display a new frame with disassembly buffer for the thread at |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2758 current line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2759 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2760 (defmacro def-gdb-thread-buffer-gud-command (name gud-command &optional doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2761 "Define a NAME which will execute GUD-COMMAND with |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2762 `gdb-thread-number' locally bound to id of thread on the current |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2763 line." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2764 `(def-gdb-thread-buffer-command ,name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2765 (if gdb-non-stop |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2766 (let ((gdb-thread-number (bindat-get-field thread 'id)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2767 (gdb-gud-control-all-threads nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2768 (call-interactively #',gud-command)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2769 (error "Available in non-stop mode only, customize `gdb-non-stop-setting'")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2770 ,doc)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2771 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2772 (def-gdb-thread-buffer-gud-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2773 gdb-interrupt-thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2774 gud-stop-subjob |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2775 "Interrupt thread at current line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2776 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2777 (def-gdb-thread-buffer-gud-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2778 gdb-continue-thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2779 gud-cont |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2780 "Continue thread at current line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2781 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2782 (def-gdb-thread-buffer-gud-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2783 gdb-step-thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2784 gud-step |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2785 "Step thread at current line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2786 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2787 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2788 ;;; Memory view |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2789 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2790 (defcustom gdb-memory-rows 8 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2791 "Number of data rows in memory window." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2792 :type 'integer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2793 :group 'gud |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2794 :version "23.2") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2795 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2796 (defcustom gdb-memory-columns 4 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2797 "Number of data columns in memory window." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2798 :type 'integer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2799 :group 'gud |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2800 :version "23.2") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2801 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2802 (defcustom gdb-memory-format "x" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2803 "Display format of data items in memory window." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2804 :type '(choice (const :tag "Hexadecimal" "x") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2805 (const :tag "Signed decimal" "d") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2806 (const :tag "Unsigned decimal" "u") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2807 (const :tag "Octal" "o") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2808 (const :tag "Binary" "t")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2809 :group 'gud |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2810 :version "22.1") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2811 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2812 (defcustom gdb-memory-unit 4 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2813 "Unit size of data items in memory window." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2814 :type '(choice (const :tag "Byte" 1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2815 (const :tag "Halfword" 2) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2816 (const :tag "Word" 4) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2817 (const :tag "Giant word" 8)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2818 :group 'gud |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2819 :version "23.2") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2820 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2821 (def-gdb-trigger-and-handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2822 gdb-invalidate-memory |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2823 (format "-data-read-memory %s %s %d %d %d" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2824 gdb-memory-address |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2825 gdb-memory-format |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2826 gdb-memory-unit |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2827 gdb-memory-rows |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2828 gdb-memory-columns) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2829 gdb-read-memory-handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2830 gdb-read-memory-custom |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2831 '(start update)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2832 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2833 (gdb-set-buffer-rules |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2834 'gdb-memory-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2835 'gdb-memory-buffer-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2836 'gdb-memory-mode |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2837 'gdb-invalidate-memory) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2838 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2839 (defun gdb-memory-column-width (size format) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2840 "Return length of string with memory unit of SIZE in FORMAT. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2841 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2842 SIZE is in bytes, as in `gdb-memory-unit'. FORMAT is a string as |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2843 in `gdb-memory-format'." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2844 (let ((format-base (cdr (assoc format |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2845 '(("x" . 16) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2846 ("d" . 10) ("u" . 10) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2847 ("o" . 8) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2848 ("t" . 2)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2849 (if format-base |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2850 (let ((res (ceiling (log (expt 2.0 (* size 8)) format-base)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2851 (cond ((string-equal format "x") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2852 (+ 2 res)) ; hexadecimal numbers have 0x in front |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2853 ((or (string-equal format "d") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2854 (string-equal format "o")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2855 (1+ res)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2856 (t res))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2857 (error "Unknown format")))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2858 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2859 (defun gdb-read-memory-custom () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2860 (let* ((res (gdb-json-partial-output)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2861 (err-msg (bindat-get-field res 'msg))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2862 (if (not err-msg) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2863 (let ((memory (bindat-get-field res 'memory))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2864 (setq gdb-memory-address (bindat-get-field res 'addr)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2865 (setq gdb-memory-next-page (bindat-get-field res 'next-page)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2866 (setq gdb-memory-prev-page (bindat-get-field res 'prev-page)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2867 (setq gdb-memory-last-address gdb-memory-address) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2868 (dolist (row memory) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2869 (insert (concat (bindat-get-field row 'addr) ":")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2870 (dolist (column (bindat-get-field row 'data)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2871 (insert (gdb-pad-string column |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2872 (+ 2 (gdb-memory-column-width |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2873 gdb-memory-unit |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2874 gdb-memory-format))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2875 (newline))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2876 ;; Show last page instead of empty buffer when out of bounds |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2877 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2878 (let ((gdb-memory-address gdb-memory-last-address)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2879 (gdb-invalidate-memory 'update) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2880 (error err-msg)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2881 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2882 (defvar gdb-memory-mode-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2883 (let ((map (make-sparse-keymap))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2884 (suppress-keymap map t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2885 (define-key map "q" 'kill-this-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2886 (define-key map "n" 'gdb-memory-show-next-page) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2887 (define-key map "p" 'gdb-memory-show-previous-page) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2888 (define-key map "a" 'gdb-memory-set-address) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2889 (define-key map "t" 'gdb-memory-format-binary) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2890 (define-key map "o" 'gdb-memory-format-octal) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2891 (define-key map "u" 'gdb-memory-format-unsigned) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2892 (define-key map "d" 'gdb-memory-format-signed) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2893 (define-key map "x" 'gdb-memory-format-hexadecimal) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2894 (define-key map "b" 'gdb-memory-unit-byte) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2895 (define-key map "h" 'gdb-memory-unit-halfword) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2896 (define-key map "w" 'gdb-memory-unit-word) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2897 (define-key map "g" 'gdb-memory-unit-giant) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2898 (define-key map "R" 'gdb-memory-set-rows) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2899 (define-key map "C" 'gdb-memory-set-columns) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2900 map)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2901 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2902 (defun gdb-memory-set-address-event (event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2903 "Handle a click on address field in memory buffer header." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2904 (interactive "e") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2905 (save-selected-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2906 (select-window (posn-window (event-start event))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2907 (gdb-memory-set-address))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2908 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2909 ;; Non-event version for use within keymap |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2910 (defun gdb-memory-set-address () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2911 "Set the start memory address." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2912 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2913 (let ((arg (read-from-minibuffer "Memory address: "))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2914 (setq gdb-memory-address arg)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2915 (gdb-invalidate-memory 'update)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2916 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2917 (defmacro def-gdb-set-positive-number (name variable echo-string &optional doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2918 "Define a function NAME which reads new VAR value from minibuffer." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2919 `(defun ,name (event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2920 ,(when doc doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2921 (interactive "e") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2922 (save-selected-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2923 (select-window (posn-window (event-start event))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2924 (let* ((arg (read-from-minibuffer ,echo-string)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2925 (count (string-to-number arg))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2926 (if (<= count 0) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2927 (error "Positive number only") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2928 (customize-set-variable ',variable count) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2929 (gdb-invalidate-memory 'update)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2930 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2931 (def-gdb-set-positive-number |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2932 gdb-memory-set-rows |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2933 gdb-memory-rows |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2934 "Rows: " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2935 "Set the number of data rows in memory window.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2936 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2937 (def-gdb-set-positive-number |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2938 gdb-memory-set-columns |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2939 gdb-memory-columns |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2940 "Columns: " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2941 "Set the number of data columns in memory window.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2942 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2943 (defmacro def-gdb-memory-format (name format doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2944 "Define a function NAME to switch memory buffer to use FORMAT. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2945 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2946 DOC is an optional documentation string." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2947 `(defun ,name () ,(when doc doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2948 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2949 (customize-set-variable 'gdb-memory-format ,format) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2950 (gdb-invalidate-memory 'update))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2951 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2952 (def-gdb-memory-format |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2953 gdb-memory-format-binary "t" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2954 "Set the display format to binary.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2955 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2956 (def-gdb-memory-format |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2957 gdb-memory-format-octal "o" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2958 "Set the display format to octal.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2959 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2960 (def-gdb-memory-format |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2961 gdb-memory-format-unsigned "u" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2962 "Set the display format to unsigned decimal.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2963 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2964 (def-gdb-memory-format |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2965 gdb-memory-format-signed "d" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2966 "Set the display format to decimal.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2967 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2968 (def-gdb-memory-format |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2969 gdb-memory-format-hexadecimal "x" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2970 "Set the display format to hexadecimal.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2971 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2972 (defvar gdb-memory-format-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2973 (let ((map (make-sparse-keymap))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2974 (define-key map [header-line down-mouse-3] 'gdb-memory-format-menu-1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2975 map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2976 "Keymap to select format in the header line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2977 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2978 (defvar gdb-memory-format-menu (make-sparse-keymap "Format") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2979 "Menu of display formats in the header line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2980 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2981 (define-key gdb-memory-format-menu [binary] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2982 '(menu-item "Binary" gdb-memory-format-binary |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2983 :button (:radio . (equal gdb-memory-format "t")))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2984 (define-key gdb-memory-format-menu [octal] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2985 '(menu-item "Octal" gdb-memory-format-octal |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2986 :button (:radio . (equal gdb-memory-format "o")))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2987 (define-key gdb-memory-format-menu [unsigned] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2988 '(menu-item "Unsigned Decimal" gdb-memory-format-unsigned |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2989 :button (:radio . (equal gdb-memory-format "u")))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2990 (define-key gdb-memory-format-menu [signed] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2991 '(menu-item "Signed Decimal" gdb-memory-format-signed |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2992 :button (:radio . (equal gdb-memory-format "d")))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2993 (define-key gdb-memory-format-menu [hexadecimal] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2994 '(menu-item "Hexadecimal" gdb-memory-format-hexadecimal |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2995 :button (:radio . (equal gdb-memory-format "x")))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2996 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2997 (defun gdb-memory-format-menu (event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2998 (interactive "@e") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2999 (x-popup-menu event gdb-memory-format-menu)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3000 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3001 (defun gdb-memory-format-menu-1 (event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3002 (interactive "e") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3003 (save-selected-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3004 (select-window (posn-window (event-start event))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3005 (let* ((selection (gdb-memory-format-menu event)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3006 (binding (and selection (lookup-key gdb-memory-format-menu |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3007 (vector (car selection)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3008 (if binding (call-interactively binding))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3009 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3010 (defmacro def-gdb-memory-unit (name unit-size doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3011 "Define a function NAME to switch memory unit size to UNIT-SIZE. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3012 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3013 DOC is an optional documentation string." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3014 `(defun ,name () ,(when doc doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3015 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3016 (customize-set-variable 'gdb-memory-unit ,unit-size) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3017 (gdb-invalidate-memory 'update))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3018 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3019 (def-gdb-memory-unit gdb-memory-unit-giant 8 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3020 "Set the unit size to giant words (eight bytes).") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3021 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3022 (def-gdb-memory-unit gdb-memory-unit-word 4 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3023 "Set the unit size to words (four bytes).") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3024 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3025 (def-gdb-memory-unit gdb-memory-unit-halfword 2 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3026 "Set the unit size to halfwords (two bytes).") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3027 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3028 (def-gdb-memory-unit gdb-memory-unit-byte 1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3029 "Set the unit size to bytes.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3030 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3031 (defmacro def-gdb-memory-show-page (name address-var &optional doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3032 "Define a function NAME which show new address in memory buffer. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3033 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3034 The defined function switches Memory buffer to show address |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3035 stored in ADDRESS-VAR variable. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3036 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3037 DOC is an optional documentation string." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3038 `(defun ,name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3039 ,(when doc doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3040 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3041 (let ((gdb-memory-address ,address-var)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3042 (gdb-invalidate-memory)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3043 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3044 (def-gdb-memory-show-page gdb-memory-show-previous-page |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3045 gdb-memory-prev-page) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3046 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3047 (def-gdb-memory-show-page gdb-memory-show-next-page |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3048 gdb-memory-next-page) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3049 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3050 (defvar gdb-memory-unit-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3051 (let ((map (make-sparse-keymap))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3052 (define-key map [header-line down-mouse-3] 'gdb-memory-unit-menu-1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3053 map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3054 "Keymap to select units in the header line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3055 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3056 (defvar gdb-memory-unit-menu (make-sparse-keymap "Unit") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3057 "Menu of units in the header line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3058 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3059 (define-key gdb-memory-unit-menu [giantwords] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3060 '(menu-item "Giant words" gdb-memory-unit-giant |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3061 :button (:radio . (equal gdb-memory-unit 8)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3062 (define-key gdb-memory-unit-menu [words] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3063 '(menu-item "Words" gdb-memory-unit-word |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3064 :button (:radio . (equal gdb-memory-unit 4)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3065 (define-key gdb-memory-unit-menu [halfwords] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3066 '(menu-item "Halfwords" gdb-memory-unit-halfword |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3067 :button (:radio . (equal gdb-memory-unit 2)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3068 (define-key gdb-memory-unit-menu [bytes] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3069 '(menu-item "Bytes" gdb-memory-unit-byte |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3070 :button (:radio . (equal gdb-memory-unit 1)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3071 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3072 (defun gdb-memory-unit-menu (event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3073 (interactive "@e") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3074 (x-popup-menu event gdb-memory-unit-menu)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3075 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3076 (defun gdb-memory-unit-menu-1 (event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3077 (interactive "e") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3078 (save-selected-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3079 (select-window (posn-window (event-start event))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3080 (let* ((selection (gdb-memory-unit-menu event)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3081 (binding (and selection (lookup-key gdb-memory-unit-menu |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3082 (vector (car selection)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3083 (if binding (call-interactively binding))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3084 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3085 (defvar gdb-memory-font-lock-keywords |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3086 '(;; <__function.name+n> |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3087 ("<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>" (1 font-lock-function-name-face)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3088 ) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3089 "Font lock keywords used in `gdb-memory-mode'.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3090 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3091 (defvar gdb-memory-header |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3092 '(:eval |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3093 (concat |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3094 "Start address[" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3095 (propertize "-" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3096 'face font-lock-warning-face |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3097 'help-echo "mouse-1: decrement address" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3098 'mouse-face 'mode-line-highlight |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3099 'local-map (gdb-make-header-line-mouse-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3100 'mouse-1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3101 #'gdb-memory-show-previous-page)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3102 "|" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3103 (propertize "+" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3104 'face font-lock-warning-face |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3105 'help-echo "mouse-1: increment address" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3106 'mouse-face 'mode-line-highlight |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3107 'local-map (gdb-make-header-line-mouse-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3108 'mouse-1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3109 #'gdb-memory-show-next-page)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3110 "]: " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3111 (propertize gdb-memory-address |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3112 'face font-lock-warning-face |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3113 'help-echo "mouse-1: set start address" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3114 'mouse-face 'mode-line-highlight |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3115 'local-map (gdb-make-header-line-mouse-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3116 'mouse-1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3117 #'gdb-memory-set-address-event)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3118 " Rows: " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3119 (propertize (number-to-string gdb-memory-rows) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3120 'face font-lock-warning-face |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3121 'help-echo "mouse-1: set number of columns" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3122 'mouse-face 'mode-line-highlight |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3123 'local-map (gdb-make-header-line-mouse-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3124 'mouse-1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3125 #'gdb-memory-set-rows)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3126 " Columns: " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3127 (propertize (number-to-string gdb-memory-columns) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3128 'face font-lock-warning-face |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3129 'help-echo "mouse-1: set number of columns" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3130 'mouse-face 'mode-line-highlight |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3131 'local-map (gdb-make-header-line-mouse-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3132 'mouse-1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3133 #'gdb-memory-set-columns)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3134 " Display Format: " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3135 (propertize gdb-memory-format |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3136 'face font-lock-warning-face |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3137 'help-echo "mouse-3: select display format" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3138 'mouse-face 'mode-line-highlight |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3139 'local-map gdb-memory-format-map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3140 " Unit Size: " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3141 (propertize (number-to-string gdb-memory-unit) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3142 'face font-lock-warning-face |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3143 'help-echo "mouse-3: select unit size" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3144 'mouse-face 'mode-line-highlight |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3145 'local-map gdb-memory-unit-map))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3146 "Header line used in `gdb-memory-mode'.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3147 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3148 (define-derived-mode gdb-memory-mode gdb-parent-mode "Memory" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3149 "Major mode for examining memory. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3150 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3151 \\{gdb-memory-mode-map}" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3152 (setq header-line-format gdb-memory-header) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3153 (set (make-local-variable 'font-lock-defaults) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3154 '(gdb-memory-font-lock-keywords)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3155 (run-mode-hooks 'gdb-memory-mode-hook) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3156 'gdb-invalidate-memory) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3157 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3158 (defun gdb-memory-buffer-name () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3159 (concat "*memory of " (gdb-get-target-string) "*")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3160 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3161 (def-gdb-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3162 gdb-display-memory-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3163 'gdb-memory-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3164 "Display memory contents.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3165 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3166 (defun gdb-frame-memory-buffer () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3167 "Display memory contents in a new frame." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3168 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3169 (let* ((special-display-regexps (append special-display-regexps '(".*"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3170 (special-display-frame-alist |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3171 `((left-fringe . 0) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3172 (right-fringe . 0) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3173 (width . 83) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3174 ,@gdb-frame-parameters))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3175 (display-buffer (gdb-get-buffer-create 'gdb-memory-buffer)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3176 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3177 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3178 ;;; Disassembly view |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3179 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3180 (defun gdb-disassembly-buffer-name () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3181 (gdb-current-context-buffer-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3182 (concat "disassembly of " (gdb-get-target-string)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3183 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3184 (def-gdb-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3185 gdb-display-disassembly-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3186 'gdb-disassembly-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3187 "Display disassembly for current stack frame.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3188 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3189 (def-gdb-preempt-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3190 gdb-preemptively-display-disassembly-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3191 'gdb-disassembly-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3192 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3193 (def-gdb-frame-for-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3194 gdb-frame-disassembly-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3195 'gdb-disassembly-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3196 "Display disassembly in a new frame.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3197 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3198 (def-gdb-auto-update-trigger gdb-invalidate-disassembly |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3199 (let* ((frame (gdb-current-buffer-frame)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3200 (file (bindat-get-field frame 'fullname)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3201 (line (bindat-get-field frame 'line))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3202 (when file |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3203 (format "-data-disassemble -f %s -l %s -n -1 -- 0" file line))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3204 gdb-disassembly-handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3205 ;; We update disassembly only after we have actual frame information |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3206 ;; about all threads, so no there's `update' signal in this list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3207 '(start update-disassembly)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3208 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3209 (def-gdb-auto-update-handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3210 gdb-disassembly-handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3211 gdb-invalidate-disassembly |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3212 gdb-disassembly-handler-custom |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3213 t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3214 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3215 (gdb-set-buffer-rules |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3216 'gdb-disassembly-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3217 'gdb-disassembly-buffer-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3218 'gdb-disassembly-mode |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3219 'gdb-invalidate-disassembly) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3220 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3221 (defvar gdb-disassembly-font-lock-keywords |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3222 '(;; <__function.name+n> |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3223 ("<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3224 (1 font-lock-function-name-face)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3225 ;; 0xNNNNNNNN <__function.name+n>: opcode |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3226 ("^0x[0-9a-f]+ \\(<\\(\\(\\sw\\|[_.]\\)+\\)\\+[0-9]+>\\)?:[ \t]+\\(\\sw+\\)" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3227 (4 font-lock-keyword-face)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3228 ;; %register(at least i386) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3229 ("%\\sw+" . font-lock-variable-name-face) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3230 ("^\\(Dump of assembler code for function\\) \\(.+\\):" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3231 (1 font-lock-comment-face) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3232 (2 font-lock-function-name-face)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3233 ("^\\(End of assembler dump\\.\\)" . font-lock-comment-face)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3234 "Font lock keywords used in `gdb-disassembly-mode'.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3235 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3236 (defvar gdb-disassembly-mode-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3237 ;; TODO |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3238 (let ((map (make-sparse-keymap))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3239 (suppress-keymap map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3240 (define-key map "q" 'kill-this-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3241 map)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3242 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3243 (define-derived-mode gdb-disassembly-mode gdb-parent-mode "Disassembly" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3244 "Major mode for GDB disassembly information. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3245 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3246 \\{gdb-disassembly-mode-map}" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3247 ;; TODO Rename overlay variable for disassembly mode |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3248 (add-to-list 'overlay-arrow-variable-list 'gdb-disassembly-position) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3249 (setq fringes-outside-margins t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3250 (set (make-local-variable 'gdb-disassembly-position) (make-marker)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3251 (set (make-local-variable 'font-lock-defaults) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3252 '(gdb-disassembly-font-lock-keywords)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3253 (run-mode-hooks 'gdb-disassembly-mode-hook) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3254 'gdb-invalidate-disassembly) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3255 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3256 (defun gdb-disassembly-handler-custom () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3257 (let* ((instructions (bindat-get-field (gdb-json-partial-output) 'asm_insns)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3258 (address (bindat-get-field (gdb-current-buffer-frame) 'addr)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3259 (pos 1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3260 (table (make-gdb-table)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3261 (marked-line nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3262 (dolist (instr instructions) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3263 (gdb-table-add-row table |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3264 (list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3265 (bindat-get-field instr 'address) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3266 (apply 'format `("<%s+%s>:" ,@(gdb-get-many-fields instr 'func-name 'offset))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3267 (bindat-get-field instr 'inst))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3268 (when (string-equal (bindat-get-field instr 'address) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3269 address) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3270 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3271 (setq marked-line (length (gdb-table-rows table))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3272 (setq fringe-indicator-alist |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3273 (if (string-equal gdb-frame-number "0") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3274 nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3275 '((overlay-arrow . hollow-right-triangle))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3276 (insert (gdb-table-string table " ")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3277 (gdb-disassembly-place-breakpoints) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3278 ;; Mark current position with overlay arrow and scroll window to |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3279 ;; that point |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3280 (when marked-line |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3281 (let ((window (get-buffer-window (current-buffer) 0))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3282 (set-window-point window (gdb-mark-line marked-line gdb-disassembly-position)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3283 (setq mode-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3284 (gdb-current-context-mode-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3285 (concat "Disassembly: " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3286 (bindat-get-field (gdb-current-buffer-frame) 'func)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3287 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3288 (defun gdb-disassembly-place-breakpoints () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3289 (gdb-remove-breakpoint-icons (point-min) (point-max)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3290 (dolist (breakpoint gdb-breakpoints-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3291 (let* ((breakpoint (cdr breakpoint)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3292 (bptno (bindat-get-field breakpoint 'number)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3293 (flag (bindat-get-field breakpoint 'enabled)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3294 (address (bindat-get-field breakpoint 'addr))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3295 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3296 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3297 (if (re-search-forward (concat "^" address) nil t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3298 (gdb-put-breakpoint-icon (string-equal flag "y") bptno)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3299 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3300 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3301 (defvar gdb-breakpoints-header |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3302 (list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3303 (gdb-propertize-header "Breakpoints" gdb-breakpoints-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3304 nil nil mode-line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3305 " " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3306 (gdb-propertize-header "Threads" gdb-threads-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3307 "mouse-1: select" mode-line-highlight mode-line-inactive))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3308 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3309 ;;; Breakpoints view |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3310 (define-derived-mode gdb-breakpoints-mode gdb-parent-mode "Breakpoints" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3311 "Major mode for gdb breakpoints. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3312 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3313 \\{gdb-breakpoints-mode-map}" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3314 (setq header-line-format gdb-breakpoints-header) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3315 (run-mode-hooks 'gdb-breakpoints-mode-hook) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3316 'gdb-invalidate-breakpoints) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3317 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3318 (defun gdb-toggle-breakpoint () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3319 "Enable/disable breakpoint at current line of breakpoints buffer." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3320 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3321 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3322 (beginning-of-line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3323 (let ((breakpoint (get-text-property (point) 'gdb-breakpoint))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3324 (if breakpoint |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3325 (gud-basic-call |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3326 (concat (if (string-equal "y" (bindat-get-field breakpoint 'enabled)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3327 "-break-disable " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3328 "-break-enable ") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3329 (bindat-get-field breakpoint 'number))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3330 (error "Not recognized as break/watchpoint line"))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3331 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3332 (defun gdb-delete-breakpoint () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3333 "Delete the breakpoint at current line of breakpoints buffer." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3334 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3335 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3336 (beginning-of-line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3337 (let ((breakpoint (get-text-property (point) 'gdb-breakpoint))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3338 (if breakpoint |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3339 (gud-basic-call (concat "-break-delete " (bindat-get-field breakpoint 'number))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3340 (error "Not recognized as break/watchpoint line"))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3341 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3342 (defun gdb-goto-breakpoint (&optional event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3343 "Go to the location of breakpoint at current line of |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3344 breakpoints buffer." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3345 (interactive (list last-input-event)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3346 (if event (posn-set-point (event-end event))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3347 ;; Hack to stop gdb-goto-breakpoint displaying in GUD buffer. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3348 (let ((window (get-buffer-window gud-comint-buffer))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3349 (if window (save-selected-window (select-window window)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3350 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3351 (beginning-of-line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3352 (let ((breakpoint (get-text-property (point) 'gdb-breakpoint))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3353 (if breakpoint |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3354 (let ((bptno (bindat-get-field breakpoint 'number)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3355 (file (bindat-get-field breakpoint 'fullname)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3356 (line (bindat-get-field breakpoint 'line))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3357 (save-selected-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3358 (let* ((buffer (find-file-noselect |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3359 (if (file-exists-p file) file |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3360 (cdr (assoc bptno gdb-location-alist))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3361 (window (or (gdb-display-source-buffer buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3362 (display-buffer buffer)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3363 (setq gdb-source-window window) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3364 (with-current-buffer buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3365 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3366 (forward-line (1- (string-to-number line))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3367 (set-window-point window (point)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3368 (error "Not recognized as break/watchpoint line"))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3369 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3370 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3371 ;; Frames buffer. This displays a perpetually correct bactrack trace. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3372 ;; |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3373 (def-gdb-trigger-and-handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3374 gdb-invalidate-frames (gdb-current-context-command "-stack-list-frames") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3375 gdb-stack-list-frames-handler gdb-stack-list-frames-custom |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3376 '(start update)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3377 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3378 (gdb-set-buffer-rules |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3379 'gdb-stack-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3380 'gdb-stack-buffer-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3381 'gdb-frames-mode |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3382 'gdb-invalidate-frames) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3383 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3384 (defun gdb-frame-location (frame) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3385 "Return \" of file:line\" or \" of library\" for structure FRAME. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3386 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3387 FRAME must have either \"file\" and \"line\" members or \"from\" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3388 member." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3389 (let ((file (bindat-get-field frame 'file)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3390 (line (bindat-get-field frame 'line)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3391 (from (bindat-get-field frame 'from))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3392 (let ((res (or (and file line (concat file ":" line)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3393 from))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3394 (if res (concat " of " res) "")))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3395 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3396 (defun gdb-stack-list-frames-custom () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3397 (let ((stack (bindat-get-field (gdb-json-partial-output "frame") 'stack)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3398 (table (make-gdb-table))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3399 (set-marker gdb-stack-position nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3400 (dolist (frame stack) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3401 (gdb-table-add-row table |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3402 (list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3403 (bindat-get-field frame 'level) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3404 "in" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3405 (concat |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3406 (bindat-get-field frame 'func) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3407 (if gdb-stack-buffer-locations |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3408 (gdb-frame-location frame) "") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3409 (if gdb-stack-buffer-addresses |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3410 (concat " at " (bindat-get-field frame 'addr)) ""))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3411 `(mouse-face highlight |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3412 help-echo "mouse-2, RET: Select frame" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3413 gdb-frame ,frame))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3414 (insert (gdb-table-string table " "))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3415 (when (and gdb-frame-number |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3416 (gdb-buffer-shows-main-thread-p)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3417 (gdb-mark-line (1+ (string-to-number gdb-frame-number)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3418 gdb-stack-position)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3419 (setq mode-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3420 (gdb-current-context-mode-name "Frames"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3421 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3422 (defun gdb-stack-buffer-name () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3423 (gdb-current-context-buffer-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3424 (concat "stack frames of " (gdb-get-target-string)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3425 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3426 (def-gdb-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3427 gdb-display-stack-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3428 'gdb-stack-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3429 "Display backtrace of current stack.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3430 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3431 (def-gdb-preempt-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3432 gdb-preemptively-display-stack-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3433 'gdb-stack-buffer nil t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3434 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3435 (def-gdb-frame-for-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3436 gdb-frame-stack-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3437 'gdb-stack-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3438 "Display backtrace of current stack in a new frame.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3439 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3440 (defvar gdb-frames-mode-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3441 (let ((map (make-sparse-keymap))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3442 (suppress-keymap map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3443 (define-key map "q" 'kill-this-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3444 (define-key map "\r" 'gdb-select-frame) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3445 (define-key map [mouse-2] 'gdb-select-frame) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3446 (define-key map [follow-link] 'mouse-face) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3447 map)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3448 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3449 (defvar gdb-frames-font-lock-keywords |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3450 '(("in \\([^ ]+\\)" (1 font-lock-function-name-face))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3451 "Font lock keywords used in `gdb-frames-mode'.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3452 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3453 (define-derived-mode gdb-frames-mode gdb-parent-mode "Frames" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3454 "Major mode for gdb call stack. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3455 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3456 \\{gdb-frames-mode-map}" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3457 (setq gdb-stack-position (make-marker)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3458 (add-to-list 'overlay-arrow-variable-list 'gdb-stack-position) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3459 (setq truncate-lines t) ;; Make it easier to see overlay arrow. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3460 (set (make-local-variable 'font-lock-defaults) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3461 '(gdb-frames-font-lock-keywords)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3462 (run-mode-hooks 'gdb-frames-mode-hook) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3463 'gdb-invalidate-frames) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3464 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3465 (defun gdb-select-frame (&optional event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3466 "Select the frame and display the relevant source." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3467 (interactive (list last-input-event)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3468 (if event (posn-set-point (event-end event))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3469 (let ((frame (get-text-property (point) 'gdb-frame))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3470 (if frame |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3471 (if (gdb-buffer-shows-main-thread-p) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3472 (let ((new-level (bindat-get-field frame 'level))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3473 (setq gdb-frame-number new-level) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3474 (gdb-input (list (concat "-stack-select-frame " new-level) 'ignore)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3475 (gdb-update)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3476 (error "Could not select frame for non-current thread")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3477 (error "Not recognized as frame line")))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3478 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3479 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3480 ;; Locals buffer. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3481 ;; uses "-stack-list-locals --simple-values". Needs GDB 6.1 onwards. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3482 (def-gdb-trigger-and-handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3483 gdb-invalidate-locals |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3484 (concat (gdb-current-context-command "-stack-list-locals") " --simple-values") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3485 gdb-locals-handler gdb-locals-handler-custom |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3486 '(start update)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3487 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3488 (gdb-set-buffer-rules |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3489 'gdb-locals-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3490 'gdb-locals-buffer-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3491 'gdb-locals-mode |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3492 'gdb-invalidate-locals) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3493 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3494 (defvar gdb-locals-watch-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3495 (let ((map (make-sparse-keymap))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3496 (suppress-keymap map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3497 (define-key map "\r" 'gud-watch) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3498 (define-key map [mouse-2] 'gud-watch) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3499 map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3500 "Keymap to create watch expression of a complex data type local variable.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3501 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3502 (defvar gdb-edit-locals-map-1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3503 (let ((map (make-sparse-keymap))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3504 (suppress-keymap map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3505 (define-key map "\r" 'gdb-edit-locals-value) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3506 (define-key map [mouse-2] 'gdb-edit-locals-value) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3507 map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3508 "Keymap to edit value of a simple data type local variable.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3509 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3510 (defun gdb-edit-locals-value (&optional event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3511 "Assign a value to a variable displayed in the locals buffer." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3512 (interactive (list last-input-event)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3513 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3514 (if event (posn-set-point (event-end event))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3515 (beginning-of-line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3516 (let* ((var (bindat-get-field |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3517 (get-text-property (point) 'gdb-local-variable) 'name)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3518 (value (read-string (format "New value (%s): " var)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3519 (gud-basic-call |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3520 (concat "-gdb-set variable " var " = " value))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3521 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3522 ;; Dont display values of arrays or structures. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3523 ;; These can be expanded using gud-watch. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3524 (defun gdb-locals-handler-custom () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3525 (let ((locals-list (bindat-get-field (gdb-json-partial-output) 'locals)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3526 (table (make-gdb-table))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3527 (dolist (local locals-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3528 (let ((name (bindat-get-field local 'name)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3529 (value (bindat-get-field local 'value)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3530 (type (bindat-get-field local 'type))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3531 (if (or (not value) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3532 (string-match "\\0x" value)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3533 (add-text-properties 0 (length name) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3534 `(mouse-face highlight |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3535 help-echo "mouse-2: create watch expression" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3536 local-map ,gdb-locals-watch-map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3537 name) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3538 (add-text-properties 0 (length value) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3539 `(mouse-face highlight |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3540 help-echo "mouse-2: edit value" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3541 local-map ,gdb-edit-locals-map-1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3542 value)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3543 (gdb-table-add-row |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3544 table |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3545 (list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3546 (propertize type 'font-lock-face font-lock-type-face) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3547 (propertize name 'font-lock-face font-lock-variable-name-face) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3548 value) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3549 `(gdb-local-variable ,local)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3550 (insert (gdb-table-string table " ")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3551 (setq mode-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3552 (gdb-current-context-mode-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3553 (concat "Locals: " (bindat-get-field (gdb-current-buffer-frame) 'func)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3554 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3555 (defvar gdb-locals-header |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3556 (list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3557 (gdb-propertize-header "Locals" gdb-locals-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3558 nil nil mode-line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3559 " " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3560 (gdb-propertize-header "Registers" gdb-registers-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3561 "mouse-1: select" mode-line-highlight mode-line-inactive))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3562 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3563 (defvar gdb-locals-mode-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3564 (let ((map (make-sparse-keymap))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3565 (suppress-keymap map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3566 (define-key map "q" 'kill-this-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3567 (define-key map "\t" '(lambda () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3568 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3569 (gdb-set-window-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3570 (gdb-get-buffer-create |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3571 'gdb-registers-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3572 gdb-thread-number) t))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3573 map)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3574 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3575 (define-derived-mode gdb-locals-mode gdb-parent-mode "Locals" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3576 "Major mode for gdb locals. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3577 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3578 \\{gdb-locals-mode-map}" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3579 (setq header-line-format gdb-locals-header) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3580 (run-mode-hooks 'gdb-locals-mode-hook) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3581 'gdb-invalidate-locals) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3582 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3583 (defun gdb-locals-buffer-name () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3584 (gdb-current-context-buffer-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3585 (concat "locals of " (gdb-get-target-string)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3586 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3587 (def-gdb-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3588 gdb-display-locals-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3589 'gdb-locals-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3590 "Display local variables of current stack and their values.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3591 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3592 (def-gdb-preempt-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3593 gdb-preemptively-display-locals-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3594 'gdb-locals-buffer nil t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3595 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3596 (def-gdb-frame-for-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3597 gdb-frame-locals-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3598 'gdb-locals-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3599 "Display local variables of current stack and their values in a new frame.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3600 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3601 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3602 ;; Registers buffer. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3603 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3604 (def-gdb-trigger-and-handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3605 gdb-invalidate-registers |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3606 (concat (gdb-current-context-command "-data-list-register-values") " x") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3607 gdb-registers-handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3608 gdb-registers-handler-custom |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3609 '(start update)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3610 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3611 (gdb-set-buffer-rules |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3612 'gdb-registers-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3613 'gdb-registers-buffer-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3614 'gdb-registers-mode |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3615 'gdb-invalidate-registers) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3616 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3617 (defun gdb-registers-handler-custom () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3618 (when gdb-register-names |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3619 (let ((register-values (bindat-get-field (gdb-json-partial-output) 'register-values)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3620 (table (make-gdb-table))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3621 (dolist (register register-values) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3622 (let* ((register-number (bindat-get-field register 'number)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3623 (value (bindat-get-field register 'value)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3624 (register-name (nth (string-to-number register-number) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3625 gdb-register-names))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3626 (gdb-table-add-row |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3627 table |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3628 (list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3629 (propertize register-name 'font-lock-face font-lock-variable-name-face) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3630 (if (member register-number gdb-changed-registers) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3631 (propertize value 'font-lock-face font-lock-warning-face) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3632 value)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3633 `(mouse-face highlight |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3634 help-echo "mouse-2: edit value" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3635 gdb-register-name ,register-name)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3636 (insert (gdb-table-string table " "))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3637 (setq mode-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3638 (gdb-current-context-mode-name "Registers")))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3639 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3640 (defun gdb-edit-register-value (&optional event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3641 "Assign a value to a register displayed in the registers buffer." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3642 (interactive (list last-input-event)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3643 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3644 (if event (posn-set-point (event-end event))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3645 (beginning-of-line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3646 (let* ((var (bindat-get-field |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3647 (get-text-property (point) 'gdb-register-name))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3648 (value (read-string (format "New value (%s): " var)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3649 (gud-basic-call |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3650 (concat "-gdb-set variable $" var " = " value))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3651 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3652 (defvar gdb-registers-mode-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3653 (let ((map (make-sparse-keymap))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3654 (suppress-keymap map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3655 (define-key map "\r" 'gdb-edit-register-value) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3656 (define-key map [mouse-2] 'gdb-edit-register-value) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3657 (define-key map "q" 'kill-this-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3658 (define-key map "\t" '(lambda () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3659 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3660 (gdb-set-window-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3661 (gdb-get-buffer-create |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3662 'gdb-locals-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3663 gdb-thread-number) t))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3664 map)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3665 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3666 (defvar gdb-registers-header |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3667 (list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3668 (gdb-propertize-header "Locals" gdb-locals-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3669 "mouse-1: select" mode-line-highlight mode-line-inactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3670 " " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3671 (gdb-propertize-header "Registers" gdb-registers-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3672 nil nil mode-line))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3673 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3674 (define-derived-mode gdb-registers-mode gdb-parent-mode "Registers" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3675 "Major mode for gdb registers. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3676 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3677 \\{gdb-registers-mode-map}" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3678 (setq header-line-format gdb-registers-header) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3679 (run-mode-hooks 'gdb-registers-mode-hook) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3680 'gdb-invalidate-registers) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3681 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3682 (defun gdb-registers-buffer-name () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3683 (gdb-current-context-buffer-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3684 (concat "registers of " (gdb-get-target-string)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3685 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3686 (def-gdb-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3687 gdb-display-registers-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3688 'gdb-registers-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3689 "Display integer register contents.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3690 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3691 (def-gdb-preempt-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3692 gdb-preemptively-display-registers-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3693 'gdb-registers-buffer nil t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3694 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3695 (def-gdb-frame-for-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3696 gdb-frame-registers-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3697 'gdb-registers-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3698 "Display integer register contents in a new frame.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3699 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3700 ;; Needs GDB 6.4 onwards (used to fail with no stack). |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3701 (defun gdb-get-changed-registers () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3702 (if (and (gdb-get-buffer 'gdb-registers-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3703 (not (gdb-pending-p 'gdb-get-changed-registers))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3704 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3705 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3706 (list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3707 "-data-list-changed-registers" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3708 'gdb-changed-registers-handler)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3709 (gdb-add-pending 'gdb-get-changed-registers)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3710 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3711 (defun gdb-changed-registers-handler () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3712 (gdb-delete-pending 'gdb-get-changed-registers) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3713 (setq gdb-changed-registers nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3714 (dolist (register-number (bindat-get-field (gdb-json-partial-output) 'changed-registers)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3715 (push register-number gdb-changed-registers))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3716 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3717 (defun gdb-register-names-handler () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3718 ;; Don't use gdb-pending-triggers because this handler is called |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3719 ;; only once (in gdb-init-1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3720 (setq gdb-register-names nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3721 (dolist (register-name (bindat-get-field (gdb-json-partial-output) 'register-names)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3722 (push register-name gdb-register-names)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3723 (setq gdb-register-names (reverse gdb-register-names))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3724 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3725 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3726 (defun gdb-get-source-file-list () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3727 "Create list of source files for current GDB session. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3728 If buffers already exist for any of these files, gud-minor-mode |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3729 is set in them." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3730 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3731 (while (re-search-forward gdb-source-file-regexp nil t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3732 (push (match-string 1) gdb-source-file-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3733 (dolist (buffer (buffer-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3734 (with-current-buffer buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3735 (when (member buffer-file-name gdb-source-file-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3736 (gdb-init-buffer)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3737 (gdb-force-mode-line-update |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3738 (propertize "ready" 'face font-lock-variable-name-face))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3739 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3740 (defun gdb-get-main-selected-frame () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3741 "Trigger for `gdb-frame-handler' which uses main current |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3742 thread. Called from `gdb-update'." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3743 (if (not (gdb-pending-p 'gdb-get-main-selected-frame)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3744 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3745 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3746 (list (gdb-current-context-command "-stack-info-frame") 'gdb-frame-handler)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3747 (gdb-add-pending 'gdb-get-main-selected-frame)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3748 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3749 (defun gdb-frame-handler () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3750 "Sets `gdb-selected-frame' and `gdb-selected-file' to show |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3751 overlay arrow in source buffer." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3752 (gdb-delete-pending 'gdb-get-main-selected-frame) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3753 (let ((frame (bindat-get-field (gdb-json-partial-output) 'frame))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3754 (when frame |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3755 (setq gdb-selected-frame (bindat-get-field frame 'func)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3756 (setq gdb-selected-file (bindat-get-field frame 'fullname)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3757 (setq gdb-frame-number (bindat-get-field frame 'level)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3758 (setq gdb-frame-address (bindat-get-field frame 'addr)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3759 (let ((line (bindat-get-field frame 'line))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3760 (setq gdb-selected-line (and line (string-to-number line))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3761 (when (and gdb-selected-file gdb-selected-line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3762 (setq gud-last-frame (cons gdb-selected-file gdb-selected-line)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3763 (gud-display-frame))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3764 (if gud-overlay-arrow-position |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3765 (let ((buffer (marker-buffer gud-overlay-arrow-position)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3766 (position (marker-position gud-overlay-arrow-position))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3767 (when buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3768 (with-current-buffer buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3769 (setq fringe-indicator-alist |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3770 (if (string-equal gdb-frame-number "0") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3771 nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3772 '((overlay-arrow . hollow-right-triangle)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3773 (setq gud-overlay-arrow-position (make-marker)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3774 (set-marker gud-overlay-arrow-position position)))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3775 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3776 (defvar gdb-prompt-name-regexp "value=\"\\(.*?\\)\"") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3777 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3778 (defun gdb-get-prompt () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3779 "Find prompt for GDB session." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3780 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3781 (setq gdb-prompt-name nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3782 (re-search-forward gdb-prompt-name-regexp nil t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3783 (setq gdb-prompt-name (match-string 1)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3784 ;; Insert first prompt. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3785 (setq gdb-filter-output (concat gdb-filter-output gdb-prompt-name))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3786 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3787 ;;;; Window management |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3788 (defun gdb-display-buffer (buf dedicated &optional frame) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3789 "Show buffer BUF. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3790 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3791 If BUF is already displayed in some window, show it, deiconifying |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3792 the frame if necessary. Otherwise, find least recently used |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3793 window and show BUF there, if the window is not used for GDB |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3794 already, in which case that window is splitted first." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3795 (let ((answer (get-buffer-window buf (or frame 0)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3796 (if answer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3797 (display-buffer buf nil (or frame 0)) ;Deiconify the frame if necessary. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3798 (let ((window (get-lru-window))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3799 (if (eq (buffer-local-value 'gud-minor-mode (window-buffer window)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3800 'gdbmi) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3801 (let* ((largest (get-largest-window)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3802 (cur-size (window-height largest))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3803 (setq answer (split-window largest)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3804 (set-window-buffer answer buf) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3805 (set-window-dedicated-p answer dedicated) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3806 answer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3807 (set-window-buffer window buf) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3808 window))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3809 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3810 (defun gdb-preempt-existing-or-display-buffer (buf &optional split-horizontal) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3811 "Find window displaying a buffer with the same |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3812 `gdb-buffer-type' as BUF and show BUF there. If no such window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3813 exists, just call `gdb-display-buffer' for BUF. If the window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3814 found is already dedicated, split window according to |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3815 SPLIT-HORIZONTAL and show BUF in the new window." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3816 (if buf |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3817 (when (not (get-buffer-window buf)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3818 (let* ((buf-type (gdb-buffer-type buf)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3819 (existing-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3820 (get-window-with-predicate |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3821 #'(lambda (w) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3822 (and (eq buf-type |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3823 (gdb-buffer-type (window-buffer w))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3824 (not (window-dedicated-p w))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3825 (if existing-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3826 (set-window-buffer existing-window buf) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3827 (let ((dedicated-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3828 (get-window-with-predicate |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3829 #'(lambda (w) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3830 (eq buf-type |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3831 (gdb-buffer-type (window-buffer w))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3832 (if dedicated-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3833 (set-window-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3834 (split-window dedicated-window nil split-horizontal) buf) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3835 (gdb-display-buffer buf t)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3836 (error "Null buffer"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3837 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3838 ;;; Shared keymap initialization: |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3839 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3840 (let ((menu (make-sparse-keymap "GDB-Windows"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3841 (define-key gud-menu-map [displays] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3842 `(menu-item "GDB-Windows" ,menu |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3843 :visible (eq gud-minor-mode 'gdbmi))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3844 (define-key menu [gdb] '("Gdb" . gdb-display-gdb-buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3845 (define-key menu [threads] '("Threads" . gdb-display-threads-buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3846 (define-key menu [memory] '("Memory" . gdb-display-memory-buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3847 (define-key menu [disassembly] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3848 '("Disassembly" . gdb-display-disassembly-buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3849 (define-key menu [registers] '("Registers" . gdb-display-registers-buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3850 (define-key menu [inferior] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3851 '("IO" . gdb-display-io-buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3852 (define-key menu [locals] '("Locals" . gdb-display-locals-buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3853 (define-key menu [frames] '("Stack" . gdb-display-stack-buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3854 (define-key menu [breakpoints] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3855 '("Breakpoints" . gdb-display-breakpoints-buffer))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3856 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3857 (let ((menu (make-sparse-keymap "GDB-Frames"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3858 (define-key gud-menu-map [frames] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3859 `(menu-item "GDB-Frames" ,menu |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3860 :visible (eq gud-minor-mode 'gdbmi))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3861 (define-key menu [gdb] '("Gdb" . gdb-frame-gdb-buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3862 (define-key menu [threads] '("Threads" . gdb-frame-threads-buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3863 (define-key menu [memory] '("Memory" . gdb-frame-memory-buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3864 (define-key menu [disassembly] '("Disassembly" . gdb-frame-disassembly-buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3865 (define-key menu [registers] '("Registers" . gdb-frame-registers-buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3866 (define-key menu [inferior] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3867 '("IO" . gdb-frame-io-buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3868 (define-key menu [locals] '("Locals" . gdb-frame-locals-buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3869 (define-key menu [frames] '("Stack" . gdb-frame-stack-buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3870 (define-key menu [breakpoints] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3871 '("Breakpoints" . gdb-frame-breakpoints-buffer))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3872 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3873 (let ((menu (make-sparse-keymap "GDB-MI"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3874 (define-key menu [gdb-customize] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3875 '(menu-item "Customize" (lambda () (interactive) (customize-group 'gdb)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3876 :help "Customize Gdb Graphical Mode options.")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3877 (define-key menu [gdb-many-windows] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3878 '(menu-item "Display Other Windows" gdb-many-windows |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3879 :help "Toggle display of locals, stack and breakpoint information" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3880 :button (:toggle . gdb-many-windows))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3881 (define-key menu [gdb-restore-windows] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3882 '(menu-item "Restore Window Layout" gdb-restore-windows |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3883 :help "Restore standard layout for debug session.")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3884 (define-key menu [sep1] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3885 '(menu-item "--")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3886 (define-key menu [all-threads] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3887 '(menu-item "GUD controls all threads" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3888 (lambda () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3889 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3890 (setq gdb-gud-control-all-threads t)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3891 :help "GUD start/stop commands apply to all threads" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3892 :button (:radio . gdb-gud-control-all-threads))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3893 (define-key menu [current-thread] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3894 '(menu-item "GUD controls current thread" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3895 (lambda () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3896 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3897 (setq gdb-gud-control-all-threads nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3898 :help "GUD start/stop commands apply to current thread only" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3899 :button (:radio . (not gdb-gud-control-all-threads)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3900 (define-key menu [sep2] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3901 '(menu-item "--")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3902 (define-key menu [gdb-customize-reasons] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3903 '(menu-item "Customize switching..." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3904 (lambda () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3905 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3906 (customize-option 'gdb-switch-reasons)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3907 (define-key menu [gdb-switch-when-another-stopped] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3908 (menu-bar-make-toggle gdb-toggle-switch-when-another-stopped gdb-switch-when-another-stopped |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3909 "Automatically switch to stopped thread" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3910 "GDB thread switching %s" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3911 "Switch to stopped thread")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3912 (define-key gud-menu-map [mi] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3913 `(menu-item "GDB-MI" ,menu :visible (eq gud-minor-mode 'gdbmi)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3914 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3915 ;; TODO Fit these into tool-bar-local-item-from-menu call in gud.el. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3916 ;; GDB-MI menu will need to be moved to gud.el. We can't use |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3917 ;; tool-bar-local-item-from-menu here because it appends new buttons |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3918 ;; to toolbar from right to left while we want our A/T throttle to |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3919 ;; show up right before Run button. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3920 (define-key-after gud-tool-bar-map [all-threads] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3921 '(menu-item "Switch to non-stop/A mode" gdb-control-all-threads |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3922 :image (find-image '((:type xpm :file "gud/thread.xpm"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3923 :visible (and (eq gud-minor-mode 'gdbmi) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3924 gdb-non-stop |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3925 (not gdb-gud-control-all-threads))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3926 'run) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3927 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3928 (define-key-after gud-tool-bar-map [current-thread] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3929 '(menu-item "Switch to non-stop/T mode" gdb-control-current-thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3930 :image (find-image '((:type xpm :file "gud/all.xpm"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3931 :visible (and (eq gud-minor-mode 'gdbmi) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3932 gdb-non-stop |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3933 gdb-gud-control-all-threads)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3934 'all-threads) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3935 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3936 (defun gdb-frame-gdb-buffer () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3937 "Display GUD buffer in a new frame." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3938 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3939 (let ((special-display-regexps (append special-display-regexps '(".*"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3940 (special-display-frame-alist |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3941 (remove '(menu-bar-lines) (remove '(tool-bar-lines) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3942 gdb-frame-parameters))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3943 (same-window-regexps nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3944 (display-buffer gud-comint-buffer))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3945 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3946 (defun gdb-display-gdb-buffer () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3947 "Display GUD buffer." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3948 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3949 (let ((same-window-regexps nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3950 (select-window (display-buffer gud-comint-buffer nil 0)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3951 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3952 (defun gdb-set-window-buffer (name &optional ignore-dedicated) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3953 "Set buffer of selected window to NAME and dedicate window. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3954 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3955 When IGNORE-DEDICATED is non-nil, buffer is set even if selected |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3956 window is dedicated." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3957 (when ignore-dedicated |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3958 (set-window-dedicated-p (selected-window) nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3959 (set-window-buffer (selected-window) (get-buffer name)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3960 (set-window-dedicated-p (selected-window) t)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3961 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3962 (defun gdb-setup-windows () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3963 "Layout the window pattern for `gdb-many-windows'." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3964 (gdb-display-locals-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3965 (gdb-display-stack-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3966 (delete-other-windows) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3967 (gdb-display-breakpoints-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3968 (delete-other-windows) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3969 ; Don't dedicate. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3970 (pop-to-buffer gud-comint-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3971 (split-window nil ( / ( * (window-height) 3) 4)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3972 (split-window nil ( / (window-height) 3)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3973 (split-window-horizontally) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3974 (other-window 1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3975 (gdb-set-window-buffer (gdb-locals-buffer-name)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3976 (other-window 1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3977 (switch-to-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3978 (if gud-last-last-frame |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3979 (gud-find-file (car gud-last-last-frame)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3980 (if gdb-main-file |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3981 (gud-find-file gdb-main-file) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3982 ;; Put buffer list in window if we |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3983 ;; can't find a source file. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3984 (list-buffers-noselect)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3985 (setq gdb-source-window (selected-window)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3986 (split-window-horizontally) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3987 (other-window 1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3988 (gdb-set-window-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3989 (gdb-get-buffer-create 'gdb-inferior-io)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3990 (other-window 1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3991 (gdb-set-window-buffer (gdb-stack-buffer-name)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3992 (split-window-horizontally) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3993 (other-window 1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3994 (gdb-set-window-buffer (if gdb-show-threads-by-default |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3995 (gdb-threads-buffer-name) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3996 (gdb-breakpoints-buffer-name))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3997 (other-window 1)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3998 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3999 (defcustom gdb-many-windows nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4000 "If nil just pop up the GUD buffer unless `gdb-show-main' is t. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4001 In this case it starts with two windows: one displaying the GUD |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4002 buffer and the other with the source file with the main routine |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4003 of the debugged program. Non-nil means display the layout shown for |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4004 `gdb'." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4005 :type 'boolean |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4006 :group 'gdb |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4007 :version "22.1") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4008 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4009 (defun gdb-many-windows (arg) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4010 "Toggle the number of windows in the basic arrangement. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4011 With arg, display additional buffers iff arg is positive." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4012 (interactive "P") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4013 (setq gdb-many-windows |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4014 (if (null arg) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4015 (not gdb-many-windows) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4016 (> (prefix-numeric-value arg) 0))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4017 (message (format "Display of other windows %sabled" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4018 (if gdb-many-windows "en" "dis"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4019 (if (and gud-comint-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4020 (buffer-name gud-comint-buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4021 (condition-case nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4022 (gdb-restore-windows) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4023 (error nil)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4024 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4025 (defun gdb-restore-windows () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4026 "Restore the basic arrangement of windows used by gdb. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4027 This arrangement depends on the value of `gdb-many-windows'." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4028 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4029 (pop-to-buffer gud-comint-buffer) ;Select the right window and frame. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4030 (delete-other-windows) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4031 (if gdb-many-windows |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4032 (gdb-setup-windows) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4033 (when (or gud-last-last-frame gdb-show-main) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4034 (split-window) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4035 (other-window 1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4036 (switch-to-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4037 (if gud-last-last-frame |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4038 (gud-find-file (car gud-last-last-frame)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4039 (gud-find-file gdb-main-file))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4040 (setq gdb-source-window (selected-window)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4041 (other-window 1)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4042 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4043 (defun gdb-reset () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4044 "Exit a debugging session cleanly. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4045 Kills the gdb buffers, and resets variables and the source buffers." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4046 (dolist (buffer (buffer-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4047 (unless (eq buffer gud-comint-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4048 (with-current-buffer buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4049 (if (eq gud-minor-mode 'gdbmi) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4050 (if (string-match "\\` ?\\*.+\\*\\'" (buffer-name)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4051 (kill-buffer nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4052 (gdb-remove-breakpoint-icons (point-min) (point-max) t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4053 (setq gud-minor-mode nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4054 (kill-local-variable 'tool-bar-map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4055 (kill-local-variable 'gdb-define-alist)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4056 (setq gdb-disassembly-position nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4057 (setq overlay-arrow-variable-list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4058 (delq 'gdb-disassembly-position overlay-arrow-variable-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4059 (setq fringe-indicator-alist '((overlay-arrow . right-triangle))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4060 (setq gdb-stack-position nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4061 (setq overlay-arrow-variable-list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4062 (delq 'gdb-stack-position overlay-arrow-variable-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4063 (setq gdb-thread-position nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4064 (setq overlay-arrow-variable-list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4065 (delq 'gdb-thread-position overlay-arrow-variable-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4066 (if (boundp 'speedbar-frame) (speedbar-timer-fn)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4067 (setq gud-running nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4068 (setq gdb-active-process nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4069 (remove-hook 'after-save-hook 'gdb-create-define-alist t)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4070 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4071 (defun gdb-get-source-file () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4072 "Find the source file where the program starts and display it with related |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4073 buffers, if required." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4074 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4075 (if (re-search-forward gdb-source-file-regexp nil t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4076 (setq gdb-main-file (match-string 1))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4077 (if gdb-many-windows |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4078 (gdb-setup-windows) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4079 (gdb-get-buffer-create 'gdb-breakpoints-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4080 (if gdb-show-main |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4081 (let ((pop-up-windows t)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4082 (display-buffer (gud-find-file gdb-main-file)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4083 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4084 ;;from put-image |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4085 (defun gdb-put-string (putstring pos &optional dprop &rest sprops) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4086 "Put string PUTSTRING in front of POS in the current buffer. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4087 PUTSTRING is displayed by putting an overlay into the current buffer with a |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4088 `before-string' string that has a `display' property whose value is |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4089 PUTSTRING." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4090 (let ((string (make-string 1 ?x)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4091 (buffer (current-buffer))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4092 (setq putstring (copy-sequence putstring)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4093 (let ((overlay (make-overlay pos pos buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4094 (prop (or dprop |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4095 (list (list 'margin 'left-margin) putstring)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4096 (put-text-property 0 1 'display prop string) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4097 (if sprops |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4098 (add-text-properties 0 1 sprops string)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4099 (overlay-put overlay 'put-break t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4100 (overlay-put overlay 'before-string string)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4101 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4102 ;;from remove-images |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4103 (defun gdb-remove-strings (start end &optional buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4104 "Remove strings between START and END in BUFFER. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4105 Remove only strings that were put in BUFFER with calls to `gdb-put-string'. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4106 BUFFER nil or omitted means use the current buffer." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4107 (unless buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4108 (setq buffer (current-buffer))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4109 (dolist (overlay (overlays-in start end)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4110 (when (overlay-get overlay 'put-break) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4111 (delete-overlay overlay)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4112 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4113 (defun gdb-put-breakpoint-icon (enabled bptno &optional line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4114 (let* ((posns (gdb-line-posns (or line (line-number-at-pos)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4115 (start (- (car posns) 1)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4116 (end (+ (cdr posns) 1)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4117 (putstring (if enabled "B" "b")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4118 (source-window (get-buffer-window (current-buffer) 0))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4119 (add-text-properties |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4120 0 1 '(help-echo "mouse-1: clear bkpt, mouse-3: enable/disable bkpt") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4121 putstring) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4122 (if enabled |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4123 (add-text-properties |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4124 0 1 `(gdb-bptno ,bptno gdb-enabled t) putstring) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4125 (add-text-properties |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4126 0 1 `(gdb-bptno ,bptno gdb-enabled nil) putstring)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4127 (gdb-remove-breakpoint-icons start end) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4128 (if (display-images-p) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4129 (if (>= (or left-fringe-width |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4130 (if source-window (car (window-fringes source-window))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4131 gdb-buffer-fringe-width) 8) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4132 (gdb-put-string |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4133 nil (1+ start) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4134 `(left-fringe breakpoint |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4135 ,(if enabled |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4136 'breakpoint-enabled |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4137 'breakpoint-disabled)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4138 'gdb-bptno bptno |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4139 'gdb-enabled enabled) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4140 (when (< left-margin-width 2) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4141 (save-current-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4142 (setq left-margin-width 2) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4143 (if source-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4144 (set-window-margins |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4145 source-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4146 left-margin-width right-margin-width)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4147 (put-image |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4148 (if enabled |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4149 (or breakpoint-enabled-icon |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4150 (setq breakpoint-enabled-icon |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4151 (find-image `((:type xpm :data |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4152 ,breakpoint-xpm-data |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4153 :ascent 100 :pointer hand) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4154 (:type pbm :data |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4155 ,breakpoint-enabled-pbm-data |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4156 :ascent 100 :pointer hand))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4157 (or breakpoint-disabled-icon |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4158 (setq breakpoint-disabled-icon |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4159 (find-image `((:type xpm :data |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4160 ,breakpoint-xpm-data |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4161 :conversion disabled |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4162 :ascent 100 :pointer hand) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4163 (:type pbm :data |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4164 ,breakpoint-disabled-pbm-data |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4165 :ascent 100 :pointer hand)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4166 (+ start 1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4167 putstring |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4168 'left-margin)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4169 (when (< left-margin-width 2) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4170 (save-current-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4171 (setq left-margin-width 2) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4172 (let ((window (get-buffer-window (current-buffer) 0))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4173 (if window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4174 (set-window-margins |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4175 window left-margin-width right-margin-width))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4176 (gdb-put-string |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4177 (propertize putstring |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4178 'face (if enabled 'breakpoint-enabled 'breakpoint-disabled)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4179 (1+ start))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4180 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4181 (defun gdb-remove-breakpoint-icons (start end &optional remove-margin) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4182 (gdb-remove-strings start end) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4183 (if (display-images-p) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4184 (remove-images start end)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4185 (when remove-margin |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4186 (setq left-margin-width 0) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4187 (let ((window (get-buffer-window (current-buffer) 0))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4188 (if window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4189 (set-window-margins |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4190 window left-margin-width right-margin-width))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4191 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4192 (provide 'gdb-mi) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4193 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4194 ;; arch-tag: 1b41ea2b-f364-4cec-8f35-e02e4fe01912 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4195 ;;; gdb-mi.el ends here |