Mercurial > emacs
annotate lisp/progmodes/gdb-mi.el @ 112288:81d8294d0c45
* coding.c (decode_coding_emacs_mule): Remove unreachable code.
This is a typo left over from revno 95090 dated 2009-03-06,
which fixed Bug#2370. Caught by Sun cc.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Sun, 16 Jan 2011 18:55:28 -0800 |
parents | 6378d1b57038 |
children |
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 |
112275
6378d1b57038
Add 2011 to remaining FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents:
111870
diff
changeset
|
3 ;; Copyright (C) 2007, 2008, 2009, 2010, 2011 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) |
111850
f2a5b5a7f017
In gdb, try to init comint history from gdbhist.
Glenn Morris <rgm@gnu.org>
parents:
110561
diff
changeset
|
650 (when (ring-empty-p comint-input-ring) ; cf shell-mode |
f2a5b5a7f017
In gdb, try to init comint history from gdbhist.
Glenn Morris <rgm@gnu.org>
parents:
110561
diff
changeset
|
651 (let (hfile) |
f2a5b5a7f017
In gdb, try to init comint history from gdbhist.
Glenn Morris <rgm@gnu.org>
parents:
110561
diff
changeset
|
652 (when (catch 'done |
f2a5b5a7f017
In gdb, try to init comint history from gdbhist.
Glenn Morris <rgm@gnu.org>
parents:
110561
diff
changeset
|
653 (dolist (file '(".gdbinit" "~/.gdbinit")) |
f2a5b5a7f017
In gdb, try to init comint history from gdbhist.
Glenn Morris <rgm@gnu.org>
parents:
110561
diff
changeset
|
654 (if (file-readable-p (setq file (expand-file-name file))) |
f2a5b5a7f017
In gdb, try to init comint history from gdbhist.
Glenn Morris <rgm@gnu.org>
parents:
110561
diff
changeset
|
655 (with-temp-buffer |
f2a5b5a7f017
In gdb, try to init comint history from gdbhist.
Glenn Morris <rgm@gnu.org>
parents:
110561
diff
changeset
|
656 (insert-file-contents file) |
f2a5b5a7f017
In gdb, try to init comint history from gdbhist.
Glenn Morris <rgm@gnu.org>
parents:
110561
diff
changeset
|
657 (and (re-search-forward |
f2a5b5a7f017
In gdb, try to init comint history from gdbhist.
Glenn Morris <rgm@gnu.org>
parents:
110561
diff
changeset
|
658 "^ *set history filename *\\(.*\\)" nil t) |
f2a5b5a7f017
In gdb, try to init comint history from gdbhist.
Glenn Morris <rgm@gnu.org>
parents:
110561
diff
changeset
|
659 (file-readable-p |
f2a5b5a7f017
In gdb, try to init comint history from gdbhist.
Glenn Morris <rgm@gnu.org>
parents:
110561
diff
changeset
|
660 (setq hfile (expand-file-name |
f2a5b5a7f017
In gdb, try to init comint history from gdbhist.
Glenn Morris <rgm@gnu.org>
parents:
110561
diff
changeset
|
661 (match-string 1) |
f2a5b5a7f017
In gdb, try to init comint history from gdbhist.
Glenn Morris <rgm@gnu.org>
parents:
110561
diff
changeset
|
662 (file-name-directory file)))) |
f2a5b5a7f017
In gdb, try to init comint history from gdbhist.
Glenn Morris <rgm@gnu.org>
parents:
110561
diff
changeset
|
663 (throw 'done t)))))) |
f2a5b5a7f017
In gdb, try to init comint history from gdbhist.
Glenn Morris <rgm@gnu.org>
parents:
110561
diff
changeset
|
664 (set (make-local-variable 'comint-input-ring-file-name) hfile) |
f2a5b5a7f017
In gdb, try to init comint history from gdbhist.
Glenn Morris <rgm@gnu.org>
parents:
110561
diff
changeset
|
665 (comint-read-input-ring t)))) |
107550
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
666 (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
|
667 "Set temporary breakpoint at current line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
668 (gud-def gud-jump |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
669 (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
|
670 "\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
|
671 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
672 (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
|
673 (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
|
674 (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
|
675 (gud-def gud-pstar "print* %e" nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
676 "Evaluate C dereferenced pointer expression at point.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
677 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
678 (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
|
679 "\C-s" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
680 "Step one source line with display.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
681 (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
|
682 "\C-i" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
683 "Step one instruction with display.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
684 (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
|
685 "\C-n" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
686 "Step one line (skip functions).") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
687 (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
|
688 nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
689 "Step one instruction (skip functions).") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
690 (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
|
691 "\C-r" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
692 "Continue with display.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
693 (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
|
694 "\C-f" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
695 "Finish executing current function.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
696 (gud-def gud-run "-exec-run" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
697 nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
698 "Run the program.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
699 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
700 (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
|
701 (gud-call "break %f:%l" arg) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
702 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
703 (beginning-of-line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
704 (forward-char 2) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
705 (gud-call "break *%a" arg))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
706 "\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
|
707 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
708 (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
|
709 (gud-call "clear %f:%l" arg) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
710 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
711 (beginning-of-line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
712 (forward-char 2) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
713 (gud-call "clear *%a" arg))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
714 "\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
|
715 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
716 ;; -exec-until doesn't support --all yet |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
717 (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
|
718 (gud-call "-exec-until %f:%l" arg) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
719 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
720 (beginning-of-line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
721 (forward-char 2) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
722 (gud-call "-exec-until *%a" arg))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
723 "\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
|
724 ;; TODO Why arg here? |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
725 (gud-def |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
726 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
|
727 (gdb-gud-context-command "-exec-continue") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
728 "-exec-run") arg) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
729 nil "Start or continue execution.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
730 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
731 ;; For debugging Emacs only. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
732 (gud-def gud-pp |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
733 (gud-call |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
734 (concat |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
735 "pp1 " (if (eq (buffer-local-value |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
736 'major-mode (window-buffer)) 'speedbar-mode) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
737 (gdb-find-watch-expression) "%e")) arg) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
738 nil "Print the Emacs s-expression.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
739 |
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-margin mouse-1] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
741 'gdb-mouse-set-clear-breakpoint) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
742 (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
|
743 'gdb-mouse-set-clear-breakpoint) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
744 (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
|
745 'gdb-mouse-toggle-breakpoint-margin) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
746 (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
|
747 'gdb-mouse-toggle-breakpoint-fringe) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
748 |
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 drag-mouse-1] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
750 'gdb-mouse-until) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
751 (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
|
752 'gdb-mouse-until) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
753 (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
|
754 'gdb-mouse-until) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
755 (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
|
756 'gdb-mouse-until) |
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 (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
|
759 'gdb-mouse-jump) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
760 (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
|
761 'gdb-mouse-jump) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
762 (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
|
763 'gdb-mouse-jump) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
764 (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
|
765 'gdb-mouse-jump) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
766 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
767 (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
|
768 (setq gdb-first-prompt t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
769 (setq gud-running nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
770 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
771 (gdb-update) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
772 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
773 (run-hooks 'gdb-mode-hook)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
774 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
775 (defun gdb-init-1 () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
776 ;; (re-)initialise |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
777 (setq gdb-selected-frame nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
778 gdb-frame-number nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
779 gdb-thread-number nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
780 gdb-var-list nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
781 gdb-pending-triggers nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
782 gdb-output-sink 'user |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
783 gdb-location-alist nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
784 gdb-source-file-list nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
785 gdb-last-command nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
786 gdb-token-number 0 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
787 gdb-handler-alist '() |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
788 gdb-handler-number nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
789 gdb-prompt-name nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
790 gdb-first-done-or-error t |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
791 gdb-buffer-fringe-width (car (window-fringes)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
792 gdb-debug-log nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
793 gdb-source-window nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
794 gdb-inferior-status nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
795 gdb-continuation nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
796 gdb-buf-publisher '() |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
797 gdb-threads-list '() |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
798 gdb-breakpoints-list '() |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
799 gdb-register-names '() |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
800 gdb-non-stop gdb-non-stop-setting) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
801 ;; |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
802 (setq gdb-buffer-type 'gdbmi) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
803 ;; |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
804 (gdb-force-mode-line-update |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
805 (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
|
806 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
807 (gdb-get-buffer-create 'gdb-inferior-io) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
808 (gdb-clear-inferior-io) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
809 (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
|
810 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
811 ;; Needs GDB 6.4 onwards |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
812 (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
|
813 (or |
8a7bf813ce36
* net/tramp.el (tramp-handle-start-file-process): Check only for
Michael Albinus <michael.albinus@gmx.de>
parents:
107552
diff
changeset
|
814 ;; 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
|
815 (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
|
816 (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
|
817 'ignore)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
818 (if (eq window-system 'w32) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
819 (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
|
820 (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
|
821 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
822 (when gdb-non-stop |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
823 (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
|
824 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
825 ;; find source file and compilation directory here |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
826 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
827 ; Needs GDB 6.2 onwards. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
828 (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
|
829 (if gdb-create-source-file-list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
830 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
831 ; Needs GDB 6.0 onwards. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
832 (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
|
833 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
834 (list "-gdb-show prompt" 'gdb-get-prompt))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
835 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
836 (defun gdb-non-stop-handler () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
837 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
838 (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
|
839 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
840 (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
|
841 (setq gdb-non-stop nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
842 (setq gdb-version "pre-7.0")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
843 (setq gdb-version "7.0+") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
844 (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
|
845 (gdb-input (list "-enable-pretty-printing" 'ignore)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
846 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
847 (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
|
848 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
849 (defun gdb-create-define-alist () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
850 "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
|
851 (let* ((file (buffer-file-name)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
852 (output |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
853 (with-output-to-string |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
854 (with-current-buffer standard-output |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
855 (and file |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
856 (file-exists-p file) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
857 ;; 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
|
858 (not (file-remote-p default-directory)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
859 (call-process shell-file-name file |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
860 (list t nil) nil "-c" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
861 (concat gdb-cpp-define-alist-program " " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
862 gdb-cpp-define-alist-flags)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
863 (define-list (split-string output "\n" t)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
864 (name)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
865 (setq gdb-define-alist nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
866 (dolist (define define-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
867 (setq name (nth 1 (split-string define "[( ]"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
868 (push (cons name define) gdb-define-alist)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
869 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
870 (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
|
871 (defvar tooltip-use-echo-area) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
872 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
873 (defun gdb-tooltip-print (expr) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
874 (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
|
875 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
876 (if (re-search-forward ".*value=\\(\".*\"\\)" nil t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
877 (tooltip-show |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
878 (concat expr " = " (read (match-string 1))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
879 (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
|
880 (not (display-graphic-p))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
881 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
882 ;; 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
|
883 ;; 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
|
884 ;; unexpected starting annotation (phase error). |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
885 (defun gdb-tooltip-print-1 (expr) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
886 (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
|
887 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
888 (if (search-forward "expands to: " nil t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
889 (unless (looking-at "\\S-+.*(.*).*") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
890 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
891 (list (concat "-data-evaluate-expression " expr) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
892 `(lambda () (gdb-tooltip-print ,expr)))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
893 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
894 (defun gdb-init-buffer () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
895 (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
|
896 (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
|
897 (when gud-tooltip-mode |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
898 (make-local-variable 'gdb-define-alist) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
899 (gdb-create-define-alist) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
900 (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
|
901 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
902 (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
|
903 `(if ,arrow-position |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
904 (let ((buffer (marker-buffer ,arrow-position)) (line)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
905 (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
|
906 (with-current-buffer buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
907 (when (or (equal start end) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
908 (equal (posn-point start) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
909 (marker-position ,arrow-position))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
910 ,@body)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
911 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
912 (defun gdb-mouse-until (event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
913 "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
|
914 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
|
915 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
|
916 with mouse-1 (default bindings)." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
917 (interactive "e") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
918 (let ((start (event-start event)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
919 (end (event-end event))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
920 (gdb-if-arrow gud-overlay-arrow-position |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
921 (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
|
922 (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
|
923 (gdb-if-arrow gdb-disassembly-position |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
924 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
925 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
926 (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
|
927 (forward-char 2) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
928 (gud-call (concat "until *%a")))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
929 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
930 (defun gdb-mouse-jump (event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
931 "Set execution address/line. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
932 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
|
933 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
|
934 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
|
935 line, and no execution takes place." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
936 (interactive "e") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
937 (let ((start (event-start event)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
938 (end (event-end event))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
939 (gdb-if-arrow gud-overlay-arrow-position |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
940 (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
|
941 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
942 (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
|
943 (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
|
944 (gdb-if-arrow gdb-disassembly-position |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
945 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
946 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
947 (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
|
948 (forward-char 2) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
949 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
950 (gud-call (concat "tbreak *%a")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
951 (gud-call (concat "jump *%a"))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
952 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
953 (defcustom gdb-show-changed-values t |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
954 "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
|
955 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
|
956 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
|
957 :type 'boolean |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
958 :group 'gdb |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
959 :version "22.1") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
960 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
961 (defcustom gdb-max-children 40 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
962 "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
|
963 :type 'integer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
964 :group 'gdb |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
965 :version "22.1") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
966 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
967 (defcustom gdb-delete-out-of-scope t |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
968 "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
|
969 :type 'boolean |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
970 :group 'gdb |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
971 :version "22.2") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
972 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
973 (defcustom gdb-speedbar-auto-raise nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
974 "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
|
975 updated." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
976 :type 'boolean |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
977 :group 'gdb |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
978 :version "22.1") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
979 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
980 (defcustom gdb-use-colon-colon-notation nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
981 "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
|
982 :type 'boolean |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
983 :group 'gdb |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
984 :version "22.1") |
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 (defun gdb-speedbar-auto-raise (arg) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
987 "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
|
988 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
|
989 positive, otherwise don't automatically raise it." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
990 (interactive "P") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
991 (setq gdb-speedbar-auto-raise |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
992 (if (null arg) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
993 (not gdb-speedbar-auto-raise) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
994 (> (prefix-numeric-value arg) 0))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
995 (message (format "Auto raising %sabled" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
996 (if gdb-speedbar-auto-raise "en" "dis")))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
997 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
998 (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
|
999 (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
|
1000 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1001 (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
|
1002 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1003 (defun gud-watch (&optional arg event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1004 "Watch expression at point. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1005 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
|
1006 (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
|
1007 (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
|
1008 (if (eq minor-mode 'gdbmi) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1009 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1010 (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
|
1011 (require 'tooltip) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1012 (save-selected-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1013 (let ((expr |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1014 (if arg |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1015 (completing-read "Name of variable: " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1016 'gud-gdb-complete-command) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1017 (if (and transient-mark-mode mark-active) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1018 (buffer-substring (region-beginning) (region-end)) |
111870
b47e85affa59
Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111850
diff
changeset
|
1019 (concat (if (derived-mode-p 'gdb-registers-mode) "$") |
107550
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1020 (tooltip-identifier-from-point (point))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1021 (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
|
1022 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1023 (list (concat"-var-create - * " expr "") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1024 `(lambda () (gdb-var-create-handler ,expr))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1025 (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
|
1026 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1027 (defun gdb-var-create-handler (expr) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1028 (let* ((result (gdb-json-partial-output))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1029 (if (not (bindat-get-field result 'msg)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1030 (let ((var |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1031 (list (bindat-get-field result 'name) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1032 (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
|
1033 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
|
1034 (setq expr (concat gdb-selected-frame "::" expr)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1035 expr) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1036 (bindat-get-field result 'numchild) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1037 (bindat-get-field result 'type) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1038 (bindat-get-field result 'value) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1039 nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1040 (bindat-get-field result 'has_more) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1041 gdb-frame-address))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1042 (push var gdb-var-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1043 (speedbar 1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1044 (unless (string-equal |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1045 speedbar-initial-expansion-list-name "GUD") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1046 (speedbar-change-initial-expansion-list "GUD"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1047 (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
|
1048 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1049 (defun gdb-speedbar-update () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1050 (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
|
1051 (not (gdb-pending-p 'gdb-speedbar-timer))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1052 ;; 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
|
1053 (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
|
1054 ;; 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
|
1055 (gdb-add-pending 'gdb-speedbar-timer))) |
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 (defun gdb-speedbar-timer-fn () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1058 (if gdb-speedbar-auto-raise |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1059 (raise-frame speedbar-frame)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1060 (gdb-delete-pending 'gdb-speedbar-timer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1061 (speedbar-timer-fn)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1062 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1063 (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
|
1064 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1065 (re-search-forward ".*value=\\(\".*\"\\)" nil t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1066 (let ((var (assoc varnum gdb-var-list))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1067 (when var |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1068 (if changed (setcar (nthcdr 5 var) 'changed)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1069 (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
|
1070 (gdb-speedbar-update)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1071 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1072 ; 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
|
1073 (defun gdb-var-list-children (varnum) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1074 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1075 (list (concat "-var-update " varnum) 'ignore)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1076 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1077 (list (concat "-var-list-children --all-values " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1078 varnum) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1079 `(lambda () (gdb-var-list-children-handler ,varnum))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1080 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1081 (defun gdb-var-list-children-handler (varnum) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1082 (let* ((var-list nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1083 (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
|
1084 (children (bindat-get-field output 'children))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1085 (catch 'child-already-watched |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1086 (dolist (var gdb-var-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1087 (if (string-equal varnum (car var)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1088 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1089 ;; With dynamic varobjs numchild may have increased. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1090 (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
|
1091 (push var var-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1092 (dolist (child children) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1093 (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
|
1094 (bindat-get-field child 'exp) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1095 (bindat-get-field child 'numchild) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1096 (bindat-get-field child 'type) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1097 (bindat-get-field child 'value) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1098 nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1099 (bindat-get-field child 'has_more)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1100 (if (assoc (car varchild) gdb-var-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1101 (throw 'child-already-watched nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1102 (push varchild var-list)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1103 (push var var-list))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1104 (setq gdb-var-list (nreverse var-list)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1105 (gdb-speedbar-update)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1106 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1107 (defun gdb-var-set-format (format) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1108 "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
|
1109 (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
|
1110 (varnum (car var))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1111 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1112 (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
|
1113 (gdb-var-update))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1114 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1115 (defun gdb-var-delete-1 (var varnum) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1116 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1117 (list (concat "-var-delete " varnum) 'ignore)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1118 (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
|
1119 (dolist (varchild gdb-var-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1120 (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
|
1121 (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
|
1122 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1123 (defun gdb-var-delete () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1124 "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
|
1125 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1126 (let ((text (speedbar-line-text))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1127 (string-match "\\(\\S-+\\)" text) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1128 (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
|
1129 (varnum (car var))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1130 (if (string-match "\\." (car var)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1131 (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
|
1132 (gdb-var-delete-1 var varnum))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1133 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1134 (defun gdb-var-delete-children (varnum) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1135 "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
|
1136 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1137 (list (concat "-var-delete -c " varnum) 'ignore))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1138 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1139 (defun gdb-edit-value (text token indent) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1140 "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
|
1141 (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
|
1142 (varnum (car var)) (value)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1143 (setq value (read-string "New value: ")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1144 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1145 (list (concat "-var-assign " varnum " " value) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1146 `(lambda () (gdb-edit-value-handler ,value)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1147 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1148 (defconst gdb-error-regexp "\\^error,msg=\\(\".+\"\\)") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1149 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1150 (defun gdb-edit-value-handler (value) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1151 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1152 (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
|
1153 (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
|
1154 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1155 ; 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
|
1156 (defun gdb-var-update () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1157 (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
|
1158 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1159 (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
|
1160 (gdb-add-pending 'gdb-var-update)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1161 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1162 (defun gdb-var-update-handler () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1163 (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
|
1164 (dolist (var gdb-var-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1165 (setcar (nthcdr 5 var) nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1166 (let ((temp-var-list gdb-var-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1167 (dolist (change changelist) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1168 (let* ((varnum (bindat-get-field change 'name)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1169 (var (assoc varnum gdb-var-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1170 (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
|
1171 (when var |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1172 (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
|
1173 (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
|
1174 (cond ((string-equal scope "false") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1175 (if gdb-delete-out-of-scope |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1176 (gdb-var-delete-1 var varnum) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1177 (setcar (nthcdr 5 var) 'out-of-scope))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1178 ((string-equal scope "true") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1179 (setcar (nthcdr 6 var) has-more) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1180 (when (and (or (not has-more) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1181 (string-equal has-more "0")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1182 (not new-num) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1183 (string-equal (nth 2 var) "0")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1184 (setcar (nthcdr 4 var) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1185 (bindat-get-field change 'value)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1186 (setcar (nthcdr 5 var) 'changed))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1187 ((string-equal scope "invalid") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1188 (gdb-var-delete-1 var varnum))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1189 (let ((var-list nil) var1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1190 (children (bindat-get-field change 'new_children))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1191 (if new-num |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1192 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1193 (setq var1 (pop temp-var-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1194 (while var1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1195 (if (string-equal varnum (car var1)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1196 (let ((new (string-to-number new-num)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1197 (previous (string-to-number (nth 2 var1)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1198 (setcar (nthcdr 2 var1) new-num) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1199 (push var1 var-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1200 (cond ((> new previous) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1201 ;; Add new children to list. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1202 (dotimes (dummy previous) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1203 (push (pop temp-var-list) var-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1204 (dolist (child children) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1205 (let ((varchild |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1206 (list (bindat-get-field child 'name) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1207 (bindat-get-field child 'exp) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1208 (bindat-get-field child 'numchild) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1209 (bindat-get-field child 'type) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1210 (bindat-get-field child 'value) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1211 'changed |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1212 (bindat-get-field child 'has_more)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1213 (push varchild var-list)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1214 ;; Remove deleted children from list. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1215 ((< new previous) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1216 (dotimes (dummy new) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1217 (push (pop temp-var-list) var-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1218 (dotimes (dummy (- previous new)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1219 (pop temp-var-list))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1220 (push var1 var-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1221 (setq var1 (pop temp-var-list))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1222 (setq gdb-var-list (nreverse var-list))))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1223 (setq gdb-pending-triggers |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1224 (delq 'gdb-var-update gdb-pending-triggers)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1225 (gdb-speedbar-update)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1226 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1227 (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
|
1228 "Expand the node the user clicked on. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1229 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
|
1230 TOKEN is data related to this node. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1231 INDENT is the current indentation depth." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1232 (cond ((string-match "+" text) ;expand this node |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1233 (let* ((var (assoc token gdb-var-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1234 (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
|
1235 (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
|
1236 (y-or-n-p |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1237 (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
|
1238 (gdb-var-list-children token)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1239 ((string-match "-" text) ;contract this node |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1240 (dolist (var gdb-var-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1241 (if (string-match (concat token "\\.") (car var)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1242 (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
|
1243 (gdb-var-delete-children token) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1244 (speedbar-change-expand-button-char ?+) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1245 (speedbar-delete-subblock indent)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1246 (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
|
1247 (speedbar-center-buffer-smartly)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1248 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1249 (defun gdb-get-target-string () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1250 (with-current-buffer gud-comint-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1251 gud-target-name)) |
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 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1254 ;; |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1255 ;; gdb buffers. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1256 ;; |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1257 ;; 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
|
1258 ;; of that particular buffer. |
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 ;; 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
|
1261 ;; is constructed specially. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1262 ;; |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1263 ;; 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
|
1264 ;; 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
|
1265 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1266 (defvar gdb-buffer-rules '()) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1267 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1268 (defun gdb-rules-name-maker (rules-entry) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1269 (cadr rules-entry)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1270 (defun gdb-rules-buffer-mode (rules-entry) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1271 (nth 2 rules-entry)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1272 (defun gdb-rules-update-trigger (rules-entry) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1273 (nth 3 rules-entry)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1274 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1275 (defun gdb-update-buffer-name () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1276 "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
|
1277 it in `gdb-buffer-rules'." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1278 (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
|
1279 gdb-buffer-rules)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1280 (when f (rename-buffer (funcall f))))) |
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-current-buffer-rules () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1283 "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
|
1284 (assoc gdb-buffer-type gdb-buffer-rules)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1285 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1286 (defun gdb-current-buffer-thread () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1287 "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
|
1288 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1289 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
|
1290 thread." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1291 (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
|
1292 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1293 (defun gdb-current-buffer-frame () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1294 "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
|
1295 (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
|
1296 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1297 (defun gdb-buffer-type (buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1298 "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
|
1299 (with-current-buffer buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1300 gdb-buffer-type)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1301 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1302 (defun gdb-buffer-shows-main-thread-p () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1303 "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
|
1304 is not bound to it." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1305 (current-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1306 (not (local-variable-p 'gdb-thread-number))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1307 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1308 (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
|
1309 "Get a specific GDB buffer. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1310 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1311 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
|
1312 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
|
1313 (catch 'found |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1314 (dolist (buffer (buffer-list) nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1315 (with-current-buffer buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1316 (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
|
1317 (or (not thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1318 (equal gdb-thread-number thread))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1319 (throw 'found buffer)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1320 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1321 (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
|
1322 "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
|
1323 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
|
1324 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1325 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
|
1326 buffer-local variable of the new buffer. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1327 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1328 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
|
1329 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1330 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
|
1331 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
|
1332 'update argument." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1333 (or (gdb-get-buffer buffer-type thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1334 (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
|
1335 (new (generate-new-buffer "limbo"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1336 (with-current-buffer new |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1337 (let ((mode (gdb-rules-buffer-mode rules)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1338 (trigger (gdb-rules-update-trigger rules))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1339 (when mode (funcall mode)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1340 (setq gdb-buffer-type buffer-type) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1341 (when thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1342 (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
|
1343 (set (make-local-variable 'gud-minor-mode) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1344 (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
|
1345 (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
|
1346 (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
|
1347 (when trigger |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1348 (gdb-add-subscriber gdb-buf-publisher |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1349 (cons (current-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1350 (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
|
1351 (funcall trigger 'start)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1352 (current-buffer)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1353 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1354 (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
|
1355 "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
|
1356 `(lambda (&rest args) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1357 (with-current-buffer ,buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1358 (apply ',expr args)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1359 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1360 ;; 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
|
1361 ;; `gdb-frame-io-buffer' |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1362 (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
|
1363 "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
|
1364 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1365 DOC is an optional documentation string." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1366 `(defun ,name (&optional thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1367 ,(when doc doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1368 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1369 (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
|
1370 (special-display-frame-alist gdb-frame-parameters)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1371 (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
|
1372 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1373 (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
|
1374 "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
|
1375 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1376 DOC is an optional documentation string." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1377 `(defun ,name (&optional thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1378 ,(when doc doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1379 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1380 (gdb-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1381 (gdb-get-buffer-create ,buffer thread) t))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1382 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1383 ;; 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
|
1384 (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
|
1385 split-horizontal) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1386 `(defun ,name (&optional thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1387 ,(when doc doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1388 (message thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1389 (gdb-preempt-existing-or-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1390 (gdb-get-buffer-create ,buffer thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1391 ,split-horizontal))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1392 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1393 ;; 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
|
1394 ;; 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
|
1395 ;; roles in defining a buffer type: |
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 ;; 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
|
1398 ;; |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1399 ;; The remaining function(s) are optional: |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1400 ;; |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1401 ;; 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
|
1402 ;; the proper mode for the buffer. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1403 ;; |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1404 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1405 (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
|
1406 (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
|
1407 (if binding |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1408 (setcdr binding rules) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1409 (push (cons buffer-type rules) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1410 gdb-buffer-rules)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1411 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1412 (defun gdb-parent-mode () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1413 "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
|
1414 (kill-all-local-variables) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1415 (setq buffer-read-only t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1416 (buffer-disable-undo) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1417 ;; 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
|
1418 ;; (if it has an associated update trigger) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1419 (add-hook |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1420 'kill-buffer-hook |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1421 (function |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1422 (lambda () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1423 (let ((trigger (gdb-rules-update-trigger |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1424 (gdb-current-buffer-rules)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1425 (when trigger |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1426 (gdb-delete-subscriber |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1427 gdb-buf-publisher |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1428 ;; 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
|
1429 ;; gdb-get-buffer-create |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1430 (cons (current-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1431 (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
|
1432 nil t)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1433 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1434 ;; 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
|
1435 ;; behalf of emacs (rather than the user). |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1436 ;; |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1437 (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
|
1438 'gdb-partial-output-name) |
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-partial-output-name () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1441 (concat " *partial-output-" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1442 (gdb-get-target-string) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1443 "*")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1444 |
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 (gdb-set-buffer-rules 'gdb-inferior-io |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1447 'gdb-inferior-io-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1448 'gdb-inferior-io-mode) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1449 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1450 (defun gdb-inferior-io-name () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1451 (concat "*input/output of " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1452 (gdb-get-target-string) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1453 "*")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1454 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1455 (defun gdb-display-io-buffer () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1456 "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
|
1457 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1458 (gdb-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1459 (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
|
1460 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1461 (defconst gdb-frame-parameters |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1462 '((height . 14) (width . 80) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1463 (unsplittable . t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1464 (tool-bar-lines . nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1465 (menu-bar-lines . nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1466 (minibuffer . nil))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1467 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1468 (defun gdb-frame-io-buffer () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1469 "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
|
1470 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1471 (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
|
1472 (special-display-frame-alist gdb-frame-parameters)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1473 (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
|
1474 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1475 (defvar gdb-inferior-io-mode-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1476 (let ((map (make-sparse-keymap))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1477 (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
|
1478 (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
|
1479 (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
|
1480 (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
|
1481 (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
|
1482 map)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1483 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1484 ;; 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
|
1485 (define-derived-mode gdb-inferior-io-mode comint-mode "Inferior I/O" |
111870
b47e85affa59
Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111850
diff
changeset
|
1486 "Major mode for gdb inferior-io." |
107550
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1487 :syntax-table nil :abbrev-table nil |
111870
b47e85affa59
Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111850
diff
changeset
|
1488 (make-comint-in-buffer "gdb-inferior" (current-buffer) nil)) |
107550
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1489 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1490 (defun gdb-inferior-filter (proc string) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1491 (unless (string-equal string "") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1492 (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
|
1493 (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
|
1494 (comint-output-filter proc string))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1495 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1496 (defun gdb-io-interrupt () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1497 "Interrupt the program being debugged." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1498 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1499 (interrupt-process |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1500 (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
|
1501 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1502 (defun gdb-io-quit () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1503 "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
|
1504 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1505 (quit-process |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1506 (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
|
1507 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1508 (defun gdb-io-stop () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1509 "Stop the program being debugged." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1510 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1511 (stop-process |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1512 (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
|
1513 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1514 (defun gdb-io-eof () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1515 "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
|
1516 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1517 (process-send-eof |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1518 (get-buffer-process gud-comint-buffer))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1519 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1520 (defun gdb-clear-inferior-io () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1521 (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
|
1522 (erase-buffer))) |
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 (defconst breakpoint-xpm-data |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1526 "/* XPM */ |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1527 static char *magick[] = { |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1528 /* columns rows colors chars-per-pixel */ |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1529 \"10 10 2 1\", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1530 \" c red\", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1531 \"+ c None\", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1532 /* pixels */ |
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 \"++ ++\", |
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 \" \", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1537 \" \", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1538 \" \", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1539 \" \", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1540 \"+ +\", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1541 \"++ ++\", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1542 \"+++ +++\", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1543 };" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1544 "XPM data used for breakpoint icon.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1545 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1546 (defconst breakpoint-enabled-pbm-data |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1547 "P1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1548 10 10\", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1549 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
|
1550 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
|
1551 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
|
1552 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
|
1553 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
|
1554 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
|
1555 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
|
1556 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
|
1557 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
|
1558 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
|
1559 "PBM data used for enabled breakpoint icon.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1560 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1561 (defconst breakpoint-disabled-pbm-data |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1562 "P1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1563 10 10\", |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1564 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
|
1565 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
|
1566 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
|
1567 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
|
1568 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
|
1569 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
|
1570 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
|
1571 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
|
1572 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
|
1573 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
|
1574 "PBM data used for disabled breakpoint icon.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1575 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1576 (defvar breakpoint-enabled-icon nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1577 "Icon for enabled breakpoint in display margin.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1578 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1579 (defvar breakpoint-disabled-icon nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1580 "Icon for disabled breakpoint in display margin.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1581 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1582 (declare-function define-fringe-bitmap "fringe.c" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1583 (bitmap bits &optional height width align)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1584 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1585 (and (display-images-p) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1586 ;; Bitmap for breakpoint in fringe |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1587 (define-fringe-bitmap 'breakpoint |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1588 "\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
|
1589 ;; Bitmap for gud-overlay-arrow in fringe |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1590 (define-fringe-bitmap 'hollow-right-triangle |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1591 "\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
|
1592 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1593 (defface breakpoint-enabled |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1594 '((t |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1595 :foreground "red1" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1596 :weight bold)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1597 "Face for enabled breakpoint icon in fringe." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1598 :group 'gdb) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1599 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1600 (defface breakpoint-disabled |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1601 '((((class color) (min-colors 88)) :foreground "grey70") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1602 ;; 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
|
1603 (((class color) (min-colors 8) (background light)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1604 :foreground "black") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1605 (((class color) (min-colors 8) (background dark)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1606 :foreground "white") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1607 (((type tty) (class mono)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1608 :inverse-video t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1609 (t :background "gray")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1610 "Face for disabled breakpoint icon in fringe." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1611 :group 'gdb) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1612 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1613 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1614 (defun gdb-send (proc string) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1615 "A comint send filter for gdb." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1616 (with-current-buffer gud-comint-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1617 (let ((inhibit-read-only t)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1618 (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
|
1619 ;; 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
|
1620 (if (not (string= "" string)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1621 (setq gdb-last-command string) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1622 (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
|
1623 (if gdb-enable-debug |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1624 (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
|
1625 (if (string-match "^-" string) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1626 ;; MI command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1627 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1628 (setq gdb-first-done-or-error t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1629 (process-send-string proc (concat string "\n"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1630 ;; CLI command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1631 (if (string-match "\\\\$" string) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1632 (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
|
1633 (setq gdb-first-done-or-error t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1634 (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
|
1635 gdb-continuation string "\"\n")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1636 (setq gdb-continuation nil)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1637 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1638 (defun gdb-input (item) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1639 (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
|
1640 (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
|
1641 (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
|
1642 (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
|
1643 (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
|
1644 (concat (car item) "\n"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1645 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1646 ;; 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
|
1647 (defun gdb-current-context-command (command) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1648 "Add --thread to gdb COMMAND when needed." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1649 (if (and gdb-thread-number |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1650 (string-equal gdb-version "7.0+")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1651 (concat command " --thread " gdb-thread-number) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1652 command)) |
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-buffer-name (name) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1655 "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
|
1656 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1657 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
|
1658 (concat "*" name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1659 (if (local-variable-p 'gdb-thread-number) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1660 (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
|
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 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1664 (defun gdb-current-context-mode-name (mode) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1665 "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
|
1666 `mode-name'." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1667 (concat mode |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1668 (if gdb-thread-number |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1669 (format " [thread %s]" gdb-thread-number) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1670 ""))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1671 |
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 (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
|
1674 "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
|
1675 :type 'string |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1676 :group 'gdb) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1677 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1678 (defun gdb-resync() |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1679 (setq gud-running nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1680 (setq gdb-output-sink 'user) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1681 (setq gdb-pending-triggers nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1682 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1683 (defun gdb-update () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1684 "Update buffers showing status of debug session." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1685 (when gdb-first-prompt |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1686 (gdb-force-mode-line-update |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1687 (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
|
1688 (gdb-init-1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1689 (setq gdb-first-prompt nil)) |
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 (gdb-get-main-selected-frame) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1692 ;; 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
|
1693 (gdb-get-buffer-create 'gdb-threads-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1694 ;; 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
|
1695 (gdb-get-buffer-create 'gdb-breakpoints-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1696 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1697 (gdb-emit-signal gdb-buf-publisher 'update) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1698 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1699 (gdb-get-changed-registers) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1700 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1701 (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
|
1702 (dolist (var gdb-var-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1703 (setcar (nthcdr 5 var) nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1704 (gdb-var-update))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1705 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1706 ;; 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
|
1707 ;; 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
|
1708 ;; changing current thread (see gdb-running) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1709 (defun gdb-setq-thread-number (number) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1710 "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
|
1711 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
|
1712 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
|
1713 ;; 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
|
1714 (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
|
1715 (setq gdb-frame-number "0") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1716 (gdb-update-gud-running)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1717 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1718 (defun gdb-update-gud-running () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1719 "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
|
1720 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1721 `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
|
1722 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1723 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
|
1724 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
|
1725 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
|
1726 `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
|
1727 instead. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1728 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1729 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
|
1730 is running." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1731 (let ((old-value gud-running)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1732 (setq gud-running |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1733 (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
|
1734 "running")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1735 ;; 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
|
1736 (when (and (gdb-current-buffer-thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1737 (not (eq gud-running old-value))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1738 (setq gdb-frame-number "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-run-p () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1741 "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
|
1742 (or (not gdb-active-process) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1743 (and (or |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1744 (not gdb-gud-control-all-threads) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1745 (not gdb-non-stop)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1746 (not gud-running)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1747 (and gdb-gud-control-all-threads |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1748 (> gdb-stopped-threads-count 0)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1749 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1750 (defun gdb-show-stop-p () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1751 "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
|
1752 (or (and (or |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1753 (not gdb-gud-control-all-threads) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1754 (not gdb-non-stop)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1755 gud-running) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1756 (and gdb-gud-control-all-threads |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1757 (> gdb-running-threads-count 0)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1758 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1759 ;; 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
|
1760 ;; 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
|
1761 ;; visited breakpoint is, use that window. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1762 (defun gdb-display-source-buffer (buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1763 (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
|
1764 (get-buffer-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1765 (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
|
1766 (source-window (or last-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1767 (if (and gdb-source-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1768 (window-live-p gdb-source-window)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1769 gdb-source-window)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1770 (when source-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1771 (setq gdb-source-window source-window) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1772 (set-window-buffer source-window buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1773 source-window)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1774 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1775 (defun gdb-car< (a b) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1776 (< (car a) (car b))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1777 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1778 (defvar gdbmi-record-list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1779 '((gdb-gdb . "(gdb) \n") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1780 (gdb-done . "\\([0-9]*\\)\\^done,?\\(.*?\\)\n") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1781 (gdb-starting . "\\([0-9]*\\)\\^running\n") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1782 (gdb-error . "\\([0-9]*\\)\\^error,\\(.*?\\)\n") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1783 (gdb-console . "~\\(\".*?\"\\)\n") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1784 (gdb-internals . "&\\(\".*?\"\\)\n") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1785 (gdb-stopped . "\\*stopped,?\\(.*?\\)\n") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1786 (gdb-running . "\\*running,\\(.*?\n\\)") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1787 (gdb-thread-created . "=thread-created,\\(.*?\n\\)") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1788 (gdb-thread-selected . "=thread-selected,\\(.*?\\)\n") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1789 (gdb-thread-exited . "=thread-exited,\\(.*?\n\\)") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1790 (gdb-ignored-notification . "=[-[:alpha:]]+,?\\(.*?\\)\n") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1791 (gdb-shell . "\\(\\(?:^.+\n\\)+\\)"))) |
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 (defun gud-gdbmi-marker-filter (string) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1794 "Filter GDB/MI output." |
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 ;; Record transactions if logging is enabled. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1797 (when gdb-enable-debug |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1798 (push (cons 'recv string) gdb-debug-log) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1799 (if (and gdb-debug-log-max |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1800 (> (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
|
1801 (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
|
1802 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1803 ;; 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
|
1804 (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
|
1805 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1806 ;; Start accumulating output for the GUD buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1807 (setq gdb-filter-output "") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1808 (let ((output-record) (output-record-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1809 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1810 ;; 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
|
1811 (dolist (gdbmi-record gdbmi-record-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1812 (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
|
1813 (push (list (match-beginning 0) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1814 (car gdbmi-record) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1815 (match-string 1 gud-marker-acc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1816 (match-string 2 gud-marker-acc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1817 (match-end 0)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1818 output-record-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1819 (setq gud-marker-acc |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1820 (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
|
1821 ;; Pad with spaces to preserve position. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1822 (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
|
1823 (substring gud-marker-acc (match-end 0)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1824 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1825 (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
|
1826 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1827 (dolist (output-record output-record-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1828 (let ((record-type (cadr output-record)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1829 (arg1 (nth 2 output-record)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1830 (arg2 (nth 3 output-record))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1831 (if (eq record-type 'gdb-error) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1832 (gdb-done-or-error arg2 arg1 'error) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1833 (if (eq record-type 'gdb-done) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1834 (gdb-done-or-error arg2 arg1 'done) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1835 ;; 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
|
1836 ;; 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
|
1837 (unless (and (eq record-type 'gdb-internals) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1838 (string-equal (read arg1) "No registers.\n")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1839 (funcall record-type arg1)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1840 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1841 (setq gdb-output-sink 'user) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1842 ;; Remove padding. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1843 (string-match "^ *" gud-marker-acc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1844 (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
|
1845 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1846 gdb-filter-output)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1847 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1848 (defun gdb-gdb (output-field)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1849 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1850 (defun gdb-shell (output-field) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1851 (let ((gdb-output-sink gdb-output-sink)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1852 (setq gdb-filter-output |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1853 (concat output-field gdb-filter-output)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1854 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1855 (defun gdb-ignored-notification (output-field)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1856 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1857 ;; 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
|
1858 (defun gdb-thread-created (output-field)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1859 (defun gdb-thread-exited (output-field) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1860 "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
|
1861 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
|
1862 (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
|
1863 (if (string= gdb-thread-number thread-id) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1864 (gdb-setq-thread-number nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1865 ;; 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
|
1866 ;; 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
|
1867 ;; 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
|
1868 ;; need to use gdb-wait-for-pending. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1869 (gdb-wait-for-pending |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1870 (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
|
1871 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1872 (defun gdb-thread-selected (output-field) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1873 "Handler for =thread-selected MI output record. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1874 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1875 Sets `gdb-thread-number' to new id." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1876 (let* ((result (gdb-json-string output-field)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1877 (thread-id (bindat-get-field result 'id))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1878 (gdb-setq-thread-number thread-id) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1879 ;; 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
|
1880 ;; 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
|
1881 ;; 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
|
1882 ;; 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
|
1883 ;; gdb-pending-triggers. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1884 ;; 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
|
1885 ;; 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
|
1886 (gdb-wait-for-pending |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1887 (gdb-update)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1888 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1889 (defun gdb-running (output-field) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1890 (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
|
1891 ;; 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
|
1892 ;; 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
|
1893 ;; 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
|
1894 ;; -thread-info command is sent. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1895 (when (or (string-equal thread-id "all") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1896 (string-equal thread-id gdb-thread-number)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1897 (setq gdb-frame-number nil))) |
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 (when (not gdb-non-stop) |
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 (setq gdb-active-process t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1904 (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
|
1905 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1906 (defun gdb-starting (output-field) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1907 ;; 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
|
1908 (setq gdb-inferior-status "running") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1909 (gdb-force-mode-line-update |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1910 (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
|
1911 (setq gdb-active-process t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1912 (setq gud-running t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1913 ;; 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
|
1914 ;; 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
|
1915 ;; Behaviour may change in the future. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1916 (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
|
1917 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1918 ;; -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
|
1919 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1920 (defun gdb-stopped (output-field) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1921 "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
|
1922 current thread and update GDB buffers." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1923 ;; Reason is available with target-async only |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1924 (let* ((result (gdb-json-string output-field)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1925 (reason (bindat-get-field result 'reason)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1926 (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
|
1927 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1928 ;; -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
|
1929 ;; thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1930 (when (not gdb-register-names) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1931 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1932 (list (concat "-data-list-register-names" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1933 (if (string-equal gdb-version "7.0+") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1934 (concat" --thread " thread-id))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1935 'gdb-register-names-handler))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1936 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1937 ;;; 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
|
1938 ;;; 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
|
1939 ;;; (when file |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1940 ;;; (setq |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1941 ;;; ;; Extract the frame position from the marker. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1942 ;;; gud-last-frame (cons file |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1943 ;;; (string-to-number |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1944 ;;; (match-string 6 gud-marker-acc))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1945 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1946 (setq gdb-inferior-status (or reason "unknown")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1947 (gdb-force-mode-line-update |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1948 (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
|
1949 (if (string-equal reason "exited-normally") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1950 (setq gdb-active-process nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1951 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1952 ;; Select new current thread. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1953 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1954 ;; 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
|
1955 (when gdb-switch-reasons |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1956 ;; 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
|
1957 ;; gdb-switch-when-another-stopped: |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1958 (when (or gdb-switch-when-another-stopped |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1959 (not (string= "stopped" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1960 (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
|
1961 ;; 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
|
1962 ;; reasons |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1963 (if (or (eq gdb-switch-reasons t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1964 (member reason gdb-switch-reasons)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1965 (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
|
1966 (message (concat "Switched to thread " thread-id)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1967 (gdb-setq-thread-number thread-id)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1968 (message (format "Thread %s stopped" thread-id))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1969 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1970 ;; Print "(gdb)" to GUD console |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1971 (when gdb-first-done-or-error |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1972 (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
|
1973 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1974 ;; 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
|
1975 ;; stopped |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1976 (when (or gdb-first-done-or-error |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1977 gdb-non-stop) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1978 ;; 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
|
1979 (gdb-update) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1980 (setq gdb-first-done-or-error nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1981 (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
|
1982 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1983 ;; 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
|
1984 ;; 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
|
1985 ;; buffer. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1986 (defun gdb-internals (output-field) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1987 (setq gdb-filter-output |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1988 (gdb-concat-output |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1989 gdb-filter-output |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1990 (let ((error-message |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1991 (read output-field))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1992 (put-text-property |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1993 0 (length error-message) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1994 'face font-lock-warning-face |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1995 error-message) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1996 error-message)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1997 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
1998 ;; 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
|
1999 ;; (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
|
2000 (defun gdb-console (output-field) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2001 (setq gdb-filter-output |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2002 (gdb-concat-output |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2003 gdb-filter-output |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2004 (read output-field)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2005 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2006 (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
|
2007 (if (string-equal token-number "") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2008 ;; Output from command entered by user |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2009 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2010 (setq gdb-output-sink 'user) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2011 (setq token-number nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2012 ;; MI error - send to minibuffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2013 (when (eq type 'error) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2014 ;; Skip "msg=" from `output-field' |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2015 (message (read (substring output-field 4))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2016 ;; 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
|
2017 ;; it is also in the console stream.) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2018 (setq output-field nil))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2019 ;; Output from command from frontend. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2020 (setq gdb-output-sink 'emacs)) |
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 (gdb-clear-partial-output) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2023 (when gdb-first-done-or-error |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2024 (unless (or token-number gud-running) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2025 (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
|
2026 (gdb-update) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2027 (setq gdb-first-done-or-error nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2028 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2029 (setq gdb-filter-output |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2030 (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
|
2031 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2032 (if token-number |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2033 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2034 (with-current-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2035 (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
|
2036 (funcall |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2037 (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
|
2038 (setq gdb-handler-alist |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2039 (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
|
2040 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2041 (defun gdb-concat-output (so-far new) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2042 (let ((sink gdb-output-sink)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2043 (cond |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2044 ((eq sink 'user) (concat so-far new)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2045 ((eq sink 'emacs) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2046 (gdb-append-to-partial-output new) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2047 so-far)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2048 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2049 (defun gdb-append-to-partial-output (string) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2050 (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
|
2051 (goto-char (point-max)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2052 (insert string))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2053 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2054 (defun gdb-clear-partial-output () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2055 (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
|
2056 (erase-buffer))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2057 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2058 (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
|
2059 "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
|
2060 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2061 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
|
2062 replaced with semicolons. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2063 |
110561 | 2064 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
|
2065 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
|
2066 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
|
2067 -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
|
2068 responses. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2069 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2070 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
|
2071 \"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
|
2072 -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
|
2073 incompatible with GDB/MI output syntax." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2074 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2075 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2076 (when fix-key |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2077 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2078 (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
|
2079 (replace-match "" nil nil nil 1)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2080 (when fix-list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2081 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2082 ;; 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
|
2083 (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
|
2084 (let ((p1 (goto-char (- (point) 2))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2085 (p2 (progn (forward-sexp) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2086 (1- (point))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2087 ;; Replace braces with brackets |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2088 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2089 (goto-char p1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2090 (delete-char 1) |
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 (goto-char p2) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2093 (delete-char 1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2094 (insert "]")))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2095 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2096 (insert "{") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2097 (while (re-search-forward |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2098 "\\([[:alnum:]-_]+\\)=\\({\\|\\[\\|\"\"\\|\".*?[^\\]\"\\)" nil t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2099 (replace-match "\"\\1\":\\2" nil nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2100 (goto-char (point-max)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2101 (insert "}"))) |
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-read-buffer (&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 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
|
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 (gdb-jsonify-buffer fix-key fix-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2108 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2109 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2110 (let ((json-array-type 'list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2111 (json-read)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2112 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2113 (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
|
2114 "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
|
2115 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2116 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
|
2117 (with-temp-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2118 (insert string) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2119 (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
|
2120 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2121 (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
|
2122 "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
|
2123 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2124 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
|
2125 (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
|
2126 (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
|
2127 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2128 (defun gdb-line-posns (line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2129 "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
|
2130 (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
|
2131 (cons |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2132 (line-beginning-position offset) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2133 (line-end-position offset)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2134 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2135 (defmacro gdb-mark-line (line variable) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2136 "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
|
2137 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2138 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
|
2139 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2140 Return position where LINE begins." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2141 `(save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2142 (let* ((posns (gdb-line-posns ,line)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2143 (start-posn (car posns)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2144 (end-posn (cdr posns))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2145 (set-marker ,variable (copy-marker start-posn)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2146 (when (not (> (car (window-fringes)) 0)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2147 (put-text-property start-posn end-posn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2148 'font-lock-face '(:inverse-video t))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2149 start-posn))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2150 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2151 (defun gdb-pad-string (string padding) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2152 (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
|
2153 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2154 ;; 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
|
2155 ;; 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
|
2156 ;; and provides |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2157 (defstruct |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2158 gdb-table |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2159 (column-sizes nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2160 (rows nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2161 (row-properties nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2162 (right-align nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2163 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2164 (defun gdb-mapcar* (function &rest seqs) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2165 "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
|
2166 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
|
2167 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
|
2168 out." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2169 (let ((shortest (apply #'min (mapcar #'length seqs)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2170 (mapcar (lambda (i) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2171 (apply function |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2172 (mapcar |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2173 (lambda (seq) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2174 (nth i seq)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2175 seqs))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2176 (number-sequence 0 (1- shortest))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2177 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2178 (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
|
2179 "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
|
2180 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2181 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
|
2182 calling `gdb-table-string'." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2183 (let ((rows (gdb-table-rows table)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2184 (row-properties (gdb-table-row-properties table)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2185 (column-sizes (gdb-table-column-sizes table)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2186 (right-align (gdb-table-right-align table))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2187 (when (not column-sizes) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2188 (setf (gdb-table-column-sizes table) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2189 (make-list (length row) 0))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2190 (setf (gdb-table-rows table) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2191 (append rows (list row))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2192 (setf (gdb-table-row-properties table) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2193 (append row-properties (list properties))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2194 (setf (gdb-table-column-sizes table) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2195 (gdb-mapcar* (lambda (x s) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2196 (let ((new-x |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2197 (max (abs x) (string-width (or s ""))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2198 (if right-align new-x (- new-x)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2199 (gdb-table-column-sizes table) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2200 row)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2201 ;; Avoid trailing whitespace at eol |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2202 (if (not (gdb-table-right-align table)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2203 (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
|
2204 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2205 (defun gdb-table-string (table &optional sep) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2206 "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
|
2207 (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
|
2208 (res "")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2209 (mapconcat |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2210 'identity |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2211 (gdb-mapcar* |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2212 (lambda (row properties) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2213 (apply 'propertize |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2214 (mapconcat 'identity |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2215 (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
|
2216 row column-sizes) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2217 sep) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2218 properties)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2219 (gdb-table-rows table) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2220 (gdb-table-row-properties table)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2221 "\n"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2222 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2223 ;; 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
|
2224 (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
|
2225 "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
|
2226 (let ((values)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2227 (dolist (field fields values) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2228 (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
|
2229 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2230 (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
|
2231 handler-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2232 &optional signal-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2233 "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
|
2234 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
|
2235 buffer with `gdb-bind-function-to-buffer'. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2236 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2237 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
|
2238 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
|
2239 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
|
2240 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
|
2241 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2242 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
|
2243 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
|
2244 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
|
2245 calling `gdb-current-context-command'). |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2246 `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
|
2247 `gdb-get-buffer-create'. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2248 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2249 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
|
2250 trigger argument when describing buffer types with |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2251 `gdb-set-buffer-rules'." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2252 `(defun ,trigger-name (&optional signal) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2253 (when |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2254 (or (not ,signal-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2255 (memq signal ,signal-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2256 (when (not (gdb-pending-p |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2257 (cons (current-buffer) ',trigger-name))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2258 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2259 (list ,gdb-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2260 (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
|
2261 (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
|
2262 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2263 ;; 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
|
2264 ;; def-gdb-trigger-and-handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2265 (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
|
2266 &optional nopreserve) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2267 "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
|
2268 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2269 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
|
2270 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2271 Delete ((current-buffer) . TRIGGER-NAME) from |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2272 `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
|
2273 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
|
2274 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2275 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
|
2276 `(defun ,handler-name () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2277 (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
|
2278 (let* ((buffer-read-only nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2279 (window (get-buffer-window (current-buffer) 0)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2280 (start (window-start window)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2281 (p (window-point window))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2282 (erase-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2283 (,custom-defun) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2284 (gdb-update-buffer-name) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2285 ,(when (not nopreserve) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2286 '(set-window-start window start) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2287 '(set-window-point window p))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2288 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2289 (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
|
2290 handler-name custom-defun |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2291 &optional signal-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2292 "Define trigger and handler. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2293 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2294 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
|
2295 `def-gdb-auto-update-trigger'. |
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 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
|
2298 `def-gdb-auto-update-handler'." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2299 `(progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2300 (def-gdb-auto-update-trigger ,trigger-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2301 ,gdb-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2302 ,handler-name ,signal-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2303 (def-gdb-auto-update-handler ,handler-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2304 ,trigger-name ,custom-defun))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2305 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2306 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2307 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2308 ;; 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
|
2309 (def-gdb-trigger-and-handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2310 gdb-invalidate-breakpoints "-break-list" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2311 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
|
2312 '(start update)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2313 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2314 (gdb-set-buffer-rules |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2315 'gdb-breakpoints-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2316 'gdb-breakpoints-buffer-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2317 'gdb-breakpoints-mode |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2318 'gdb-invalidate-breakpoints) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2319 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2320 (defun gdb-breakpoints-list-handler-custom () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2321 (let ((breakpoints-list (bindat-get-field |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2322 (gdb-json-partial-output "bkpt" "script") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2323 'BreakpointTable 'body)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2324 (table (make-gdb-table))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2325 (setq gdb-breakpoints-list nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2326 (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
|
2327 (dolist (breakpoint breakpoints-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2328 (add-to-list 'gdb-breakpoints-list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2329 (cons (bindat-get-field breakpoint 'number) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2330 breakpoint)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2331 (let ((at (bindat-get-field breakpoint 'at)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2332 (pending (bindat-get-field breakpoint 'pending)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2333 (func (bindat-get-field breakpoint 'func)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2334 (type (bindat-get-field breakpoint 'type))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2335 (gdb-table-add-row table |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2336 (list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2337 (bindat-get-field breakpoint 'number) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2338 type |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2339 (bindat-get-field breakpoint 'disp) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2340 (let ((flag (bindat-get-field breakpoint 'enabled))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2341 (if (string-equal flag "y") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2342 (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
|
2343 (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
|
2344 (bindat-get-field breakpoint 'addr) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2345 (bindat-get-field breakpoint 'times) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2346 (if (string-match ".*watchpoint" type) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2347 (bindat-get-field breakpoint 'what) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2348 (or pending at |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2349 (concat "in " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2350 (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
|
2351 (gdb-frame-location breakpoint))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2352 ;; 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
|
2353 ;; information |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2354 (append (list 'gdb-breakpoint breakpoint) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2355 (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
|
2356 mouse-face highlight)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2357 (insert (gdb-table-string table " ")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2358 (gdb-place-breakpoints))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2359 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2360 ;; 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
|
2361 (defun gdb-place-breakpoints () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2362 (let ((flag) (bptno)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2363 ;; 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
|
2364 (dolist (buffer (buffer-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2365 (with-current-buffer buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2366 (if (and (eq gud-minor-mode 'gdbmi) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2367 (not (string-match "\\` ?\\*.+\\*\\'" (buffer-name)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2368 (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
|
2369 (dolist (breakpoint gdb-breakpoints-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2370 (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
|
2371 ; an associative list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2372 (line (bindat-get-field breakpoint 'line))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2373 (when line |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2374 (let ((file (bindat-get-field breakpoint 'fullname)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2375 (flag (bindat-get-field breakpoint 'enabled)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2376 (bptno (bindat-get-field breakpoint 'number))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2377 (unless (file-exists-p file) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2378 (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
|
2379 (if (and file |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2380 (not (string-equal file "File not found"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2381 (with-current-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2382 (find-file-noselect file 'nowarn) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2383 (gdb-init-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2384 ;; 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
|
2385 (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
|
2386 (string-to-number line))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2387 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2388 (list (concat "list " file ":1") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2389 'ignore)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2390 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2391 (list "-file-list-exec-source-file" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2392 `(lambda () (gdb-get-location |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2393 ,bptno ,line ,flag))))))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2394 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2395 (defvar gdb-source-file-regexp "fullname=\"\\(.*?\\)\"") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2396 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2397 (defun gdb-get-location (bptno line flag) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2398 "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
|
2399 Put in buffer and place breakpoint icon." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2400 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2401 (catch 'file-not-found |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2402 (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
|
2403 (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
|
2404 (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
|
2405 (gdb-resync) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2406 (unless (assoc bptno gdb-location-alist) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2407 (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
|
2408 (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
|
2409 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
|
2410 (throw 'file-not-found nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2411 (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
|
2412 (gdb-init-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2413 ;; 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
|
2414 (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
|
2415 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2416 (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
|
2417 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2418 (defun gdb-find-file-hook () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2419 "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
|
2420 of the current session." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2421 (if (and (buffer-name gud-comint-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2422 ;; 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
|
2423 gud-comint-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2424 (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
|
2425 'gdbmi)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2426 (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
|
2427 (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
|
2428 (gdb-init-buffer))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2429 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2430 (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
|
2431 (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
|
2432 (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
|
2433 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2434 (defun gdb-mouse-set-clear-breakpoint (event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2435 "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
|
2436 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
|
2437 (interactive "e") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2438 (mouse-minibuffer-check event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2439 (let ((posn (event-end event))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2440 (with-selected-window (posn-window posn) |
111870
b47e85affa59
Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111850
diff
changeset
|
2441 (if (or (buffer-file-name) (derived-mode-p 'gdb-disassembly-mode)) |
107550
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2442 (if (numberp (posn-point posn)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2443 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2444 (goto-char (posn-point posn)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2445 (if (or (posn-object posn) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2446 (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
|
2447 'breakpoint)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2448 (gud-remove nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2449 (gud-break nil))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2450 (posn-set-point posn)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2451 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2452 (defun gdb-mouse-toggle-breakpoint-margin (event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2453 "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
|
2454 (interactive "e") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2455 (mouse-minibuffer-check event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2456 (let ((posn (event-end event))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2457 (if (numberp (posn-point posn)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2458 (with-selected-window (posn-window posn) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2459 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2460 (goto-char (posn-point posn)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2461 (if (posn-object posn) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2462 (gud-basic-call |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2463 (let ((bptno (get-text-property |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2464 0 'gdb-bptno (car (posn-string posn))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2465 (concat |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2466 (if (get-text-property |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2467 0 'gdb-enabled (car (posn-string posn))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2468 "-break-disable " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2469 "-break-enable ") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2470 bptno))))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2471 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2472 (defun gdb-mouse-toggle-breakpoint-fringe (event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2473 "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
|
2474 (interactive "e") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2475 (mouse-minibuffer-check event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2476 (let* ((posn (event-end event)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2477 (pos (posn-point posn)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2478 obj) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2479 (when (numberp pos) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2480 (with-selected-window (posn-window posn) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2481 (with-current-buffer (window-buffer (selected-window)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2482 (goto-char pos) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2483 (dolist (overlay (overlays-in pos pos)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2484 (when (overlay-get overlay 'put-break) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2485 (setq obj (overlay-get overlay 'before-string)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2486 (when (stringp obj) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2487 (gud-basic-call |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2488 (concat |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2489 (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
|
2490 "-break-disable " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2491 "-break-enable ") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2492 (get-text-property 0 'gdb-bptno obj))))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2493 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2494 (defun gdb-breakpoints-buffer-name () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2495 (concat "*breakpoints of " (gdb-get-target-string) "*")) |
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 (def-gdb-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2498 gdb-display-breakpoints-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2499 'gdb-breakpoints-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2500 "Display status of user-settable breakpoints.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2501 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2502 (def-gdb-frame-for-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2503 gdb-frame-breakpoints-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2504 'gdb-breakpoints-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2505 "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
|
2506 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2507 (defvar gdb-breakpoints-mode-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2508 (let ((map (make-sparse-keymap)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2509 (menu (make-sparse-keymap "Breakpoints"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2510 (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
|
2511 (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
|
2512 (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
|
2513 (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
|
2514 (suppress-keymap map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2515 (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
|
2516 (define-key map " " 'gdb-toggle-breakpoint) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2517 (define-key map "D" 'gdb-delete-breakpoint) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2518 ;; 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
|
2519 (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
|
2520 (define-key map "\r" 'gdb-goto-breakpoint) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2521 (define-key map "\t" '(lambda () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2522 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2523 (gdb-set-window-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2524 (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
|
2525 (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
|
2526 (define-key map [follow-link] 'mouse-face) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2527 map)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2528 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2529 (defun gdb-delete-frame-or-window () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2530 "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
|
2531 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2532 (if (one-window-p) (delete-frame) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2533 (delete-window))) |
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 ;;from make-mode-line-mouse-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2536 (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
|
2537 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
|
2538 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
|
2539 corresponding to the mode line clicked." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2540 (let ((map (make-sparse-keymap))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2541 (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
|
2542 (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
|
2543 map)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2544 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2545 (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
|
2546 `(propertize ,name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2547 'help-echo ,help-echo |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2548 'mouse-face ',mouse-face |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2549 'face ',face |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2550 'local-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2551 (gdb-make-header-line-mouse-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2552 'mouse-1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2553 (lambda (event) (interactive "e") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2554 (save-selected-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2555 (select-window (posn-window (event-start event))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2556 (gdb-set-window-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2557 (gdb-get-buffer-create ',buffer) t) ))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2558 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2559 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2560 ;; 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
|
2561 ;;; Threads view |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2562 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2563 (defun gdb-threads-buffer-name () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2564 (concat "*threads of " (gdb-get-target-string) "*")) |
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-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2567 gdb-display-threads-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2568 'gdb-threads-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2569 "Display GDB 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 (def-gdb-frame-for-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2572 gdb-frame-threads-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2573 'gdb-threads-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2574 "Display GDB threads in a new frame.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2575 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2576 (def-gdb-trigger-and-handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2577 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
|
2578 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
|
2579 '(start update update-threads)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2580 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2581 (gdb-set-buffer-rules |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2582 'gdb-threads-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2583 'gdb-threads-buffer-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2584 'gdb-threads-mode |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2585 'gdb-invalidate-threads) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2586 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2587 (defvar gdb-threads-font-lock-keywords |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2588 '(("in \\([^ ]+\\)" (1 font-lock-function-name-face)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2589 (" \\(stopped\\)" (1 font-lock-warning-face)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2590 (" \\(running\\)" (1 font-lock-string-face)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2591 ("\\(\\(\\sw\\|[_.]\\)+\\)=" (1 font-lock-variable-name-face))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2592 "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
|
2593 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2594 (defvar gdb-threads-mode-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2595 (let ((map (make-sparse-keymap))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2596 (define-key map "\r" 'gdb-select-thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2597 (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
|
2598 (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
|
2599 (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
|
2600 (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
|
2601 (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
|
2602 (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
|
2603 (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
|
2604 (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
|
2605 (define-key map "i" 'gdb-interrupt-thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2606 (define-key map "c" 'gdb-continue-thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2607 (define-key map "s" 'gdb-step-thread) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2608 (define-key map "\t" '(lambda () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2609 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2610 (gdb-set-window-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2611 (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
|
2612 (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
|
2613 (define-key map [follow-link] 'mouse-face) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2614 map)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2615 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2616 (defvar gdb-threads-header |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2617 (list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2618 (gdb-propertize-header "Breakpoints" gdb-breakpoints-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2619 "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
|
2620 " " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2621 (gdb-propertize-header "Threads" gdb-threads-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2622 nil nil mode-line))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2623 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2624 (define-derived-mode gdb-threads-mode gdb-parent-mode "Threads" |
111870
b47e85affa59
Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111850
diff
changeset
|
2625 "Major mode for GDB threads." |
107550
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2626 (setq gdb-thread-position (make-marker)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2627 (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
|
2628 (setq header-line-format gdb-threads-header) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2629 (set (make-local-variable 'font-lock-defaults) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2630 '(gdb-threads-font-lock-keywords)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2631 'gdb-invalidate-threads) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2632 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2633 (defun gdb-thread-list-handler-custom () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2634 (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
|
2635 (table (make-gdb-table)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2636 (marked-line nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2637 (setq gdb-threads-list nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2638 (setq gdb-running-threads-count 0) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2639 (setq gdb-stopped-threads-count 0) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2640 (set-marker gdb-thread-position nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2641 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2642 (dolist (thread (reverse threads-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2643 (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
|
2644 (add-to-list 'gdb-threads-list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2645 (cons (bindat-get-field thread 'id) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2646 thread)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2647 (if running |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2648 (incf gdb-running-threads-count) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2649 (incf gdb-stopped-threads-count)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2650 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2651 (gdb-table-add-row table |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2652 (list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2653 (bindat-get-field thread 'id) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2654 (concat |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2655 (if gdb-thread-buffer-verbose-names |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2656 (concat (bindat-get-field thread 'target-id) " ") "") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2657 (bindat-get-field thread 'state) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2658 ;; Include frame information for stopped threads |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2659 (if (not running) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2660 (concat |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2661 " in " (bindat-get-field thread 'frame 'func) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2662 (if gdb-thread-buffer-arguments |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2663 (concat |
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 (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
|
2666 (mapconcat |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2667 (lambda (arg) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2668 (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
|
2669 args ",")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2670 ")") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2671 "") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2672 (if gdb-thread-buffer-locations |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2673 (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
|
2674 (if gdb-thread-buffer-addresses |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2675 (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
|
2676 ""))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2677 (list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2678 'gdb-thread thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2679 'mouse-face 'highlight |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2680 'help-echo "mouse-2, RET: select thread"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2681 (when (string-equal gdb-thread-number |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2682 (bindat-get-field thread 'id)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2683 (setq marked-line (length gdb-threads-list)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2684 (insert (gdb-table-string table " ")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2685 (when marked-line |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2686 (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
|
2687 ;; 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
|
2688 ;; gdb-threads-list is up-to-date |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2689 (gdb-update-gud-running) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2690 (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
|
2691 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2692 (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
|
2693 "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
|
2694 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2695 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
|
2696 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
|
2697 'gdb-thread is nil, error is signaled." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2698 `(defun ,name (&optional event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2699 ,(when doc doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2700 (interactive (list last-input-event)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2701 (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
|
2702 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2703 (beginning-of-line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2704 (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
|
2705 (if thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2706 ,custom-defun |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2707 (error "Not recognized as thread line")))))) |
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 (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
|
2710 "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
|
2711 on the current line." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2712 `(def-gdb-thread-buffer-command ,name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2713 (,buffer-command (bindat-get-field thread 'id)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2714 ,doc)) |
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-command gdb-select-thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2717 (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
|
2718 (gdb-setq-thread-number new-id) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2719 (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
|
2720 (gdb-update)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2721 "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
|
2722 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2723 (def-gdb-thread-buffer-simple-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2724 gdb-display-stack-for-thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2725 gdb-preemptively-display-stack-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2726 "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
|
2727 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2728 (def-gdb-thread-buffer-simple-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2729 gdb-display-locals-for-thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2730 gdb-preemptively-display-locals-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2731 "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
|
2732 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2733 (def-gdb-thread-buffer-simple-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2734 gdb-display-registers-for-thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2735 gdb-preemptively-display-registers-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2736 "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
|
2737 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2738 (def-gdb-thread-buffer-simple-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2739 gdb-display-disassembly-for-thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2740 gdb-preemptively-display-disassembly-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2741 "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
|
2742 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2743 (def-gdb-thread-buffer-simple-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2744 gdb-frame-stack-for-thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2745 gdb-frame-stack-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2746 "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
|
2747 current line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2748 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2749 (def-gdb-thread-buffer-simple-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2750 gdb-frame-locals-for-thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2751 gdb-frame-locals-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2752 "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
|
2753 current line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2754 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2755 (def-gdb-thread-buffer-simple-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2756 gdb-frame-registers-for-thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2757 gdb-frame-registers-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2758 "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
|
2759 current line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2760 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2761 (def-gdb-thread-buffer-simple-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2762 gdb-frame-disassembly-for-thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2763 gdb-frame-disassembly-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2764 "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
|
2765 current line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2766 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2767 (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
|
2768 "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
|
2769 `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
|
2770 line." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2771 `(def-gdb-thread-buffer-command ,name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2772 (if gdb-non-stop |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2773 (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
|
2774 (gdb-gud-control-all-threads nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2775 (call-interactively #',gud-command)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2776 (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
|
2777 ,doc)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2778 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2779 (def-gdb-thread-buffer-gud-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2780 gdb-interrupt-thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2781 gud-stop-subjob |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2782 "Interrupt thread at current line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2783 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2784 (def-gdb-thread-buffer-gud-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2785 gdb-continue-thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2786 gud-cont |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2787 "Continue thread at current line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2788 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2789 (def-gdb-thread-buffer-gud-command |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2790 gdb-step-thread |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2791 gud-step |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2792 "Step thread at current line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2793 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2794 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2795 ;;; Memory view |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2796 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2797 (defcustom gdb-memory-rows 8 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2798 "Number of data rows in memory window." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2799 :type 'integer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2800 :group 'gud |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2801 :version "23.2") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2802 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2803 (defcustom gdb-memory-columns 4 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2804 "Number of data columns in memory window." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2805 :type 'integer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2806 :group 'gud |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2807 :version "23.2") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2808 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2809 (defcustom gdb-memory-format "x" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2810 "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
|
2811 :type '(choice (const :tag "Hexadecimal" "x") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2812 (const :tag "Signed decimal" "d") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2813 (const :tag "Unsigned decimal" "u") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2814 (const :tag "Octal" "o") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2815 (const :tag "Binary" "t")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2816 :group 'gud |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2817 :version "22.1") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2818 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2819 (defcustom gdb-memory-unit 4 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2820 "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
|
2821 :type '(choice (const :tag "Byte" 1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2822 (const :tag "Halfword" 2) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2823 (const :tag "Word" 4) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2824 (const :tag "Giant word" 8)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2825 :group 'gud |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2826 :version "23.2") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2827 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2828 (def-gdb-trigger-and-handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2829 gdb-invalidate-memory |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2830 (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
|
2831 gdb-memory-address |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2832 gdb-memory-format |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2833 gdb-memory-unit |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2834 gdb-memory-rows |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2835 gdb-memory-columns) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2836 gdb-read-memory-handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2837 gdb-read-memory-custom |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2838 '(start update)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2839 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2840 (gdb-set-buffer-rules |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2841 'gdb-memory-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2842 'gdb-memory-buffer-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2843 'gdb-memory-mode |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2844 'gdb-invalidate-memory) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2845 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2846 (defun gdb-memory-column-width (size format) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2847 "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
|
2848 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2849 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
|
2850 in `gdb-memory-format'." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2851 (let ((format-base (cdr (assoc format |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2852 '(("x" . 16) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2853 ("d" . 10) ("u" . 10) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2854 ("o" . 8) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2855 ("t" . 2)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2856 (if format-base |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2857 (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
|
2858 (cond ((string-equal format "x") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2859 (+ 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
|
2860 ((or (string-equal format "d") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2861 (string-equal format "o")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2862 (1+ res)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2863 (t res))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2864 (error "Unknown format")))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2865 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2866 (defun gdb-read-memory-custom () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2867 (let* ((res (gdb-json-partial-output)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2868 (err-msg (bindat-get-field res 'msg))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2869 (if (not err-msg) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2870 (let ((memory (bindat-get-field res 'memory))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2871 (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
|
2872 (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
|
2873 (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
|
2874 (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
|
2875 (dolist (row memory) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2876 (insert (concat (bindat-get-field row 'addr) ":")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2877 (dolist (column (bindat-get-field row 'data)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2878 (insert (gdb-pad-string column |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2879 (+ 2 (gdb-memory-column-width |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2880 gdb-memory-unit |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2881 gdb-memory-format))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2882 (newline))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2883 ;; 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
|
2884 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2885 (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
|
2886 (gdb-invalidate-memory 'update) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2887 (error err-msg)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2888 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2889 (defvar gdb-memory-mode-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2890 (let ((map (make-sparse-keymap))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2891 (suppress-keymap map t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2892 (define-key map "q" 'kill-this-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2893 (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
|
2894 (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
|
2895 (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
|
2896 (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
|
2897 (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
|
2898 (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
|
2899 (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
|
2900 (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
|
2901 (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
|
2902 (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
|
2903 (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
|
2904 (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
|
2905 (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
|
2906 (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
|
2907 map)) |
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 (defun gdb-memory-set-address-event (event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2910 "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
|
2911 (interactive "e") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2912 (save-selected-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2913 (select-window (posn-window (event-start event))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2914 (gdb-memory-set-address))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2915 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2916 ;; Non-event version for use within keymap |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2917 (defun gdb-memory-set-address () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2918 "Set the start memory address." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2919 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2920 (let ((arg (read-from-minibuffer "Memory address: "))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2921 (setq gdb-memory-address arg)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2922 (gdb-invalidate-memory 'update)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2923 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2924 (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
|
2925 "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
|
2926 `(defun ,name (event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2927 ,(when doc doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2928 (interactive "e") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2929 (save-selected-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2930 (select-window (posn-window (event-start event))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2931 (let* ((arg (read-from-minibuffer ,echo-string)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2932 (count (string-to-number arg))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2933 (if (<= count 0) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2934 (error "Positive number only") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2935 (customize-set-variable ',variable count) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2936 (gdb-invalidate-memory 'update)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2937 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2938 (def-gdb-set-positive-number |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2939 gdb-memory-set-rows |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2940 gdb-memory-rows |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2941 "Rows: " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2942 "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
|
2943 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2944 (def-gdb-set-positive-number |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2945 gdb-memory-set-columns |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2946 gdb-memory-columns |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2947 "Columns: " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2948 "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
|
2949 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2950 (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
|
2951 "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
|
2952 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2953 DOC is an optional documentation string." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2954 `(defun ,name () ,(when doc doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2955 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2956 (customize-set-variable 'gdb-memory-format ,format) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2957 (gdb-invalidate-memory 'update))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2958 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2959 (def-gdb-memory-format |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2960 gdb-memory-format-binary "t" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2961 "Set the display format to binary.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2962 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2963 (def-gdb-memory-format |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2964 gdb-memory-format-octal "o" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2965 "Set the display format to octal.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2966 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2967 (def-gdb-memory-format |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2968 gdb-memory-format-unsigned "u" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2969 "Set the display format to unsigned decimal.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2970 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2971 (def-gdb-memory-format |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2972 gdb-memory-format-signed "d" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2973 "Set the display format to decimal.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2974 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2975 (def-gdb-memory-format |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2976 gdb-memory-format-hexadecimal "x" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2977 "Set the display format to hexadecimal.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2978 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2979 (defvar gdb-memory-format-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2980 (let ((map (make-sparse-keymap))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2981 (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
|
2982 map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2983 "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
|
2984 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2985 (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
|
2986 "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
|
2987 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2988 (define-key gdb-memory-format-menu [binary] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2989 '(menu-item "Binary" gdb-memory-format-binary |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2990 :button (:radio . (equal gdb-memory-format "t")))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2991 (define-key gdb-memory-format-menu [octal] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2992 '(menu-item "Octal" gdb-memory-format-octal |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2993 :button (:radio . (equal gdb-memory-format "o")))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2994 (define-key gdb-memory-format-menu [unsigned] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2995 '(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
|
2996 :button (:radio . (equal gdb-memory-format "u")))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2997 (define-key gdb-memory-format-menu [signed] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
2998 '(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
|
2999 :button (:radio . (equal gdb-memory-format "d")))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3000 (define-key gdb-memory-format-menu [hexadecimal] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3001 '(menu-item "Hexadecimal" gdb-memory-format-hexadecimal |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3002 :button (:radio . (equal gdb-memory-format "x")))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3003 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3004 (defun gdb-memory-format-menu (event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3005 (interactive "@e") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3006 (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
|
3007 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3008 (defun gdb-memory-format-menu-1 (event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3009 (interactive "e") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3010 (save-selected-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3011 (select-window (posn-window (event-start event))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3012 (let* ((selection (gdb-memory-format-menu event)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3013 (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
|
3014 (vector (car selection)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3015 (if binding (call-interactively binding))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3016 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3017 (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
|
3018 "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
|
3019 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3020 DOC is an optional documentation string." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3021 `(defun ,name () ,(when doc doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3022 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3023 (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
|
3024 (gdb-invalidate-memory 'update))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3025 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3026 (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
|
3027 "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
|
3028 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3029 (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
|
3030 "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
|
3031 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3032 (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
|
3033 "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
|
3034 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3035 (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
|
3036 "Set the unit size to bytes.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3037 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3038 (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
|
3039 "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
|
3040 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3041 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
|
3042 stored in ADDRESS-VAR variable. |
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 DOC is an optional documentation string." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3045 `(defun ,name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3046 ,(when doc doc) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3047 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3048 (let ((gdb-memory-address ,address-var)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3049 (gdb-invalidate-memory)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3050 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3051 (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
|
3052 gdb-memory-prev-page) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3053 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3054 (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
|
3055 gdb-memory-next-page) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3056 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3057 (defvar gdb-memory-unit-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3058 (let ((map (make-sparse-keymap))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3059 (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
|
3060 map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3061 "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
|
3062 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3063 (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
|
3064 "Menu of units in the header line.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3065 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3066 (define-key gdb-memory-unit-menu [giantwords] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3067 '(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
|
3068 :button (:radio . (equal gdb-memory-unit 8)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3069 (define-key gdb-memory-unit-menu [words] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3070 '(menu-item "Words" gdb-memory-unit-word |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3071 :button (:radio . (equal gdb-memory-unit 4)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3072 (define-key gdb-memory-unit-menu [halfwords] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3073 '(menu-item "Halfwords" gdb-memory-unit-halfword |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3074 :button (:radio . (equal gdb-memory-unit 2)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3075 (define-key gdb-memory-unit-menu [bytes] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3076 '(menu-item "Bytes" gdb-memory-unit-byte |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3077 :button (:radio . (equal gdb-memory-unit 1)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3078 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3079 (defun gdb-memory-unit-menu (event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3080 (interactive "@e") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3081 (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
|
3082 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3083 (defun gdb-memory-unit-menu-1 (event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3084 (interactive "e") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3085 (save-selected-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3086 (select-window (posn-window (event-start event))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3087 (let* ((selection (gdb-memory-unit-menu event)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3088 (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
|
3089 (vector (car selection)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3090 (if binding (call-interactively binding))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3091 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3092 (defvar gdb-memory-font-lock-keywords |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3093 '(;; <__function.name+n> |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3094 ("<\\(\\(\\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
|
3095 ) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3096 "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
|
3097 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3098 (defvar gdb-memory-header |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3099 '(:eval |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3100 (concat |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3101 "Start address[" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3102 (propertize "-" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3103 'face font-lock-warning-face |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3104 'help-echo "mouse-1: decrement address" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3105 'mouse-face 'mode-line-highlight |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3106 '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
|
3107 'mouse-1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3108 #'gdb-memory-show-previous-page)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3109 "|" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3110 (propertize "+" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3111 'face font-lock-warning-face |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3112 'help-echo "mouse-1: increment address" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3113 'mouse-face 'mode-line-highlight |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3114 '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
|
3115 'mouse-1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3116 #'gdb-memory-show-next-page)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3117 "]: " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3118 (propertize gdb-memory-address |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3119 'face font-lock-warning-face |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3120 'help-echo "mouse-1: set start address" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3121 'mouse-face 'mode-line-highlight |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3122 '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
|
3123 'mouse-1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3124 #'gdb-memory-set-address-event)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3125 " Rows: " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3126 (propertize (number-to-string gdb-memory-rows) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3127 'face font-lock-warning-face |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3128 '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
|
3129 'mouse-face 'mode-line-highlight |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3130 '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
|
3131 'mouse-1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3132 #'gdb-memory-set-rows)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3133 " Columns: " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3134 (propertize (number-to-string gdb-memory-columns) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3135 'face font-lock-warning-face |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3136 '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
|
3137 'mouse-face 'mode-line-highlight |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3138 '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
|
3139 'mouse-1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3140 #'gdb-memory-set-columns)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3141 " Display Format: " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3142 (propertize gdb-memory-format |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3143 'face font-lock-warning-face |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3144 'help-echo "mouse-3: select display format" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3145 'mouse-face 'mode-line-highlight |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3146 'local-map gdb-memory-format-map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3147 " Unit Size: " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3148 (propertize (number-to-string gdb-memory-unit) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3149 'face font-lock-warning-face |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3150 'help-echo "mouse-3: select unit size" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3151 'mouse-face 'mode-line-highlight |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3152 'local-map gdb-memory-unit-map))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3153 "Header line used in `gdb-memory-mode'.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3154 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3155 (define-derived-mode gdb-memory-mode gdb-parent-mode "Memory" |
111870
b47e85affa59
Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111850
diff
changeset
|
3156 "Major mode for examining memory." |
107550
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3157 (setq header-line-format gdb-memory-header) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3158 (set (make-local-variable 'font-lock-defaults) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3159 '(gdb-memory-font-lock-keywords)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3160 'gdb-invalidate-memory) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3161 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3162 (defun gdb-memory-buffer-name () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3163 (concat "*memory of " (gdb-get-target-string) "*")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3164 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3165 (def-gdb-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3166 gdb-display-memory-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3167 'gdb-memory-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3168 "Display memory contents.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3169 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3170 (defun gdb-frame-memory-buffer () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3171 "Display memory contents in a new frame." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3172 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3173 (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
|
3174 (special-display-frame-alist |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3175 `((left-fringe . 0) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3176 (right-fringe . 0) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3177 (width . 83) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3178 ,@gdb-frame-parameters))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3179 (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
|
3180 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3181 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3182 ;;; Disassembly view |
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 (defun gdb-disassembly-buffer-name () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3185 (gdb-current-context-buffer-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3186 (concat "disassembly of " (gdb-get-target-string)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3187 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3188 (def-gdb-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3189 gdb-display-disassembly-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3190 'gdb-disassembly-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3191 "Display disassembly for current stack frame.") |
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-preempt-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3194 gdb-preemptively-display-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 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3197 (def-gdb-frame-for-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3198 gdb-frame-disassembly-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3199 'gdb-disassembly-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3200 "Display disassembly in a new frame.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3201 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3202 (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
|
3203 (let* ((frame (gdb-current-buffer-frame)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3204 (file (bindat-get-field frame 'fullname)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3205 (line (bindat-get-field frame 'line))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3206 (when file |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3207 (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
|
3208 gdb-disassembly-handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3209 ;; 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
|
3210 ;; 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
|
3211 '(start update-disassembly)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3212 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3213 (def-gdb-auto-update-handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3214 gdb-disassembly-handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3215 gdb-invalidate-disassembly |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3216 gdb-disassembly-handler-custom |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3217 t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3218 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3219 (gdb-set-buffer-rules |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3220 'gdb-disassembly-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3221 'gdb-disassembly-buffer-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3222 'gdb-disassembly-mode |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3223 'gdb-invalidate-disassembly) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3224 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3225 (defvar gdb-disassembly-font-lock-keywords |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3226 '(;; <__function.name+n> |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3227 ("<\\(\\(\\sw\\|[_.]\\)+\\)\\(\\+[0-9]+\\)?>" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3228 (1 font-lock-function-name-face)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3229 ;; 0xNNNNNNNN <__function.name+n>: opcode |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3230 ("^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
|
3231 (4 font-lock-keyword-face)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3232 ;; %register(at least i386) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3233 ("%\\sw+" . font-lock-variable-name-face) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3234 ("^\\(Dump of assembler code for function\\) \\(.+\\):" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3235 (1 font-lock-comment-face) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3236 (2 font-lock-function-name-face)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3237 ("^\\(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
|
3238 "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
|
3239 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3240 (defvar gdb-disassembly-mode-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3241 ;; TODO |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3242 (let ((map (make-sparse-keymap))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3243 (suppress-keymap map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3244 (define-key map "q" 'kill-this-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3245 map)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3246 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3247 (define-derived-mode gdb-disassembly-mode gdb-parent-mode "Disassembly" |
111870
b47e85affa59
Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111850
diff
changeset
|
3248 "Major mode for GDB disassembly information." |
107550
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3249 ;; TODO Rename overlay variable for disassembly mode |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3250 (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
|
3251 (setq fringes-outside-margins t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3252 (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
|
3253 (set (make-local-variable 'font-lock-defaults) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3254 '(gdb-disassembly-font-lock-keywords)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3255 'gdb-invalidate-disassembly) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3256 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3257 (defun gdb-disassembly-handler-custom () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3258 (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
|
3259 (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
|
3260 (pos 1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3261 (table (make-gdb-table)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3262 (marked-line nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3263 (dolist (instr instructions) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3264 (gdb-table-add-row table |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3265 (list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3266 (bindat-get-field instr 'address) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3267 (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
|
3268 (bindat-get-field instr 'inst))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3269 (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
|
3270 address) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3271 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3272 (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
|
3273 (setq fringe-indicator-alist |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3274 (if (string-equal gdb-frame-number "0") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3275 nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3276 '((overlay-arrow . hollow-right-triangle))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3277 (insert (gdb-table-string table " ")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3278 (gdb-disassembly-place-breakpoints) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3279 ;; 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
|
3280 ;; that point |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3281 (when marked-line |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3282 (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
|
3283 (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
|
3284 (setq mode-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3285 (gdb-current-context-mode-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3286 (concat "Disassembly: " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3287 (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
|
3288 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3289 (defun gdb-disassembly-place-breakpoints () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3290 (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
|
3291 (dolist (breakpoint gdb-breakpoints-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3292 (let* ((breakpoint (cdr breakpoint)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3293 (bptno (bindat-get-field breakpoint 'number)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3294 (flag (bindat-get-field breakpoint 'enabled)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3295 (address (bindat-get-field breakpoint 'addr))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3296 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3297 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3298 (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
|
3299 (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
|
3300 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3301 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3302 (defvar gdb-breakpoints-header |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3303 (list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3304 (gdb-propertize-header "Breakpoints" gdb-breakpoints-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3305 nil nil mode-line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3306 " " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3307 (gdb-propertize-header "Threads" gdb-threads-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3308 "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
|
3309 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3310 ;;; Breakpoints view |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3311 (define-derived-mode gdb-breakpoints-mode gdb-parent-mode "Breakpoints" |
111870
b47e85affa59
Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111850
diff
changeset
|
3312 "Major mode for gdb breakpoints." |
107550
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3313 (setq header-line-format gdb-breakpoints-header) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3314 'gdb-invalidate-breakpoints) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3315 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3316 (defun gdb-toggle-breakpoint () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3317 "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
|
3318 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3319 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3320 (beginning-of-line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3321 (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
|
3322 (if breakpoint |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3323 (gud-basic-call |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3324 (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
|
3325 "-break-disable " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3326 "-break-enable ") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3327 (bindat-get-field breakpoint 'number))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3328 (error "Not recognized as break/watchpoint line"))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3329 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3330 (defun gdb-delete-breakpoint () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3331 "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
|
3332 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3333 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3334 (beginning-of-line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3335 (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
|
3336 (if breakpoint |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3337 (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
|
3338 (error "Not recognized as break/watchpoint line"))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3339 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3340 (defun gdb-goto-breakpoint (&optional event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3341 "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
|
3342 breakpoints buffer." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3343 (interactive (list last-input-event)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3344 (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
|
3345 ;; 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
|
3346 (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
|
3347 (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
|
3348 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3349 (beginning-of-line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3350 (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
|
3351 (if breakpoint |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3352 (let ((bptno (bindat-get-field breakpoint 'number)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3353 (file (bindat-get-field breakpoint 'fullname)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3354 (line (bindat-get-field breakpoint 'line))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3355 (save-selected-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3356 (let* ((buffer (find-file-noselect |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3357 (if (file-exists-p file) file |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3358 (cdr (assoc bptno gdb-location-alist))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3359 (window (or (gdb-display-source-buffer buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3360 (display-buffer buffer)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3361 (setq gdb-source-window window) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3362 (with-current-buffer buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3363 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3364 (forward-line (1- (string-to-number line))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3365 (set-window-point window (point)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3366 (error "Not recognized as break/watchpoint line"))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3367 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3368 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3369 ;; 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
|
3370 ;; |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3371 (def-gdb-trigger-and-handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3372 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
|
3373 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
|
3374 '(start update)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3375 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3376 (gdb-set-buffer-rules |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3377 'gdb-stack-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3378 'gdb-stack-buffer-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3379 'gdb-frames-mode |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3380 'gdb-invalidate-frames) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3381 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3382 (defun gdb-frame-location (frame) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3383 "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
|
3384 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3385 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
|
3386 member." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3387 (let ((file (bindat-get-field frame 'file)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3388 (line (bindat-get-field frame 'line)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3389 (from (bindat-get-field frame 'from))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3390 (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
|
3391 from))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3392 (if res (concat " of " res) "")))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3393 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3394 (defun gdb-stack-list-frames-custom () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3395 (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
|
3396 (table (make-gdb-table))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3397 (set-marker gdb-stack-position nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3398 (dolist (frame stack) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3399 (gdb-table-add-row table |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3400 (list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3401 (bindat-get-field frame 'level) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3402 "in" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3403 (concat |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3404 (bindat-get-field frame 'func) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3405 (if gdb-stack-buffer-locations |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3406 (gdb-frame-location frame) "") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3407 (if gdb-stack-buffer-addresses |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3408 (concat " at " (bindat-get-field frame 'addr)) ""))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3409 `(mouse-face highlight |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3410 help-echo "mouse-2, RET: Select frame" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3411 gdb-frame ,frame))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3412 (insert (gdb-table-string table " "))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3413 (when (and gdb-frame-number |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3414 (gdb-buffer-shows-main-thread-p)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3415 (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
|
3416 gdb-stack-position)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3417 (setq mode-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3418 (gdb-current-context-mode-name "Frames"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3419 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3420 (defun gdb-stack-buffer-name () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3421 (gdb-current-context-buffer-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3422 (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
|
3423 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3424 (def-gdb-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3425 gdb-display-stack-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3426 'gdb-stack-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3427 "Display backtrace of current stack.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3428 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3429 (def-gdb-preempt-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3430 gdb-preemptively-display-stack-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3431 'gdb-stack-buffer nil t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3432 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3433 (def-gdb-frame-for-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3434 gdb-frame-stack-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3435 'gdb-stack-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3436 "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
|
3437 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3438 (defvar gdb-frames-mode-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3439 (let ((map (make-sparse-keymap))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3440 (suppress-keymap map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3441 (define-key map "q" 'kill-this-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3442 (define-key map "\r" 'gdb-select-frame) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3443 (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
|
3444 (define-key map [follow-link] 'mouse-face) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3445 map)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3446 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3447 (defvar gdb-frames-font-lock-keywords |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3448 '(("in \\([^ ]+\\)" (1 font-lock-function-name-face))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3449 "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
|
3450 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3451 (define-derived-mode gdb-frames-mode gdb-parent-mode "Frames" |
111870
b47e85affa59
Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111850
diff
changeset
|
3452 "Major mode for gdb call stack." |
107550
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3453 (setq gdb-stack-position (make-marker)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3454 (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
|
3455 (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
|
3456 (set (make-local-variable 'font-lock-defaults) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3457 '(gdb-frames-font-lock-keywords)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3458 'gdb-invalidate-frames) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3459 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3460 (defun gdb-select-frame (&optional event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3461 "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
|
3462 (interactive (list last-input-event)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3463 (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
|
3464 (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
|
3465 (if frame |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3466 (if (gdb-buffer-shows-main-thread-p) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3467 (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
|
3468 (setq gdb-frame-number new-level) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3469 (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
|
3470 (gdb-update)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3471 (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
|
3472 (error "Not recognized as frame line")))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3473 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3474 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3475 ;; Locals buffer. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3476 ;; 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
|
3477 (def-gdb-trigger-and-handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3478 gdb-invalidate-locals |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3479 (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
|
3480 gdb-locals-handler gdb-locals-handler-custom |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3481 '(start update)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3482 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3483 (gdb-set-buffer-rules |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3484 'gdb-locals-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3485 'gdb-locals-buffer-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3486 'gdb-locals-mode |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3487 'gdb-invalidate-locals) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3488 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3489 (defvar gdb-locals-watch-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3490 (let ((map (make-sparse-keymap))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3491 (suppress-keymap map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3492 (define-key map "\r" 'gud-watch) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3493 (define-key map [mouse-2] 'gud-watch) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3494 map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3495 "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
|
3496 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3497 (defvar gdb-edit-locals-map-1 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3498 (let ((map (make-sparse-keymap))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3499 (suppress-keymap map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3500 (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
|
3501 (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
|
3502 map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3503 "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
|
3504 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3505 (defun gdb-edit-locals-value (&optional event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3506 "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
|
3507 (interactive (list last-input-event)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3508 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3509 (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
|
3510 (beginning-of-line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3511 (let* ((var (bindat-get-field |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3512 (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
|
3513 (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
|
3514 (gud-basic-call |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3515 (concat "-gdb-set variable " var " = " value))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3516 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3517 ;; Dont display values of arrays or structures. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3518 ;; These can be expanded using gud-watch. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3519 (defun gdb-locals-handler-custom () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3520 (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
|
3521 (table (make-gdb-table))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3522 (dolist (local locals-list) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3523 (let ((name (bindat-get-field local 'name)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3524 (value (bindat-get-field local 'value)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3525 (type (bindat-get-field local 'type))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3526 (if (or (not value) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3527 (string-match "\\0x" value)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3528 (add-text-properties 0 (length name) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3529 `(mouse-face highlight |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3530 help-echo "mouse-2: create watch expression" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3531 local-map ,gdb-locals-watch-map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3532 name) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3533 (add-text-properties 0 (length value) |
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: edit value" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3536 local-map ,gdb-edit-locals-map-1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3537 value)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3538 (gdb-table-add-row |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3539 table |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3540 (list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3541 (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
|
3542 (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
|
3543 value) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3544 `(gdb-local-variable ,local)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3545 (insert (gdb-table-string table " ")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3546 (setq mode-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3547 (gdb-current-context-mode-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3548 (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
|
3549 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3550 (defvar gdb-locals-header |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3551 (list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3552 (gdb-propertize-header "Locals" gdb-locals-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3553 nil nil mode-line) |
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 (gdb-propertize-header "Registers" gdb-registers-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3556 "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
|
3557 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3558 (defvar gdb-locals-mode-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3559 (let ((map (make-sparse-keymap))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3560 (suppress-keymap map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3561 (define-key map "q" 'kill-this-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3562 (define-key map "\t" '(lambda () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3563 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3564 (gdb-set-window-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3565 (gdb-get-buffer-create |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3566 'gdb-registers-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3567 gdb-thread-number) t))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3568 map)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3569 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3570 (define-derived-mode gdb-locals-mode gdb-parent-mode "Locals" |
111870
b47e85affa59
Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111850
diff
changeset
|
3571 "Major mode for gdb locals." |
107550
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3572 (setq header-line-format gdb-locals-header) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3573 'gdb-invalidate-locals) |
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 (defun gdb-locals-buffer-name () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3576 (gdb-current-context-buffer-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3577 (concat "locals of " (gdb-get-target-string)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3578 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3579 (def-gdb-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3580 gdb-display-locals-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3581 'gdb-locals-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3582 "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
|
3583 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3584 (def-gdb-preempt-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3585 gdb-preemptively-display-locals-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3586 'gdb-locals-buffer nil t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3587 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3588 (def-gdb-frame-for-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3589 gdb-frame-locals-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3590 'gdb-locals-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3591 "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
|
3592 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3593 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3594 ;; Registers buffer. |
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-trigger-and-handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3597 gdb-invalidate-registers |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3598 (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
|
3599 gdb-registers-handler |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3600 gdb-registers-handler-custom |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3601 '(start update)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3602 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3603 (gdb-set-buffer-rules |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3604 'gdb-registers-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3605 'gdb-registers-buffer-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3606 'gdb-registers-mode |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3607 'gdb-invalidate-registers) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3608 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3609 (defun gdb-registers-handler-custom () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3610 (when gdb-register-names |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3611 (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
|
3612 (table (make-gdb-table))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3613 (dolist (register register-values) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3614 (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
|
3615 (value (bindat-get-field register 'value)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3616 (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
|
3617 gdb-register-names))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3618 (gdb-table-add-row |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3619 table |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3620 (list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3621 (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
|
3622 (if (member register-number gdb-changed-registers) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3623 (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
|
3624 value)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3625 `(mouse-face highlight |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3626 help-echo "mouse-2: edit value" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3627 gdb-register-name ,register-name)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3628 (insert (gdb-table-string table " "))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3629 (setq mode-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3630 (gdb-current-context-mode-name "Registers")))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3631 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3632 (defun gdb-edit-register-value (&optional event) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3633 "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
|
3634 (interactive (list last-input-event)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3635 (save-excursion |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3636 (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
|
3637 (beginning-of-line) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3638 (let* ((var (bindat-get-field |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3639 (get-text-property (point) 'gdb-register-name))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3640 (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
|
3641 (gud-basic-call |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3642 (concat "-gdb-set variable $" var " = " value))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3643 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3644 (defvar gdb-registers-mode-map |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3645 (let ((map (make-sparse-keymap))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3646 (suppress-keymap map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3647 (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
|
3648 (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
|
3649 (define-key map "q" 'kill-this-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3650 (define-key map "\t" '(lambda () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3651 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3652 (gdb-set-window-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3653 (gdb-get-buffer-create |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3654 'gdb-locals-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3655 gdb-thread-number) t))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3656 map)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3657 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3658 (defvar gdb-registers-header |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3659 (list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3660 (gdb-propertize-header "Locals" gdb-locals-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3661 "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
|
3662 " " |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3663 (gdb-propertize-header "Registers" gdb-registers-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3664 nil nil mode-line))) |
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 (define-derived-mode gdb-registers-mode gdb-parent-mode "Registers" |
111870
b47e85affa59
Derive from prog-mode, use derived-mode-p, and fix up various
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
111850
diff
changeset
|
3667 "Major mode for gdb registers." |
107550
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3668 (setq header-line-format gdb-registers-header) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3669 'gdb-invalidate-registers) |
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 (defun gdb-registers-buffer-name () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3672 (gdb-current-context-buffer-name |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3673 (concat "registers of " (gdb-get-target-string)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3674 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3675 (def-gdb-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3676 gdb-display-registers-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3677 'gdb-registers-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3678 "Display integer register contents.") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3679 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3680 (def-gdb-preempt-display-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3681 gdb-preemptively-display-registers-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3682 'gdb-registers-buffer nil t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3683 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3684 (def-gdb-frame-for-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3685 gdb-frame-registers-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3686 'gdb-registers-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3687 "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
|
3688 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3689 ;; 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
|
3690 (defun gdb-get-changed-registers () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3691 (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
|
3692 (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
|
3693 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3694 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3695 (list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3696 "-data-list-changed-registers" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3697 'gdb-changed-registers-handler)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3698 (gdb-add-pending 'gdb-get-changed-registers)))) |
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 (defun gdb-changed-registers-handler () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3701 (gdb-delete-pending 'gdb-get-changed-registers) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3702 (setq gdb-changed-registers nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3703 (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
|
3704 (push register-number gdb-changed-registers))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3705 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3706 (defun gdb-register-names-handler () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3707 ;; 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
|
3708 ;; only once (in gdb-init-1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3709 (setq gdb-register-names nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3710 (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
|
3711 (push register-name gdb-register-names)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3712 (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
|
3713 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3714 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3715 (defun gdb-get-source-file-list () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3716 "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
|
3717 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
|
3718 is set in them." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3719 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3720 (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
|
3721 (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
|
3722 (dolist (buffer (buffer-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3723 (with-current-buffer buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3724 (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
|
3725 (gdb-init-buffer)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3726 (gdb-force-mode-line-update |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3727 (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
|
3728 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3729 (defun gdb-get-main-selected-frame () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3730 "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
|
3731 thread. Called from `gdb-update'." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3732 (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
|
3733 (progn |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3734 (gdb-input |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3735 (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
|
3736 (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
|
3737 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3738 (defun gdb-frame-handler () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3739 "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
|
3740 overlay arrow in source buffer." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3741 (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
|
3742 (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
|
3743 (when frame |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3744 (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
|
3745 (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
|
3746 (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
|
3747 (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
|
3748 (let ((line (bindat-get-field frame 'line))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3749 (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
|
3750 (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
|
3751 (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
|
3752 (gud-display-frame))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3753 (if gud-overlay-arrow-position |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3754 (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
|
3755 (position (marker-position gud-overlay-arrow-position))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3756 (when buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3757 (with-current-buffer buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3758 (setq fringe-indicator-alist |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3759 (if (string-equal gdb-frame-number "0") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3760 nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3761 '((overlay-arrow . hollow-right-triangle)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3762 (setq gud-overlay-arrow-position (make-marker)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3763 (set-marker gud-overlay-arrow-position position)))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3764 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3765 (defvar gdb-prompt-name-regexp "value=\"\\(.*?\\)\"") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3766 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3767 (defun gdb-get-prompt () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3768 "Find prompt for GDB session." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3769 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3770 (setq gdb-prompt-name nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3771 (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
|
3772 (setq gdb-prompt-name (match-string 1)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3773 ;; Insert first prompt. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3774 (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
|
3775 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3776 ;;;; Window management |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3777 (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
|
3778 "Show buffer BUF. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3779 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3780 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
|
3781 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
|
3782 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
|
3783 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
|
3784 (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
|
3785 (if answer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3786 (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
|
3787 (let ((window (get-lru-window))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3788 (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
|
3789 'gdbmi) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3790 (let* ((largest (get-largest-window)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3791 (cur-size (window-height largest))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3792 (setq answer (split-window largest)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3793 (set-window-buffer answer buf) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3794 (set-window-dedicated-p answer dedicated) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3795 answer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3796 (set-window-buffer window buf) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3797 window))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3798 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3799 (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
|
3800 "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
|
3801 `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
|
3802 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
|
3803 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
|
3804 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
|
3805 (if buf |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3806 (when (not (get-buffer-window buf)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3807 (let* ((buf-type (gdb-buffer-type buf)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3808 (existing-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3809 (get-window-with-predicate |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3810 #'(lambda (w) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3811 (and (eq buf-type |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3812 (gdb-buffer-type (window-buffer w))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3813 (not (window-dedicated-p w))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3814 (if existing-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3815 (set-window-buffer existing-window buf) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3816 (let ((dedicated-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3817 (get-window-with-predicate |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3818 #'(lambda (w) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3819 (eq buf-type |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3820 (gdb-buffer-type (window-buffer w))))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3821 (if dedicated-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3822 (set-window-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3823 (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
|
3824 (gdb-display-buffer buf t)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3825 (error "Null buffer"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3826 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3827 ;;; Shared keymap initialization: |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3828 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3829 (let ((menu (make-sparse-keymap "GDB-Windows"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3830 (define-key gud-menu-map [displays] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3831 `(menu-item "GDB-Windows" ,menu |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3832 :visible (eq gud-minor-mode 'gdbmi))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3833 (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
|
3834 (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
|
3835 (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
|
3836 (define-key menu [disassembly] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3837 '("Disassembly" . gdb-display-disassembly-buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3838 (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
|
3839 (define-key menu [inferior] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3840 '("IO" . gdb-display-io-buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3841 (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
|
3842 (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
|
3843 (define-key menu [breakpoints] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3844 '("Breakpoints" . gdb-display-breakpoints-buffer))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3845 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3846 (let ((menu (make-sparse-keymap "GDB-Frames"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3847 (define-key gud-menu-map [frames] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3848 `(menu-item "GDB-Frames" ,menu |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3849 :visible (eq gud-minor-mode 'gdbmi))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3850 (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
|
3851 (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
|
3852 (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
|
3853 (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
|
3854 (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
|
3855 (define-key menu [inferior] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3856 '("IO" . gdb-frame-io-buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3857 (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
|
3858 (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
|
3859 (define-key menu [breakpoints] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3860 '("Breakpoints" . gdb-frame-breakpoints-buffer))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3861 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3862 (let ((menu (make-sparse-keymap "GDB-MI"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3863 (define-key menu [gdb-customize] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3864 '(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
|
3865 :help "Customize Gdb Graphical Mode options.")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3866 (define-key menu [gdb-many-windows] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3867 '(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
|
3868 :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
|
3869 :button (:toggle . gdb-many-windows))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3870 (define-key menu [gdb-restore-windows] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3871 '(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
|
3872 :help "Restore standard layout for debug session.")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3873 (define-key menu [sep1] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3874 '(menu-item "--")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3875 (define-key menu [all-threads] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3876 '(menu-item "GUD controls all threads" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3877 (lambda () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3878 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3879 (setq gdb-gud-control-all-threads t)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3880 :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
|
3881 :button (:radio . gdb-gud-control-all-threads))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3882 (define-key menu [current-thread] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3883 '(menu-item "GUD controls current thread" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3884 (lambda () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3885 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3886 (setq gdb-gud-control-all-threads nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3887 :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
|
3888 :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
|
3889 (define-key menu [sep2] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3890 '(menu-item "--")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3891 (define-key menu [gdb-customize-reasons] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3892 '(menu-item "Customize switching..." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3893 (lambda () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3894 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3895 (customize-option 'gdb-switch-reasons)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3896 (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
|
3897 (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
|
3898 "Automatically switch to stopped thread" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3899 "GDB thread switching %s" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3900 "Switch to stopped thread")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3901 (define-key gud-menu-map [mi] |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3902 `(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
|
3903 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3904 ;; 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
|
3905 ;; 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
|
3906 ;; 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
|
3907 ;; 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
|
3908 ;; show up right before Run button. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3909 (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
|
3910 '(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
|
3911 :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
|
3912 :visible (and (eq gud-minor-mode 'gdbmi) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3913 gdb-non-stop |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3914 (not gdb-gud-control-all-threads))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3915 'run) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3916 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3917 (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
|
3918 '(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
|
3919 :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
|
3920 :visible (and (eq gud-minor-mode 'gdbmi) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3921 gdb-non-stop |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3922 gdb-gud-control-all-threads)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3923 'all-threads) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3924 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3925 (defun gdb-frame-gdb-buffer () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3926 "Display GUD buffer in a new frame." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3927 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3928 (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
|
3929 (special-display-frame-alist |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3930 (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
|
3931 gdb-frame-parameters))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3932 (same-window-regexps nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3933 (display-buffer gud-comint-buffer))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3934 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3935 (defun gdb-display-gdb-buffer () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3936 "Display GUD buffer." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3937 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3938 (let ((same-window-regexps nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3939 (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
|
3940 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3941 (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
|
3942 "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
|
3943 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3944 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
|
3945 window is dedicated." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3946 (when ignore-dedicated |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3947 (set-window-dedicated-p (selected-window) nil)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3948 (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
|
3949 (set-window-dedicated-p (selected-window) t)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3950 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3951 (defun gdb-setup-windows () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3952 "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
|
3953 (gdb-display-locals-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3954 (gdb-display-stack-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3955 (delete-other-windows) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3956 (gdb-display-breakpoints-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3957 (delete-other-windows) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3958 ; Don't dedicate. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3959 (pop-to-buffer gud-comint-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3960 (split-window nil ( / ( * (window-height) 3) 4)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3961 (split-window nil ( / (window-height) 3)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3962 (split-window-horizontally) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3963 (other-window 1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3964 (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
|
3965 (other-window 1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3966 (switch-to-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3967 (if gud-last-last-frame |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3968 (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
|
3969 (if gdb-main-file |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3970 (gud-find-file gdb-main-file) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3971 ;; Put buffer list in window if we |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3972 ;; can't find a source file. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3973 (list-buffers-noselect)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3974 (setq gdb-source-window (selected-window)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3975 (split-window-horizontally) |
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 (gdb-set-window-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3978 (gdb-get-buffer-create 'gdb-inferior-io)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3979 (other-window 1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3980 (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
|
3981 (split-window-horizontally) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3982 (other-window 1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3983 (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
|
3984 (gdb-threads-buffer-name) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3985 (gdb-breakpoints-buffer-name))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3986 (other-window 1)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3987 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3988 (defcustom gdb-many-windows nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3989 "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
|
3990 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
|
3991 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
|
3992 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
|
3993 `gdb'." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3994 :type 'boolean |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3995 :group 'gdb |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3996 :version "22.1") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3997 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3998 (defun gdb-many-windows (arg) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
3999 "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
|
4000 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
|
4001 (interactive "P") |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4002 (setq gdb-many-windows |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4003 (if (null arg) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4004 (not gdb-many-windows) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4005 (> (prefix-numeric-value arg) 0))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4006 (message (format "Display of other windows %sabled" |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4007 (if gdb-many-windows "en" "dis"))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4008 (if (and gud-comint-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4009 (buffer-name gud-comint-buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4010 (condition-case nil |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4011 (gdb-restore-windows) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4012 (error nil)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4013 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4014 (defun gdb-restore-windows () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4015 "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
|
4016 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
|
4017 (interactive) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4018 (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
|
4019 (delete-other-windows) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4020 (if gdb-many-windows |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4021 (gdb-setup-windows) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4022 (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
|
4023 (split-window) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4024 (other-window 1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4025 (switch-to-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4026 (if gud-last-last-frame |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4027 (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
|
4028 (gud-find-file gdb-main-file))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4029 (setq gdb-source-window (selected-window)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4030 (other-window 1)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4031 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4032 (defun gdb-reset () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4033 "Exit a debugging session cleanly. |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4034 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
|
4035 (dolist (buffer (buffer-list)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4036 (unless (eq buffer gud-comint-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4037 (with-current-buffer buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4038 (if (eq gud-minor-mode 'gdbmi) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4039 (if (string-match "\\` ?\\*.+\\*\\'" (buffer-name)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4040 (kill-buffer nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4041 (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
|
4042 (setq gud-minor-mode nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4043 (kill-local-variable 'tool-bar-map) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4044 (kill-local-variable 'gdb-define-alist)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4045 (setq gdb-disassembly-position nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4046 (setq overlay-arrow-variable-list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4047 (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
|
4048 (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
|
4049 (setq gdb-stack-position nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4050 (setq overlay-arrow-variable-list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4051 (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
|
4052 (setq gdb-thread-position nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4053 (setq overlay-arrow-variable-list |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4054 (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
|
4055 (if (boundp 'speedbar-frame) (speedbar-timer-fn)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4056 (setq gud-running nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4057 (setq gdb-active-process nil) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4058 (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
|
4059 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4060 (defun gdb-get-source-file () |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4061 "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
|
4062 buffers, if required." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4063 (goto-char (point-min)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4064 (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
|
4065 (setq gdb-main-file (match-string 1))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4066 (if gdb-many-windows |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4067 (gdb-setup-windows) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4068 (gdb-get-buffer-create 'gdb-breakpoints-buffer) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4069 (if gdb-show-main |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4070 (let ((pop-up-windows t)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4071 (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
|
4072 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4073 ;;from put-image |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4074 (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
|
4075 "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
|
4076 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
|
4077 `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
|
4078 PUTSTRING." |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4079 (let ((string (make-string 1 ?x)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4080 (buffer (current-buffer))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4081 (setq putstring (copy-sequence putstring)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4082 (let ((overlay (make-overlay pos pos buffer)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4083 (prop (or dprop |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4084 (list (list 'margin 'left-margin) putstring)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4085 (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
|
4086 (if sprops |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4087 (add-text-properties 0 1 sprops string)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4088 (overlay-put overlay 'put-break t) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4089 (overlay-put overlay 'before-string string)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4090 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4091 ;;from remove-images |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4092 (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
|
4093 "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
|
4094 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
|
4095 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
|
4096 (unless buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4097 (setq buffer (current-buffer))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4098 (dolist (overlay (overlays-in start end)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4099 (when (overlay-get overlay 'put-break) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4100 (delete-overlay overlay)))) |
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 (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
|
4103 (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
|
4104 (start (- (car posns) 1)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4105 (end (+ (cdr posns) 1)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4106 (putstring (if enabled "B" "b")) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4107 (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
|
4108 (add-text-properties |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4109 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
|
4110 putstring) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4111 (if enabled |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4112 (add-text-properties |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4113 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
|
4114 (add-text-properties |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4115 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
|
4116 (gdb-remove-breakpoint-icons start end) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4117 (if (display-images-p) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4118 (if (>= (or left-fringe-width |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4119 (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
|
4120 gdb-buffer-fringe-width) 8) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4121 (gdb-put-string |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4122 nil (1+ start) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4123 `(left-fringe breakpoint |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4124 ,(if enabled |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4125 'breakpoint-enabled |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4126 'breakpoint-disabled)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4127 'gdb-bptno bptno |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4128 'gdb-enabled enabled) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4129 (when (< left-margin-width 2) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4130 (save-current-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4131 (setq left-margin-width 2) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4132 (if source-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4133 (set-window-margins |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4134 source-window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4135 left-margin-width right-margin-width)))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4136 (put-image |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4137 (if enabled |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4138 (or breakpoint-enabled-icon |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4139 (setq breakpoint-enabled-icon |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4140 (find-image `((:type xpm :data |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4141 ,breakpoint-xpm-data |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4142 :ascent 100 :pointer hand) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4143 (:type pbm :data |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4144 ,breakpoint-enabled-pbm-data |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4145 :ascent 100 :pointer hand))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4146 (or breakpoint-disabled-icon |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4147 (setq breakpoint-disabled-icon |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4148 (find-image `((:type xpm :data |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4149 ,breakpoint-xpm-data |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4150 :conversion disabled |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4151 :ascent 100 :pointer hand) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4152 (:type pbm :data |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4153 ,breakpoint-disabled-pbm-data |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4154 :ascent 100 :pointer hand)))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4155 (+ start 1) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4156 putstring |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4157 'left-margin)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4158 (when (< left-margin-width 2) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4159 (save-current-buffer |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4160 (setq left-margin-width 2) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4161 (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
|
4162 (if window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4163 (set-window-margins |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4164 window left-margin-width right-margin-width))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4165 (gdb-put-string |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4166 (propertize putstring |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4167 'face (if enabled 'breakpoint-enabled 'breakpoint-disabled)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4168 (1+ start))))) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4169 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4170 (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
|
4171 (gdb-remove-strings start end) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4172 (if (display-images-p) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4173 (remove-images start end)) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4174 (when remove-margin |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4175 (setq left-margin-width 0) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4176 (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
|
4177 (if window |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4178 (set-window-margins |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4179 window left-margin-width right-margin-width))))) |
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 (provide 'gdb-mi) |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4182 |
2931d193b6c2
Restore GDB/MI fuctionality removed by r99212:
Nick Roberts <nickrob@snap.net.nz>
parents:
diff
changeset
|
4183 ;;; gdb-mi.el ends here |