comparison lisp/gud.el @ 48278:b82c4ff4d201

(gdb): Undo 10-26 change.
author Richard M. Stallman <rms@gnu.org>
date Wed, 13 Nov 2002 11:40:15 +0000
parents 6ee65f935a8c
children 3a409a9620a7
comparison
equal deleted inserted replaced
48277:a2b3ad4f6870 48278:b82c4ff4d201
403 "Run gdb on program FILE in buffer *gud-FILE*. 403 "Run gdb on program FILE in buffer *gud-FILE*.
404 The directory containing FILE becomes the initial working directory 404 The directory containing FILE becomes the initial working directory
405 and source-file directory for your debugger." 405 and source-file directory for your debugger."
406 (interactive (list (gud-query-cmdline 'gdb))) 406 (interactive (list (gud-query-cmdline 'gdb)))
407 407
408 (gud-common-init command-line 408 (gud-common-init command-line nil
409 #'(lambda (file args)
410 `("-cd" ,(expand-file-name default-directory) . ,args))
411 'gud-gdb-marker-filter 'gud-gdb-find-file) 409 'gud-gdb-marker-filter 'gud-gdb-find-file)
412 (set (make-local-variable 'gud-minor-mode) 'gdb) 410 (set (make-local-variable 'gud-minor-mode) 'gdb)
413 411
414 (gud-def gud-break "break %f:%l" "\C-b" "Set breakpoint at current line.") 412 (gud-def gud-break "break %f:%l" "\C-b" "Set breakpoint at current line.")
415 (gud-def gud-tbreak "tbreak %f:%l" "\C-t" "Set temporary breakpoint at current line.") 413 (gud-def gud-tbreak "tbreak %f:%l" "\C-t" "Set temporary breakpoint at current line.")
2231 ;; The other three args specify the values to use 2229 ;; The other three args specify the values to use
2232 ;; for local variables in the debugger buffer. 2230 ;; for local variables in the debugger buffer.
2233 (defun gud-common-init (command-line massage-args marker-filter &optional find-file) 2231 (defun gud-common-init (command-line massage-args marker-filter &optional find-file)
2234 (let* ((words (split-string command-line)) 2232 (let* ((words (split-string command-line))
2235 (program (car words)) 2233 (program (car words))
2234 (dir default-directory)
2236 ;; Extract the file name from WORDS 2235 ;; Extract the file name from WORDS
2237 ;; and put t in its place. 2236 ;; and put t in its place.
2238 ;; Later on we will put the modified file name arg back there. 2237 ;; Later on we will put the modified file name arg back there.
2239 (file-word (let ((w (cdr words))) 2238 (file-word (let ((w (cdr words)))
2240 (while (and w (= ?- (aref (car w) 0))) 2239 (while (and w (= ?- (aref (car w) 0)))
2254 (if (file-name-directory file-subst) 2253 (if (file-name-directory file-subst)
2255 (expand-file-name file-subst) 2254 (expand-file-name file-subst)
2256 file-subst))) 2255 file-subst)))
2257 (filepart (and file-word (concat "-" (file-name-nondirectory file))))) 2256 (filepart (and file-word (concat "-" (file-name-nondirectory file)))))
2258 (pop-to-buffer (concat "*gud" filepart "*")) 2257 (pop-to-buffer (concat "*gud" filepart "*"))
2258 (setq default-directory dir)
2259 ;; Set default-directory to the file's directory. 2259 ;; Set default-directory to the file's directory.
2260 (and file-word 2260 (and file-word
2261 gud-chdir-before-run 2261 gud-chdir-before-run
2262 ;; Don't set default-directory if no directory was specified. 2262 ;; Don't set default-directory if no directory was specified.
2263 ;; In that case, either the file is found in the current directory, 2263 ;; In that case, either the file is found in the current directory,