annotate lisp/gud.el @ 3745:3c4f7e74e3f0

(gud-xdb-directories): Renamed from gud-xdb-paths. Defvar moved earlier. All uses changed. (gud-xdb-debugger-startup): Rename local var `paths'. (gud-xdb-file-name): Likewise.
author Richard M. Stallman <rms@gnu.org>
date Tue, 15 Jun 1993 21:04:48 +0000
parents c5ebd279e007
children ac686479ca51
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3738
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
1 ;;; gud.el --- Grand Unified Debugger mode for gdb, sdb, dbx, or xdb
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
2 ;;; under Emacs
810
80303373daae *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 806
diff changeset
3
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
4 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
2581
839d67a1dc58 Set no-byte-compile local variable t to work around a byte-compiler bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2532
diff changeset
5 ;; Version: 1.3
810
80303373daae *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 806
diff changeset
6 ;; Keywords: unix, tools
80303373daae *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 806
diff changeset
7
2960
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
8 ;; Copyright (C) 1992, 1993 Free Software Foundation, Inc.
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
9
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
11
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
868
0cda1f7b154e *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
15 ;; any later version.
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
16
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
20 ;; GNU General Public License for more details.
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
21
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
23 ;; along with GNU Emacs; see the file COPYING. If not, write to
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
24 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
25
810
80303373daae *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 806
diff changeset
26 ;;; Commentary:
80303373daae *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 806
diff changeset
27
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
28 ;; The ancestral gdb.el was by W. Schelter <wfs@rascal.ics.utexas.edu>
868
0cda1f7b154e *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
29 ;; It was later rewritten by rms. Some ideas were due to Masanobu.
810
80303373daae *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 806
diff changeset
30 ;; Grand Unification (sdb/dbx support) by Eric S. Raymond <esr@thyrsus.com>
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
31 ;; The overloading code was then rewritten by Barry Warsaw <bwarsaw@cen.com>,
3738
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
32 ;; who also hacked the mode to use comint.el. Shane Hartman <shane@spr.com>
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
33 ;; added support for xdb (HPUX debugger).
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
34
810
80303373daae *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 806
diff changeset
35 ;;; Code:
80303373daae *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 806
diff changeset
36
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
37 (require 'comint)
923
9f3cc03dae67 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 914
diff changeset
38 (require 'etags)
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
39
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
40 ;; ======================================================================
2581
839d67a1dc58 Set no-byte-compile local variable t to work around a byte-compiler bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2532
diff changeset
41 ;; GUD commands must be visible in C buffers visited by GUD
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
42
2532
17a6b6d079cf (gud-mode): Created C-c synonym bindings in the GUD buffer's local map.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2519
diff changeset
43 (defvar gud-key-prefix "\C-x\C-a"
2581
839d67a1dc58 Set no-byte-compile local variable t to work around a byte-compiler bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2532
diff changeset
44 "Prefix of all GUD commands valid in C buffers.")
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
45
2581
839d67a1dc58 Set no-byte-compile local variable t to work around a byte-compiler bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2532
diff changeset
46 (global-set-key (concat gud-key-prefix "\C-l") 'gud-refresh)
839d67a1dc58 Set no-byte-compile local variable t to work around a byte-compiler bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2532
diff changeset
47 (global-set-key "\C-x " 'gud-break) ;; backward compatibility hack
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
48
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
49 ;; ======================================================================
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
50 ;; the overloading mechanism
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
51
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
52 (defun gud-overload-functions (gud-overload-alist)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
53 "Overload functions defined in GUD-OVERLOAD-ALIST.
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
54 This association list has elements of the form
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
55 (ORIGINAL-FUNCTION-NAME OVERLOAD-FUNCTION)"
868
0cda1f7b154e *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
56 (mapcar
0cda1f7b154e *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
57 (function (lambda (p) (fset (car p) (symbol-function (cdr p)))))
0cda1f7b154e *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
58 gud-overload-alist))
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
59
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
60 (defun gud-debugger-startup (file args)
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
61 (error "GUD not properly entered."))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
62
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
63 (defun gud-marker-filter (str)
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
64 (error "GUD not properly entered."))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
65
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
66 (defun gud-find-file (f)
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
67 (error "GUD not properly entered."))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
68
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
69 ;; ======================================================================
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
70 ;; command definition
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
71
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
72 ;; This macro is used below to define some basic debugger interface commands.
810
80303373daae *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 806
diff changeset
73 ;; Of course you may use `gud-def' with any other debugger command, including
1255
ff06503c93b4 * gud.el (gud-def): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 923
diff changeset
74 ;; user defined ones.
ff06503c93b4 * gud.el (gud-def): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 923
diff changeset
75
ff06503c93b4 * gud.el (gud-def): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 923
diff changeset
76 ;; A macro call like (gud-def FUNC NAME KEY DOC) expands to a form
ff06503c93b4 * gud.el (gud-def): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 923
diff changeset
77 ;; which defines FUNC to send the command NAME to the debugger, gives
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
78 ;; it the docstring DOC, and binds that function to KEY in the GUD
2581
839d67a1dc58 Set no-byte-compile local variable t to work around a byte-compiler bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2532
diff changeset
79 ;; major mode. The function is also bound in the global keymap with the
839d67a1dc58 Set no-byte-compile local variable t to work around a byte-compiler bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2532
diff changeset
80 ;; GUD prefix.
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
81
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
82 (defmacro gud-def (func cmd key &optional doc)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
83 "Define FUNC to be a command sending STR and bound to KEY, with
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
84 optional doc string DOC. Certain %-escapes in the string arguments
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
85 are interpreted specially if present. These are:
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
86
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
87 %f name of current source file.
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
88 %l number of current source line
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
89 %e text of the C lvalue or function-call expression surrounding point.
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
90 %a text of the hexadecimal address surrounding point
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
91 %p prefix argument to the command (if any) as a number
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
92
2581
839d67a1dc58 Set no-byte-compile local variable t to work around a byte-compiler bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2532
diff changeset
93 The `current' source file is the file of the current buffer (if
839d67a1dc58 Set no-byte-compile local variable t to work around a byte-compiler bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2532
diff changeset
94 we're in a C file) or the source file current at the last break or
839d67a1dc58 Set no-byte-compile local variable t to work around a byte-compiler bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2532
diff changeset
95 step (if we're in the GUD buffer).
839d67a1dc58 Set no-byte-compile local variable t to work around a byte-compiler bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2532
diff changeset
96 The `current' line is that of the current buffer (if we're in a
839d67a1dc58 Set no-byte-compile local variable t to work around a byte-compiler bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2532
diff changeset
97 source file) or the source line number at the last break or step (if
839d67a1dc58 Set no-byte-compile local variable t to work around a byte-compiler bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2532
diff changeset
98 we're in the GUD buffer)."
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
99 (list 'progn
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
100 (list 'defun func '(arg)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
101 (or doc "")
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
102 '(interactive "p")
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
103 (list 'gud-call cmd 'arg))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
104 (if key
2960
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
105 (list 'define-key
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
106 '(current-local-map)
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
107 (concat "\C-c" key)
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
108 (list 'quote func)))
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
109 (if key
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
110 (list 'global-set-key
3343
d5fde107dbe3 (gud-def): Don't use gud-key-prefix at compile time.
Richard M. Stallman <rms@gnu.org>
parents: 2960
diff changeset
111 (list 'concat 'gud-key-prefix key)
2960
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
112 (list 'quote func)))))
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
113
1275
68f025a5fdaa * gud.el (gud-last-frame): Added defvar for this.
Jim Blandy <jimb@redhat.com>
parents: 1274
diff changeset
114 ;; Where gud-display-frame should put the debugging arrow. This is
68f025a5fdaa * gud.el (gud-last-frame): Added defvar for this.
Jim Blandy <jimb@redhat.com>
parents: 1274
diff changeset
115 ;; set by the marker-filter, which scans the debugger's output for
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
116 ;; indications of the current program counter.
1275
68f025a5fdaa * gud.el (gud-last-frame): Added defvar for this.
Jim Blandy <jimb@redhat.com>
parents: 1274
diff changeset
117 (defvar gud-last-frame nil)
68f025a5fdaa * gud.el (gud-last-frame): Added defvar for this.
Jim Blandy <jimb@redhat.com>
parents: 1274
diff changeset
118
3646
4b34cbec2058 * gud.el (gud-last-last-frame): New variable.
Jim Blandy <jimb@redhat.com>
parents: 3591
diff changeset
119 ;; Used by gud-refresh, which should cause gud-display-frame to redisplay
4b34cbec2058 * gud.el (gud-last-last-frame): New variable.
Jim Blandy <jimb@redhat.com>
parents: 3591
diff changeset
120 ;; the last frame, even if it's been called before and gud-last-frame has
4b34cbec2058 * gud.el (gud-last-last-frame): New variable.
Jim Blandy <jimb@redhat.com>
parents: 3591
diff changeset
121 ;; been set to nil.
4b34cbec2058 * gud.el (gud-last-last-frame): New variable.
Jim Blandy <jimb@redhat.com>
parents: 3591
diff changeset
122 (defvar gud-last-last-frame)
4b34cbec2058 * gud.el (gud-last-last-frame): New variable.
Jim Blandy <jimb@redhat.com>
parents: 3591
diff changeset
123
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
124 ;; All debugger-specific information is collected here.
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
125 ;; Here's how it works, in case you ever need to add a debugger to the mode.
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
126 ;;
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
127 ;; Each entry must define the following at startup:
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
128 ;;
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
129 ;;<name>
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
130 ;; comint-prompt-regexp
868
0cda1f7b154e *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
131 ;; gud-<name>-debugger-startup
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
132 ;; gud-<name>-marker-filter
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
133 ;; gud-<name>-find-file
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
134 ;;
477
ab9a55b26bd4 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 460
diff changeset
135 ;; The job of the startup-command method is to fire up a copy of the debugger,
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
136 ;; given a list of debugger arguments.
477
ab9a55b26bd4 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 460
diff changeset
137 ;;
ab9a55b26bd4 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 460
diff changeset
138 ;; The job of the marker-filter method is to detect file/line markers in
ab9a55b26bd4 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 460
diff changeset
139 ;; strings and set the global gud-last-frame to indicate what display
ab9a55b26bd4 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 460
diff changeset
140 ;; action (if any) should be triggered by the marker. Note that only
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 3551
diff changeset
141 ;; whatever the method *returns* is displayed in the buffer; thus, you
477
ab9a55b26bd4 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 460
diff changeset
142 ;; can filter the debugger's output, interpreting some and passing on
ab9a55b26bd4 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 460
diff changeset
143 ;; the rest.
ab9a55b26bd4 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 460
diff changeset
144 ;;
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
145 ;; The job of the find-file method is to visit and return the buffer indicated
477
ab9a55b26bd4 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 460
diff changeset
146 ;; by the car of gud-tag-frame. This may be a file name, a tag name, or
ab9a55b26bd4 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 460
diff changeset
147 ;; something else.
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
148
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
149 ;; ======================================================================
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
150 ;; gdb functions
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
151
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
152 (defun gud-gdb-debugger-startup (file args)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
153 (apply 'make-comint (concat "gud-" file) "gdb" nil "-fullname" args))
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
154
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
155 (defun gud-gdb-marker-filter (string)
1255
ff06503c93b4 * gud.el (gud-def): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 923
diff changeset
156 (if (string-match "\032\032\\([^:\n]*\\):\\([0-9]*\\):.*\n" string)
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
157 (progn
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
158 (setq gud-last-frame
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
159 (cons
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
160 (substring string (match-beginning 1) (match-end 1))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
161 (string-to-int
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
162 (substring string (match-beginning 2) (match-end 2)))))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
163 ;; this computation means the ^Z^Z-initiated marker in the
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
164 ;; input string is never emitted.
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
165 (concat
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
166 (substring string 0 (match-beginning 0))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
167 (substring string (match-end 0))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
168 ))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
169 string))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
170
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
171 (defun gud-gdb-find-file (f)
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
172 (find-file-noselect f))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
173
477
ab9a55b26bd4 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 460
diff changeset
174 ;;;###autoload
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
175 (defun gdb (args)
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
176 "Run gdb on program FILE in buffer *gud-FILE*.
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
177 The directory containing FILE becomes the initial working directory
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
178 and source-file directory for your debugger."
2519
d567a93d9408 (gdb, sdb, dbx): Improved prompting a la grep.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2489
diff changeset
179 (interactive "sRun gdb (like this): gdb ")
868
0cda1f7b154e *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
180 (gud-overload-functions '((gud-debugger-startup . gud-gdb-debugger-startup)
0cda1f7b154e *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
181 (gud-marker-filter . gud-gdb-marker-filter)
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
182 (gud-find-file . gud-gdb-find-file)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
183 ))
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
184
2581
839d67a1dc58 Set no-byte-compile local variable t to work around a byte-compiler bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2532
diff changeset
185 (gud-common-init args)
839d67a1dc58 Set no-byte-compile local variable t to work around a byte-compiler bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2532
diff changeset
186
2960
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
187 (gud-def gud-break "break %f:%l" "\C-b" "Set breakpoint at current line.")
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
188 (gud-def gud-tbreak "tbreak %f:%l" "\C-t" "Set breakpoint at current line.")
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
189 (gud-def gud-remove "clear %l" "\C-d" "Remove breakpoint at current line")
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
190 (gud-def gud-step "step %p" "\C-s" "Step one source line with display.")
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
191 (gud-def gud-stepi "stepi %p" "\C-i" "Step one instruction with display.")
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
192 (gud-def gud-next "next %p" "\C-n" "Step one line (skip functions).")
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
193 (gud-def gud-cont "cont" "\C-r" "Continue with display.")
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
194 (gud-def gud-finish "finish" "\C-f" "Finish executing current function.")
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
195 (gud-def gud-up "up %p" "<" "Up N stack frames (numeric arg).")
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
196 (gud-def gud-down "down %p" ">" "Down N stack frames (numeric arg).")
2960
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
197 (gud-def gud-print "print %e" "\C-p" "Evaluate C expression at point.")
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
198
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
199 (setq comint-prompt-regexp "^(.*gdb[+]?) *")
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
200 (run-hooks 'gdb-mode-hook)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
201 )
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
202
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
203
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
204 ;; ======================================================================
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
205 ;; sdb functions
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
206
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
207 (defvar gud-sdb-needs-tags (not (file-exists-p "/var"))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
208 "If nil, we're on a System V Release 4 and don't need the tags hack.")
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
209
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
210 (defvar gud-sdb-lastfile nil)
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
211
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
212 (defun gud-sdb-debugger-startup (file args)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
213 (apply 'make-comint (concat "gud-" file) "sdb" nil args))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
214
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
215 (defun gud-sdb-marker-filter (string)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
216 (cond
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
217 ;; System V Release 3.2 uses this format
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
218 ((string-match "\\(^0x\\w* in \\|^\\|\n\\)\\([^:\n]*\\):\\([0-9]*\\):.*\n"
1255
ff06503c93b4 * gud.el (gud-def): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 923
diff changeset
219 string)
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
220 (setq gud-last-frame
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
221 (cons
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
222 (substring string (match-beginning 2) (match-end 2))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
223 (string-to-int
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
224 (substring string (match-beginning 3) (match-end 3))))))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
225 ;; System V Release 4.0
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
226 ((string-match "^\\(BREAKPOINT\\|STEPPED\\) process [0-9]+ function [^ ]+ in \\(.+\\)\n"
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
227 string)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
228 (setq gud-sdb-lastfile
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
229 (substring string (match-beginning 2) (match-end 2))))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
230 ((and gud-sdb-lastfile (string-match "^\\([0-9]+\\):" string))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
231 (setq gud-last-frame
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
232 (cons
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
233 gud-sdb-lastfile
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
234 (string-to-int
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
235 (substring string (match-beginning 1) (match-end 1))))))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
236 (t
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
237 (setq gud-sdb-lastfile nil)))
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
238 string)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
239
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
240 (defun gud-sdb-find-file (f)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
241 (if gud-sdb-needs-tags
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
242 (find-tag-noselect f)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
243 (find-file-noselect f)))
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
244
477
ab9a55b26bd4 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 460
diff changeset
245 ;;;###autoload
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
246 (defun sdb (args)
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
247 "Run sdb on program FILE in buffer *gud-FILE*.
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
248 The directory containing FILE becomes the initial working directory
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
249 and source-file directory for your debugger."
2519
d567a93d9408 (gdb, sdb, dbx): Improved prompting a la grep.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2489
diff changeset
250 (interactive "sRun sdb (like this): sdb ")
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
251 (if (and gud-sdb-needs-tags
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
252 (not (and (boundp 'tags-file-name) (file-exists-p tags-file-name))))
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
253 (error "The sdb support requires a valid tags table to work."))
868
0cda1f7b154e *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
254 (gud-overload-functions '((gud-debugger-startup . gud-sdb-debugger-startup)
0cda1f7b154e *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
255 (gud-marker-filter . gud-sdb-marker-filter)
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
256 (gud-find-file . gud-sdb-find-file)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
257 ))
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
258
2581
839d67a1dc58 Set no-byte-compile local variable t to work around a byte-compiler bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2532
diff changeset
259 (gud-common-init args)
839d67a1dc58 Set no-byte-compile local variable t to work around a byte-compiler bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2532
diff changeset
260
2960
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
261 (gud-def gud-break "%l b" "\C-b" "Set breakpoint at current line.")
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
262 (gud-def gud-tbreak "%l c" "\C-t" "Set temporary breakpoint at current line.")
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
263 (gud-def gud-remove "%l d" "\C-d" "Remove breakpoint at current line")
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
264 (gud-def gud-step "s %p" "\C-s" "Step one source line with display.")
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
265 (gud-def gud-stepi "i %p" "\C-i" "Step one instruction with display.")
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
266 (gud-def gud-next "S %p" "\C-n" "Step one line (skip functions).")
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
267 (gud-def gud-cont "c" "\C-r" "Continue with display.")
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
268 (gud-def gud-print "%e/" "\C-p" "Evaluate C expression at point.")
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
269
1255
ff06503c93b4 * gud.el (gud-def): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 923
diff changeset
270 (setq comint-prompt-regexp "\\(^\\|\n\\)\\*")
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
271 (run-hooks 'sdb-mode-hook)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
272 )
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
273
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
274 ;; ======================================================================
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
275 ;; dbx functions
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
276
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
277 (defun gud-dbx-debugger-startup (file args)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
278 (apply 'make-comint (concat "gud-" file) "dbx" nil args))
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
279
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
280 (defun gud-dbx-marker-filter (string)
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
281 (if (string-match
1255
ff06503c93b4 * gud.el (gud-def): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 923
diff changeset
282 "stopped in .* at line \\([0-9]*\\) in file \"\\([^\"]*\\)\"" string)
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
283 (setq gud-last-frame
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
284 (cons
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
285 (substring string (match-beginning 2) (match-end 2))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
286 (string-to-int
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
287 (substring string (match-beginning 1) (match-end 1))))))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
288 string)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
289
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
290 (defun gud-dbx-find-file (f)
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
291 (find-file-noselect f))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
292
477
ab9a55b26bd4 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 460
diff changeset
293 ;;;###autoload
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
294 (defun dbx (args)
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
295 "Run dbx on program FILE in buffer *gud-FILE*.
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
296 The directory containing FILE becomes the initial working directory
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
297 and source-file directory for your debugger."
2519
d567a93d9408 (gdb, sdb, dbx): Improved prompting a la grep.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2489
diff changeset
298 (interactive "sRun dbx (like this): dbx")
868
0cda1f7b154e *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
299 (gud-overload-functions '((gud-debugger-startup . gud-dbx-debugger-startup)
0cda1f7b154e *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
300 (gud-marker-filter . gud-dbx-marker-filter)
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
301 (gud-find-file . gud-dbx-find-file)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
302 ))
868
0cda1f7b154e *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
303
2581
839d67a1dc58 Set no-byte-compile local variable t to work around a byte-compiler bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2532
diff changeset
304 (gud-common-init args)
839d67a1dc58 Set no-byte-compile local variable t to work around a byte-compiler bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2532
diff changeset
305
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
306 (gud-def gud-break "stop at \"%f\":%l"
2960
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
307 "\C-b" "Set breakpoint at current line.")
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
308 (gud-def gud-remove "clear %l" "\C-d" "Remove breakpoint at current line")
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
309 (gud-def gud-step "step %p" "\C-s" "Step one line with display.")
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
310 (gud-def gud-stepi "stepi %p" "\C-i" "Step one instruction with display.")
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
311 (gud-def gud-next "next %p" "\C-n" "Step one line (skip functions).")
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
312 (gud-def gud-cont "cont" "\C-r" "Continue with display.")
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
313 (gud-def gud-up "up %p" "<" "Up (numeric arg) stack frames.")
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
314 (gud-def gud-down "down %p" ">" "Down (numeric arg) stack frames.")
2960
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
315 (gud-def gud-print "print %e" "\C-p" "Evaluate C expression at point.")
868
0cda1f7b154e *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
316
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
317 (setq comint-prompt-regexp "^[^)]*dbx) *")
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
318 (run-hooks 'dbx-mode-hook)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
319 )
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
320
3738
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
321 ;; ======================================================================
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
322 ;; xdb (HP PARISC debugger) functions
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
323
3745
3c4f7e74e3f0 (gud-xdb-directories): Renamed from gud-xdb-paths.
Richard M. Stallman <rms@gnu.org>
parents: 3738
diff changeset
324 (defvar gud-xdb-directories nil
3c4f7e74e3f0 (gud-xdb-directories): Renamed from gud-xdb-paths.
Richard M. Stallman <rms@gnu.org>
parents: 3738
diff changeset
325 "*A list of directories that xdb should search for source code.
3c4f7e74e3f0 (gud-xdb-directories): Renamed from gud-xdb-paths.
Richard M. Stallman <rms@gnu.org>
parents: 3738
diff changeset
326 If nil, only source files in the program directory
3c4f7e74e3f0 (gud-xdb-directories): Renamed from gud-xdb-paths.
Richard M. Stallman <rms@gnu.org>
parents: 3738
diff changeset
327 will be known to xdb.
3c4f7e74e3f0 (gud-xdb-directories): Renamed from gud-xdb-paths.
Richard M. Stallman <rms@gnu.org>
parents: 3738
diff changeset
328
3c4f7e74e3f0 (gud-xdb-directories): Renamed from gud-xdb-paths.
Richard M. Stallman <rms@gnu.org>
parents: 3738
diff changeset
329 The file names should be absolute, or relative to the directory
3c4f7e74e3f0 (gud-xdb-directories): Renamed from gud-xdb-paths.
Richard M. Stallman <rms@gnu.org>
parents: 3738
diff changeset
330 containing the executable being debugged.")
3c4f7e74e3f0 (gud-xdb-directories): Renamed from gud-xdb-paths.
Richard M. Stallman <rms@gnu.org>
parents: 3738
diff changeset
331
3738
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
332 (defun gud-xdb-debugger-startup (file args)
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
333 (apply 'make-comint (concat "gud-" file) "xdb" nil
3745
3c4f7e74e3f0 (gud-xdb-directories): Renamed from gud-xdb-paths.
Richard M. Stallman <rms@gnu.org>
parents: 3738
diff changeset
334 (append (let ((directories gud-xdb-directories)
3738
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
335 (result nil))
3745
3c4f7e74e3f0 (gud-xdb-directories): Renamed from gud-xdb-paths.
Richard M. Stallman <rms@gnu.org>
parents: 3738
diff changeset
336 (while directories
3c4f7e74e3f0 (gud-xdb-directories): Renamed from gud-xdb-paths.
Richard M. Stallman <rms@gnu.org>
parents: 3738
diff changeset
337 (setq result (cons (car directories) (cons "-d" result)))
3c4f7e74e3f0 (gud-xdb-directories): Renamed from gud-xdb-paths.
Richard M. Stallman <rms@gnu.org>
parents: 3738
diff changeset
338 (setq directories (cdr directories)))
3738
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
339 (nreverse result))
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
340 args)))
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
341
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
342 (defun gud-xdb-file-name (f)
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
343 "Transform a relative pathname to a full pathname in xdb mode"
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
344 (let ((result nil))
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
345 (if (file-exists-p f)
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
346 (setq result (expand-file-name f))
3745
3c4f7e74e3f0 (gud-xdb-directories): Renamed from gud-xdb-paths.
Richard M. Stallman <rms@gnu.org>
parents: 3738
diff changeset
347 (let ((directories gud-xdb-directories))
3c4f7e74e3f0 (gud-xdb-directories): Renamed from gud-xdb-paths.
Richard M. Stallman <rms@gnu.org>
parents: 3738
diff changeset
348 (while directories
3c4f7e74e3f0 (gud-xdb-directories): Renamed from gud-xdb-paths.
Richard M. Stallman <rms@gnu.org>
parents: 3738
diff changeset
349 (let ((path (concat (car directories) "/" f)))
3738
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
350 (if (file-exists-p path)
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
351 (setq result (expand-file-name path)
3745
3c4f7e74e3f0 (gud-xdb-directories): Renamed from gud-xdb-paths.
Richard M. Stallman <rms@gnu.org>
parents: 3738
diff changeset
352 directories nil)))
3c4f7e74e3f0 (gud-xdb-directories): Renamed from gud-xdb-paths.
Richard M. Stallman <rms@gnu.org>
parents: 3738
diff changeset
353 (setq directories (cdr directories)))))
3738
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
354 result))
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
355
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
356 ;; xdb does not print the lines all at once, so we have to accumulate them
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
357 (defvar gud-xdb-accumulation "")
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
358
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
359 (defun gud-xdb-marker-filter (string)
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
360 (let (result)
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
361 (if (or (string-match comint-prompt-regexp string)
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
362 (string-match ".*\012" string))
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
363 (setq result (concat gud-xdb-accumulation string)
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
364 gud-xdb-accumulation "")
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
365 (setq gud-xdb-accumulation (concat gud-xdb-accumulation string)))
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
366 (if result
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
367 (if (or (string-match "\\([^\n \t:]+\\): [^:]+: \\([0-9]+\\):" result)
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
368 (string-match "[^: \t]+:[ \t]+\\([^:]+\\): [^:]+: \\([0-9]+\\):"
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
369 result))
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
370 (let ((line (string-to-int
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
371 (substring result (match-beginning 2) (match-end 2))))
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
372 (file (gud-xdb-file-name
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
373 (substring result (match-beginning 1) (match-end 1)))))
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
374 (if file
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
375 (setq gud-last-frame (cons file line))))))
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
376 (or result "")))
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
377
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
378 (defun gud-xdb-find-file (f)
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
379 (let ((realf (gud-xdb-file-name f)))
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
380 (if realf (find-file-noselect realf))))
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
381
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
382 ;;;###autoload
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
383 (defun xdb (args)
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
384 "Run xdb on program FILE in buffer *gud-FILE*.
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
385 The directory containing FILE becomes the initial working directory
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
386 and source-file directory for your debugger.
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
387
3745
3c4f7e74e3f0 (gud-xdb-directories): Renamed from gud-xdb-paths.
Richard M. Stallman <rms@gnu.org>
parents: 3738
diff changeset
388 You can set the variable 'gud-xdb-directories' to a list of program source
3738
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
389 directories if your program contains sources from more than one directory."
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
390 (interactive "sRun xdb (like this): xdb")
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
391 (gud-overload-functions '((gud-debugger-startup . gud-xdb-debugger-startup)
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
392 (gud-marker-filter . gud-xdb-marker-filter)
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
393 (gud-find-file . gud-xdb-find-file)))
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
394
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
395 (gud-common-init args)
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
396
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
397 (gud-def gud-break "b %f:%l" "\C-b" "Set breakpoint at current line.")
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
398 (gud-def gud-tbreak "b %f:%l\\t" "\C-t"
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
399 "Set temporary breakpoint at current line.")
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
400 (gud-def gud-remove "db" "\C-d" "Remove breakpoint at current line")
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
401 (gud-def gud-step "s %p" "\C-s" "Step one line with display.")
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
402 (gud-def gud-next "S %p" "\C-n" "Step one line (skip functions).")
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
403 (gud-def gud-cont "c" "\C-r" "Continue with display.")
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
404 (gud-def gud-up "up %p" "<" "Up (numeric arg) stack frames.")
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
405 (gud-def gud-down "down %p" ">" "Down (numeric arg) stack frames.")
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
406 (gud-def gud-finish "bu\\t" "\C-f" "Finish executing current function.")
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
407 (gud-def gud-print "p %e" "\C-p" "Evaluate C expression at point.")
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
408
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
409 (setq comint-prompt-regexp "^>")
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
410 (make-local-variable 'gud-xdb-accumulation)
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
411 (setq gud-xdb-accumulation "")
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
412 (run-hooks 'xdb-mode-hook))
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
413
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
414 ;;
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
415 ;; End of debugger-specific information
477
ab9a55b26bd4 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 460
diff changeset
416 ;;
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
417
1256
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
418 ;;; When we send a command to the debugger via gud-call, it's annoying
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
419 ;;; to see the command and the new prompt inserted into the debugger's
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
420 ;;; buffer; we have other ways of knowing the command has completed.
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
421 ;;;
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
422 ;;; If the buffer looks like this:
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
423 ;;; --------------------
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
424 ;;; (gdb) set args foo bar
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
425 ;;; (gdb) -!-
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
426 ;;; --------------------
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
427 ;;; (the -!- marks the location of point), and we type `C-x SPC' in a
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
428 ;;; source file to set a breakpoint, we want the buffer to end up like
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
429 ;;; this:
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
430 ;;; --------------------
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
431 ;;; (gdb) set args foo bar
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
432 ;;; Breakpoint 1 at 0x92: file make-docfile.c, line 49.
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
433 ;;; (gdb) -!-
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
434 ;;; --------------------
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
435 ;;; Essentially, the old prompt is deleted, and the command's output
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
436 ;;; and the new prompt take its place.
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
437 ;;;
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
438 ;;; Not echoing the command is easy enough; you send it directly using
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
439 ;;; process-send-string, and it never enters the buffer. However,
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
440 ;;; getting rid of the old prompt is trickier; you don't want to do it
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
441 ;;; when you send the command, since that will result in an annoying
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
442 ;;; flicker as the prompt is deleted, redisplay occurs while Emacs
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
443 ;;; waits for a response from the debugger, and the new prompt is
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
444 ;;; inserted. Instead, we'll wait until we actually get some output
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
445 ;;; from the subprocess before we delete the prompt. If the command
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
446 ;;; produced no output other than a new prompt, that prompt will most
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
447 ;;; likely be in the first chunk of output received, so we will delete
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
448 ;;; the prompt and then replace it with an identical one. If the
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
449 ;;; command produces output, the prompt is moving anyway, so the
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
450 ;;; flicker won't be annoying.
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
451 ;;;
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
452 ;;; So - when we want to delete the prompt upon receipt of the next
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
453 ;;; chunk of debugger output, we position gud-delete-prompt-marker at
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
454 ;;; the start of the prompt; the process filter will notice this, and
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
455 ;;; delete all text between it and the process output marker. If
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
456 ;;; gud-delete-prompt-marker points nowhere, we leave the current
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
457 ;;; prompt alone.
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
458 (defvar gud-delete-prompt-marker nil)
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
459
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
461 (defun gud-mode ()
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
462 "Major mode for interacting with an inferior debugger process.
868
0cda1f7b154e *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
463
3738
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
464 You start it up with one of the commands M-x gdb, M-x sdb, M-x dbx,
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
465 or M-x xdb. Each entry point finishes by executing a hook; `gdb-mode-hook',
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
466 `sdb-mode-hook', `dbx-mode-hook' or `xdb-mode-hook' respectively.
868
0cda1f7b154e *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
467
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
468 After startup, the following commands are available in both the GUD
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
469 interaction buffer and any source buffer GUD visits due to a breakpoint stop
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
470 or step operation:
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
471
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
472 \\[gud-break] sets a breakpoint at the current file and line. In the
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
473 GUD buffer, the current file and line are those of the last breakpoint or
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
474 step. In a source buffer, they are the buffer's file and current line.
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
475
2532
17a6b6d079cf (gud-mode): Created C-c synonym bindings in the GUD buffer's local map.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2519
diff changeset
476 \\[gud-remove] removes breakpoints on the current file and line.
17a6b6d079cf (gud-mode): Created C-c synonym bindings in the GUD buffer's local map.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2519
diff changeset
477
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
478 \\[gud-refresh] displays in the source window the last line referred to
868
0cda1f7b154e *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
479 in the gud buffer.
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
480
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
481 \\[gud-step], \\[gud-next], and \\[gud-stepi] do a step-one-line,
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
482 step-one-line (not entering function calls), and step-one-instruction
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
483 and then update the source window with the current file and position.
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
484 \\[gud-cont] continues execution.
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
485
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
486 \\[gud-print] tries to find the largest C lvalue or function-call expression
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
487 around point, and sends it to the debugger for value display.
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
488
3738
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
489 The above commands are common to all supported debuggers except xdb which
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
490 does not support stepping instructions.
868
0cda1f7b154e *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
491
3738
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
492 Under gdb, sdb and xdb, \\[gud-tbreak] behaves exactly like \\[gud-break],
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
493 except that the breakpoint is temporary; that is, it is removed when
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
494 execution stops on it.
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
495
3738
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
496 Under gdb, dbx, and xdb, \\[gud-up] pops up through an enclosing stack
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
497 frame. \\[gud-down] drops back down through one.
868
0cda1f7b154e *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
498
3738
c5ebd279e007 (xdb): New debugger supported (xdb under HPUX-PARISC).
Richard M. Stallman <rms@gnu.org>
parents: 3646
diff changeset
499 If you are using gdb or xdb, \\[gud-finish] runs execution to the return from
868
0cda1f7b154e *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
500 the current function and stops.
0cda1f7b154e *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
501
3551
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
502 All the keystrokes above are accessible in the GUD buffer
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
503 with the prefix C-c, and in all buffers through the prefix C-x C-a.
2532
17a6b6d079cf (gud-mode): Created C-c synonym bindings in the GUD buffer's local map.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2519
diff changeset
504
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
505 All pre-defined functions for which the concept make sense repeat
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
506 themselves the appropriate number of times if you give a prefix
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
507 argument.
868
0cda1f7b154e *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
508
3551
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
509 You may use the `gud-def' macro in the initialization hook to define other
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
510 commands.
868
0cda1f7b154e *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
511
0cda1f7b154e *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
512 Other commands for interacting with the debugger process are inherited from
0cda1f7b154e *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 810
diff changeset
513 comint mode, which see."
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
514 (interactive)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
515 (comint-mode)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
516 (setq major-mode 'gud-mode)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
517 (setq mode-name "Debugger")
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
518 (setq mode-line-process '(": %s"))
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
519 (use-local-map (copy-keymap comint-mode-map))
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
520 (make-local-variable 'gud-last-frame)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
521 (setq gud-last-frame nil)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
522 (make-local-variable 'comint-prompt-regexp)
1256
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
523 (make-local-variable 'gud-delete-prompt-marker)
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
524 (setq gud-delete-prompt-marker (make-marker))
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
525 (run-hooks 'gud-mode-hook)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
526 )
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
527
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
528 (defvar gud-comint-buffer nil)
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
529
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
530 (defun gud-common-init (args)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
531 ;; Perform initializations common to all debuggers
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
532 ;; There *must* be a cleaner way to lex the arglist...
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
533 (let (file i)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
534 (if (string= args "")
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
535 (setq args nil)
2960
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
536 (save-excursion
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
537 (set-buffer (get-buffer-create "*gud-scratch*"))
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
538 (erase-buffer)
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
539 (insert args)
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
540 (goto-char (point-max))
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
541 (insert "\")")
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
542 (goto-char (point-min))
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
543 (insert "(\"")
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
544 (while (re-search-forward " +" nil t)
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
545 (replace-match "\" \"" nil nil))
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
546 (goto-char (point-min))
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
547 (while (re-search-forward "\"\"" nil t)
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
548 (replace-match "" nil nil))
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
549 (setq args (read (buffer-string)))
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
550 (kill-buffer (current-buffer))))
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
551 (setq i (1- (length args)))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
552 (while (and (>= i 0) (not (= (aref (nth i args) 0) ?-)))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
553 (setq file (nth i args)) (setq i (1- i)))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
554 (let* ((path (expand-file-name file))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
555 (filepart (file-name-nondirectory path)))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
556 (switch-to-buffer (concat "*gud-" filepart "*"))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
557 (setq default-directory (file-name-directory path))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
558 (or (bolp) (newline))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
559 (insert "Current directory is " default-directory "\n")
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
560 (gud-debugger-startup filepart args)))
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
561 (gud-mode)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
562 (set-process-filter (get-buffer-process (current-buffer)) 'gud-filter)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
563 (set-process-sentinel (get-buffer-process (current-buffer)) 'gud-sentinel)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
564 (gud-set-buffer)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
565 )
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
566
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
567 (defun gud-set-buffer ()
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
568 (cond ((eq major-mode 'gud-mode)
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
569 (setq gud-comint-buffer (current-buffer)))))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
570
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
571 ;; These functions are responsible for inserting output from your debugger
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
572 ;; into the buffer. The hard work is done by the method that is
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
573 ;; the value of gud-marker-filter.
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
574
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
575 (defun gud-filter (proc string)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
576 ;; Here's where the actual buffer insertion is done
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
577 (let ((inhibit-quit t))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
578 (save-excursion
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
579 (set-buffer (process-buffer proc))
2960
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
580 (let (moving output-after-point)
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
581 (save-excursion
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
582 (goto-char (process-mark proc))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
583 ;; If we have been so requested, delete the debugger prompt.
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
584 (if (marker-buffer gud-delete-prompt-marker)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
585 (progn
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
586 (delete-region (point) gud-delete-prompt-marker)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
587 (set-marker gud-delete-prompt-marker nil)))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
588 (insert-before-markers (gud-marker-filter string))
2960
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
589 (setq moving (= (point) (process-mark proc)))
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
590 (setq output-after-point (< (point) (process-mark proc)))
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
591 ;; Check for a filename-and-line number.
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
592 ;; Don't display the specified file
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
593 ;; unless (1) point is at or after the position where output appears
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
594 ;; and (2) this buffer is on the screen.
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
595 (if (and gud-last-frame
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
596 (not output-after-point)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
597 (get-buffer-window (current-buffer)))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
598 (gud-display-frame)))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
599 (if moving (goto-char (process-mark proc)))))))
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
600
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
601 (defun gud-sentinel (proc msg)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
602 (cond ((null (buffer-name (process-buffer proc)))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
603 ;; buffer killed
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
604 ;; Stop displaying an arrow in a source file.
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
605 (setq overlay-arrow-position nil)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
606 (set-process-buffer proc nil))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
607 ((memq (process-status proc) '(signal exit))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
608 ;; Stop displaying an arrow in a source file.
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
609 (setq overlay-arrow-position nil)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
610 ;; Fix the mode line.
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
611 (setq mode-line-process
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
612 (concat ": "
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
613 (symbol-name (process-status proc))))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
614 (let* ((obuf (current-buffer)))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
615 ;; save-excursion isn't the right thing if
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
616 ;; process-buffer is current-buffer
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
617 (unwind-protect
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
618 (progn
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
619 ;; Write something in *compilation* and hack its mode line,
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
620 (set-buffer (process-buffer proc))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
621 ;; Force mode line redisplay soon
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
622 (set-buffer-modified-p (buffer-modified-p))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
623 (if (eobp)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
624 (insert ?\n mode-name " " msg)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
625 (save-excursion
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
626 (goto-char (point-max))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
627 (insert ?\n mode-name " " msg)))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
628 ;; If buffer and mode line will show that the process
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
629 ;; is dead, we can delete it now. Otherwise it
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
630 ;; will stay around until M-x list-processes.
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
631 (delete-process proc))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
632 ;; Restore old buffer, but don't restore old point
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
633 ;; if obuf is the gud buffer.
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
634 (set-buffer obuf))))))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
635
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
636 (defun gud-display-frame ()
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
637 "Find and obey the last filename-and-line marker from the debugger.
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
638 Obeying it means displaying in another window the specified file and line."
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
639 (interactive)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
640 (if gud-last-frame
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
641 (progn
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
642 (gud-set-buffer)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
643 (gud-display-line (car gud-last-frame) (cdr gud-last-frame))
3646
4b34cbec2058 * gud.el (gud-last-last-frame): New variable.
Jim Blandy <jimb@redhat.com>
parents: 3591
diff changeset
644 (setq gud-last-last-frame gud-last-frame
4b34cbec2058 * gud.el (gud-last-last-frame): New variable.
Jim Blandy <jimb@redhat.com>
parents: 3591
diff changeset
645 gud-last-frame nil))))
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
646
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
647 ;; Make sure the file named TRUE-FILE is in a buffer that appears on the screen
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
648 ;; and that its line LINE is visible.
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
649 ;; Put the overlay-arrow on the line LINE in that buffer.
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
650 ;; Most of the trickiness in here comes from wanting to preserve the current
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
651 ;; region-restriction if that's possible. We use an explicit display-buffer
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
652 ;; to get around the fact that this is called inside a save-excursion.
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
653
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
654 (defun gud-display-line (true-file line)
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
655 (let* ((buffer (gud-find-file true-file))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
656 (window (display-buffer buffer))
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
657 (pos))
2960
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
658 ;;; (if (equal buffer (current-buffer))
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
659 ;;; nil
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
660 ;;; (setq buffer-read-only nil))
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
661 (save-excursion
2960
372386917f03 (gud-def): Fix inclusion of the define-key.
Richard M. Stallman <rms@gnu.org>
parents: 2594
diff changeset
662 ;;; (setq buffer-read-only t)
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
663 (set-buffer buffer)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
664 (save-restriction
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
665 (widen)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
666 (goto-line line)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
667 (setq pos (point))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
668 (setq overlay-arrow-string "=>")
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
669 (or overlay-arrow-position
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
670 (setq overlay-arrow-position (make-marker)))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
671 (set-marker overlay-arrow-position (point) (current-buffer)))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
672 (cond ((or (< pos (point-min)) (> pos (point-max)))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
673 (widen)
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
674 (goto-char pos))))
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
675 (set-window-point window overlay-arrow-position)))
1256
ff24725192d3 * gud.el: When we send a command to the debugger via gud-call,
Jim Blandy <jimb@redhat.com>
parents: 1255
diff changeset
676
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
677 ;;; The gud-call function must do the right thing whether its invoking
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
678 ;;; keystroke is from the GUD buffer itself (via major-mode binding)
2581
839d67a1dc58 Set no-byte-compile local variable t to work around a byte-compiler bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2532
diff changeset
679 ;;; or a C buffer. In the former case, we want to supply data from
839d67a1dc58 Set no-byte-compile local variable t to work around a byte-compiler bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2532
diff changeset
680 ;;; gud-last-frame. Here's how we do it:
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
681
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
682 (defun gud-format-command (str arg)
2581
839d67a1dc58 Set no-byte-compile local variable t to work around a byte-compiler bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2532
diff changeset
683 (let ((insource (not (eq (current-buffer) gud-comint-buffer))))
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
684 (if (string-match "\\(.*\\)%f\\(.*\\)" str)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
685 (progn
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
686 (setq str (concat
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
687 (substring str (match-beginning 1) (match-end 1))
2594
e1277aec1738 (gud-format-command): Fix %f expansuuin to send ondly the basename of
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2581
diff changeset
688 (file-name-nondirectory (if insource
e1277aec1738 (gud-format-command): Fix %f expansuuin to send ondly the basename of
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2581
diff changeset
689 (buffer-file-name)
e1277aec1738 (gud-format-command): Fix %f expansuuin to send ondly the basename of
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2581
diff changeset
690 (car gud-last-frame)))
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
691 (substring str (match-beginning 2) (match-end 2))))))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
692 (if (string-match "\\(.*\\)%l\\(.*\\)" str)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
693 (progn
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
694 (setq str (concat
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
695 (substring str (match-beginning 1) (match-end 1))
2581
839d67a1dc58 Set no-byte-compile local variable t to work around a byte-compiler bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2532
diff changeset
696 (if insource
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
697 (save-excursion
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
698 (beginning-of-line)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
699 (save-restriction (widen)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
700 (1+ (count-lines 1 (point)))))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
701 (cdr gud-last-frame))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
702 (substring str (match-beginning 2) (match-end 2))))))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
703 (if (string-match "\\(.*\\)%e\\(.*\\)" str)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
704 (progn
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
705 (setq str (concat
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
706 (substring str (match-beginning 1) (match-end 1))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
707 (find-c-expr)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
708 (substring str (match-beginning 2) (match-end 2))))))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
709 (if (string-match "\\(.*\\)%a\\(.*\\)" str)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
710 (progn
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
711 (setq str (concat
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
712 (substring str (match-beginning 1) (match-end 1))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
713 (gud-read-address)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
714 (substring str (match-beginning 2) (match-end 2))))))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
715 (if (string-match "\\(.*\\)%p\\(.*\\)" str)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
716 (progn
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
717 (setq str (concat
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
718 (substring str (match-beginning 1) (match-end 1))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
719 (if arg (int-to-string arg) "")
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
720 (substring str (match-beginning 2) (match-end 2))))))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
721 )
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
722 str
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
723 )
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
724
1255
ff06503c93b4 * gud.el (gud-def): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 923
diff changeset
725 (defun gud-read-address ()
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
726 "Return a string containing the core-address found in the buffer at point."
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
727 (save-excursion
1255
ff06503c93b4 * gud.el (gud-def): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 923
diff changeset
728 (let ((pt (point)) found begin)
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
729 (setq found (if (search-backward "0x" (- pt 7) t) (point)))
1255
ff06503c93b4 * gud.el (gud-def): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 923
diff changeset
730 (cond
ff06503c93b4 * gud.el (gud-def): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 923
diff changeset
731 (found (forward-char 2)
ff06503c93b4 * gud.el (gud-def): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 923
diff changeset
732 (buffer-substring found
ff06503c93b4 * gud.el (gud-def): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 923
diff changeset
733 (progn (re-search-forward "[^0-9a-f]")
ff06503c93b4 * gud.el (gud-def): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 923
diff changeset
734 (forward-char -1)
ff06503c93b4 * gud.el (gud-def): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 923
diff changeset
735 (point))))
ff06503c93b4 * gud.el (gud-def): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 923
diff changeset
736 (t (setq begin (progn (re-search-backward "[^0-9]")
ff06503c93b4 * gud.el (gud-def): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 923
diff changeset
737 (forward-char 1)
ff06503c93b4 * gud.el (gud-def): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 923
diff changeset
738 (point)))
ff06503c93b4 * gud.el (gud-def): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 923
diff changeset
739 (forward-char 1)
ff06503c93b4 * gud.el (gud-def): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 923
diff changeset
740 (re-search-forward "[^0-9]")
ff06503c93b4 * gud.el (gud-def): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 923
diff changeset
741 (forward-char -1)
ff06503c93b4 * gud.el (gud-def): Doc fix.
Jim Blandy <jimb@redhat.com>
parents: 923
diff changeset
742 (buffer-substring begin (point)))))))
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
743
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
744 (defun gud-call (fmt &optional arg)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
745 (let ((msg (gud-format-command fmt arg)))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
746 (message "Command: %s" msg)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
747 (sit-for 0)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
748 (gud-basic-call msg)))
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
749
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
750 (defun gud-basic-call (command)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
751 "Invoke the debugger COMMAND displaying source in other window."
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
752 (interactive)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
753 (gud-set-buffer)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
754 (let ((command (concat command "\n"))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
755 (proc (get-buffer-process gud-comint-buffer)))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
756
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
757 ;; Arrange for the current prompt to get deleted.
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
758 (save-excursion
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
759 (set-buffer gud-comint-buffer)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
760 (goto-char (process-mark proc))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
761 (beginning-of-line)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
762 (if (looking-at comint-prompt-regexp)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
763 (set-marker gud-delete-prompt-marker (point))))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
764 (process-send-string proc command)))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
765
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
766 (defun gud-refresh (&optional arg)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
767 "Fix up a possibly garbled display, and redraw the arrow."
460
c103b99fd872 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
768 (interactive "P")
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
769 (recenter arg)
3646
4b34cbec2058 * gud.el (gud-last-last-frame): New variable.
Jim Blandy <jimb@redhat.com>
parents: 3591
diff changeset
770 (or gud-last-frame (setq gud-last-frame gud-last-last-frame))
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
771 (gud-display-frame))
3551
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
772
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
773 ;;; Code for parsing expressions out of C code. The single entry point is
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
774 ;;; find-c-expr, which tries to return an lvalue expression from around point.
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
775 ;;;
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
776 ;;; The rest of this file is a hacked version of gdbsrc.el by
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
777 ;;; Debby Ayers <ayers@asc.slb.com>,
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
778 ;;; Rich Schaefer <schaefer@asc.slb.com> Schlumberger, Austin, Tx.
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
779
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
780 (defun find-c-expr ()
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
781 "Returns the C expr that surrounds point."
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
782 (interactive)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
783 (save-excursion
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
784 (let ((p) (expr) (test-expr))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
785 (setq p (point))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
786 (setq expr (expr-cur))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
787 (setq test-expr (expr-prev))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
788 (while (expr-compound test-expr expr)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
789 (setq expr (cons (car test-expr) (cdr expr)))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
790 (goto-char (car expr))
3551
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
791 (setq test-expr (expr-prev)))
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
792 (goto-char p)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
793 (setq test-expr (expr-next))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
794 (while (expr-compound expr test-expr)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
795 (setq expr (cons (car expr) (cdr test-expr)))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
796 (setq test-expr (expr-next))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
797 )
3551
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
798 (buffer-substring (car expr) (cdr expr)))))
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
799
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
800 (defun expr-cur ()
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
801 "Returns the expr that point is in; point is set to beginning of expr.
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
802 The expr is represented as a cons cell, where the car specifies the point in
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
803 the current buffer that marks the beginning of the expr and the cdr specifies
3551
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
804 the character after the end of the expr."
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
805 (let ((p (point)) (begin) (end))
3551
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
806 (expr-backward-sexp)
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
807 (setq begin (point))
3551
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
808 (expr-forward-sexp)
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
809 (setq end (point))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
810 (if (>= p end)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
811 (progn
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
812 (setq begin p)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
813 (goto-char p)
3551
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
814 (expr-forward-sexp)
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
815 (setq end (point))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
816 )
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
817 )
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
818 (goto-char begin)
3551
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
819 (cons begin end)))
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
820
3551
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
821 (defun expr-backward-sexp ()
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
822 "Version of `backward-sexp' that catches errors."
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
823 (condition-case nil
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
824 (backward-sexp)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
825 (error t)))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
826
3551
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
827 (defun expr-forward-sexp ()
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
828 "Version of `forward-sexp' that catches errors."
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
829 (condition-case nil
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
830 (forward-sexp)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
831 (error t)))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
832
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
833 (defun expr-prev ()
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
834 "Returns the previous expr, point is set to beginning of that expr.
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
835 The expr is represented as a cons cell, where the car specifies the point in
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
836 the current buffer that marks the beginning of the expr and the cdr specifies
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
837 the character after the end of the expr"
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
838 (let ((begin) (end))
3551
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
839 (expr-backward-sexp)
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
840 (setq begin (point))
3551
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
841 (expr-forward-sexp)
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
842 (setq end (point))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
843 (goto-char begin)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
844 (cons begin end)))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
845
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
846 (defun expr-next ()
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
847 "Returns the following expr, point is set to beginning of that expr.
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
848 The expr is represented as a cons cell, where the car specifies the point in
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
849 the current buffer that marks the beginning of the expr and the cdr specifies
3551
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
850 the character after the end of the expr."
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
851 (let ((begin) (end))
3551
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
852 (expr-forward-sexp)
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
853 (expr-forward-sexp)
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
854 (setq end (point))
3551
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
855 (expr-backward-sexp)
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
856 (setq begin (point))
3551
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
857 (cons begin end)))
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
858
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
859 (defun expr-compound-sep (span-start span-end)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
860 "Returns '.' for '->' & '.', returns ' ' for white space,
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 3551
diff changeset
861 returns '?' for other punctuation."
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
862 (let ((result ? )
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
863 (syntax))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
864 (while (< span-start span-end)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
865 (setq syntax (char-syntax (char-after span-start)))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
866 (cond
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
867 ((= syntax ? ) t)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
868 ((= syntax ?.) (setq syntax (char-after span-start))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
869 (cond
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
870 ((= syntax ?.) (setq result ?.))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
871 ((and (= syntax ?-) (= (char-after (+ span-start 1)) ?>))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
872 (setq result ?.)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
873 (setq span-start (+ span-start 1)))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
874 (t (setq span-start span-end)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
875 (setq result ??)))))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
876 (setq span-start (+ span-start 1)))
3551
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
877 result))
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
878
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
879 (defun expr-compound (first second)
3551
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
880 "Non-nil if concatenating FIRST and SECOND makes a single C token.
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
881 The two exprs are represented as a cons cells, where the car
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
882 specifies the point in the current buffer that marks the beginning of the
3551
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
883 expr and the cdr specifies the character after the end of the expr.
2489
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
884 Link exprs of the form:
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
885 Expr -> Expr
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
886 Expr . Expr
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
887 Expr (Expr)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
888 Expr [Expr]
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
889 (Expr) Expr
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
890 [Expr] Expr"
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
891 (let ((span-start (cdr first))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
892 (span-end (car second))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
893 (syntax))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
894 (setq syntax (expr-compound-sep span-start span-end))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
895 (cond
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
896 ((= (car first) (car second)) nil)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
897 ((= (cdr first) (cdr second)) nil)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
898 ((= syntax ?.) t)
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
899 ((= syntax ? )
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
900 (setq span-start (char-after (- span-start 1)))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
901 (setq span-end (char-after span-end))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
902 (cond
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
903 ((= span-start ?) ) t )
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
904 ((= span-start ?] ) t )
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
905 ((= span-end ?( ) t )
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
906 ((= span-end ?[ ) t )
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
907 (t nil))
b626f5b9a0df Massive changes, amounting nearly to a rewrite. The new features
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1902
diff changeset
908 )
3551
8b5fa2d1755f Doc fixes. Delete local variable list at the end.
Richard M. Stallman <rms@gnu.org>
parents: 3343
diff changeset
909 (t nil))))
2581
839d67a1dc58 Set no-byte-compile local variable t to work around a byte-compiler bug.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2532
diff changeset
910
810
80303373daae *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 806
diff changeset
911 ;;; gud.el ends here