comparison lisp/gud.el @ 810:80303373daae

*** empty log message ***
author Eric S. Raymond <esr@snark.thyrsus.com>
date Fri, 17 Jul 1992 07:10:46 +0000
parents d42e1151eed8
children 0cda1f7b154e
comparison
equal deleted inserted replaced
809:8a0066235d56 810:80303373daae
1 ;; Grand Unified Debugger mode --- run gdb, sdb, dbx under Emacs control 1 ;;; gud.el --- Grand Unified Debugger mode for gdb, sdb, or dbx under Emacs
2 ;; Copyright (c) 1992 Free Software Foundation, Inc. 2
3 ;; @(#)gud.el 1.10 3 ;; Author: Eric S. Raymond <eric@snark.thyrsus.com>
4 ;; Keywords: unix, tools
5
6 ;; @(#)gud.el 1.18
7
8 ;; Copyright (C) 1992 Free Software Foundation, Inc.
4 9
5 ;; This file is part of GNU Emacs. 10 ;; This file is part of GNU Emacs.
6 11
7 ;; GNU Emacs is free software; you can redistribute it and/or modify 12 ;; GNU Emacs is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by 13 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation; either version 2, or (at your option) 14 ;; the Free Software Foundation; either version 1, or (at your option)
10 ;; any later version. 15 ;; any later version.
11 16
12 ;; GNU Emacs is distributed in the hope that it will be useful, 17 ;; GNU Emacs is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 21
17 ;; You should have received a copy of the GNU General Public License 22 ;; You should have received a copy of the GNU General Public License
18 ;; along with GNU Emacs; see the file COPYING. If not, write to 23 ;; along with GNU Emacs; see the file COPYING. If not, write to
19 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 24 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
20 25
26 ;;; Commentary:
27
21 ;; The ancestral gdb.el was by W. Schelter <wfs@rascal.ics.utexas.edu> 28 ;; The ancestral gdb.el was by W. Schelter <wfs@rascal.ics.utexas.edu>
22 ;; It was later ewritten by rms. Some ideas were due to Masanobu. 29 ;; It was later ewritten by rms. Some ideas were due to Masanobu.
23 ;; Grand Unification (sdb/dbx support) by Eric S. Raymond <eric@thyrsus.com> 30 ;; Grand Unification (sdb/dbx support) by Eric S. Raymond <esr@thyrsus.com>
24 ;; The overloading code was then rewritten by Barry Warsaw <bwarsaw@cen.com>, 31 ;; The overloading code was then rewritten by Barry Warsaw <bwarsaw@cen.com>,
25 ;; who also hacked the mode to use comint.el. 32 ;; who also hacked the mode to use comint.el.
33
34 ;; Note: use of this package with sdb requires that your tags.el support
35 ;; the find-tag-noselect entry point. Stock distributions up to 18.57 do
36 ;; *not* include this feature; if it's not included with this file, email
37 ;; esr@snark.thyrsus.com for it or get 18.58.
38
39 ;; Further note: due to lossage in the Emacs-18 byte compiler, compiled
40 ;; versions of this code will fail with a complaint about gud-step if
41 ;; you invoke the gdb or sdb initializers. This should be fixed in 19.
42
43 ;;; Code:
26 44
27 (require 'comint) 45 (require 'comint)
28 (require 'tags) 46 (require 'tags)
29 47
30 ;; ====================================================================== 48 ;; ======================================================================
54 72
55 (defun gud-set-break (proc f n) 73 (defun gud-set-break (proc f n)
56 (error "GUD not properly entered.")) 74 (error "GUD not properly entered."))
57 75
58 ;; This macro is used below to define some basic debugger interface commands. 76 ;; This macro is used below to define some basic debugger interface commands.
59 ;; Of course you may use `def-gud' with any other debugger command, including 77 ;; Of course you may use `gud-def' with any other debugger command, including
60 ;; user defined ones. 78 ;; user defined ones.
61 79
62 (defmacro def-gud (func name key &optional doc) 80 (defmacro gud-def (func name key &optional doc)
63 (let* ((cstr (list 'if '(not (= 1 arg)) 81 (let* ((cstr (list 'if '(not (= 1 arg))
64 (list 'format "%s %s" name 'arg) name))) 82 (list 'format "%s %s" name 'arg) name)))
65 (list 'progn 83 (list 'progn
66 (list 'defun func '(arg) 84 (list 'defun func '(arg)
67 (or doc "") 85 (or doc "")
137 (gud-overload-functions '((gud-debugger-startup gud-gdb-debugger-startup) 155 (gud-overload-functions '((gud-debugger-startup gud-gdb-debugger-startup)
138 (gud-marker-filter gud-gdb-marker-filter) 156 (gud-marker-filter gud-gdb-marker-filter)
139 (gud-visit-file gud-gdb-visit-file) 157 (gud-visit-file gud-gdb-visit-file)
140 (gud-set-break gud-gdb-set-break))) 158 (gud-set-break gud-gdb-set-break)))
141 159
142 (def-gud gud-step "step" "\C-cs" "Step one source line with display") 160 (gud-def gud-step "step" "\C-cs" "Step one source line with display")
143 (def-gud gud-stepi "stepi" "\C-ci" "Step one instruction with display") 161 (gud-def gud-stepi "stepi" "\C-ci" "Step one instruction with display")
144 (def-gud gud-next "next" "\C-cn" "Step one line (skip functions)") 162 (gud-def gud-next "next" "\C-cn" "Step one line (skip functions)")
145 (def-gud gud-cont "cont" "\C-c\C-c" "Continue with display") 163 (gud-def gud-cont "cont" "\C-c\C-c" "Continue with display")
146 164
147 (def-gud gud-finish "finish" "\C-c\C-f" "Finish executing current function") 165 (gud-def gud-finish "finish" "\C-c\C-f" "Finish executing current function")
148 (def-gud gud-up "up" "\C-c<" "Up N stack frames (numeric arg)") 166 (gud-def gud-up "up" "\C-c<" "Up N stack frames (numeric arg)")
149 (def-gud gud-down "down" "\C-c>" "Down N stack frames (numeric arg)") 167 (gud-def gud-down "down" "\C-c>" "Down N stack frames (numeric arg)")
150 168
151 (gud-common-init path) 169 (gud-common-init path)
152 170
153 (setq comint-prompt-regexp "^(.*gdb[+]?) *") 171 (setq comint-prompt-regexp "^(.*gdb[+]?) *")
154 (run-hooks 'gdb-mode-hook) 172 (run-hooks 'gdb-mode-hook)
188 (gud-overload-functions '((gud-debugger-startup gud-sdb-debugger-startup) 206 (gud-overload-functions '((gud-debugger-startup gud-sdb-debugger-startup)
189 (gud-marker-filter gud-sdb-marker-filter) 207 (gud-marker-filter gud-sdb-marker-filter)
190 (gud-visit-file gud-sdb-visit-file) 208 (gud-visit-file gud-sdb-visit-file)
191 (gud-set-break gud-sdb-set-break))) 209 (gud-set-break gud-sdb-set-break)))
192 210
193 (def-gud gud-step "s" "\C-cs" "Step one source line with display") 211 (gud-def gud-step "s" "\C-cs" "Step one source line with display")
194 (def-gud gud-stepi "i" "\C-ci" "Step one instruction with display") 212 (gud-def gud-stepi "i" "\C-ci" "Step one instruction with display")
195 (def-gud gud-next "S" "\C-cn" "Step one source line (skip functions)") 213 (gud-def gud-next "S" "\C-cn" "Step one source line (skip functions)")
196 (def-gud gud-cont "c" "\C-cc" "Continue with display") 214 (gud-def gud-cont "c" "\C-cc" "Continue with display")
197 215
198 (gud-common-init path) 216 (gud-common-init path)
199 217
200 (setq comint-prompt-pattern "\\(^\\|\n\\)\\*") 218 (setq comint-prompt-pattern "\\(^\\|\n\\)\\*")
201 (run-hooks 'sdb-mode-hook) 219 (run-hooks 'sdb-mode-hook)
232 (gud-overload-functions '((gud-debugger-startup gud-dbx-debugger-startup) 250 (gud-overload-functions '((gud-debugger-startup gud-dbx-debugger-startup)
233 (gud-marker-filter gud-dbx-marker-filter) 251 (gud-marker-filter gud-dbx-marker-filter)
234 (gud-visit-file gud-dbx-visit-file) 252 (gud-visit-file gud-dbx-visit-file)
235 (gud-set-break gud-dbx-set-break))) 253 (gud-set-break gud-dbx-set-break)))
236 254
237 (make-local-variable 'comint-prompt-regexp) 255 (gud-common-init path)
238 (setq comint-prompt-regexp "^[^)]*dbx) *") 256 (setq comint-prompt-regexp "^[^)]*dbx) *")
239
240 (gud-common-init path)
241 257
242 (run-hooks 'dbx-mode-hook) 258 (run-hooks 'dbx-mode-hook)
243 ) 259 )
244 260
245 ;; 261 ;;
523 (t (setq comm addr))) 539 (t (setq comm addr)))
524 (switch-to-buffer current-gud-buffer) 540 (switch-to-buffer current-gud-buffer)
525 (goto-char (dot-max)) 541 (goto-char (dot-max))
526 (insert-string comm))) 542 (insert-string comm)))
527 543
528 ;; gud.e ends here 544 ;;; gud.el ends here
529