Article View: gnu.emacs.bug
Article #99094Strange behavior using gdb.el
From: LUSYSNZ
Date: Fri, 26 Oct 1990 21:36
Date: Fri, 26 Oct 1990 21:36
82 lines
3994 bytes
3994 bytes
Relay-Version: VMS News - V5.9C 19/12/89 VAX/VMS V5.3; site vax1.cc.lehigh.edu
Path: vax1.cc.lehigh.edu!vax1.cc.lehigh.edu!netnews.upenn.edu!dsinc!ub!zaphod.mps.ohio-state.edu!wuarchive!cs.utexas.edu!tut.cis.ohio-state.edu!SRC.HONEYWELL.COM!tap
Newsgroups: gnu.emacs.bug
Subject: Strange behavior using gdb.el
Message-ID: <9010172203.AA08013@beethoven.src.honeywell.com>
From: tap@SRC.HONEYWELL.COM (Thomas A Peterson)
Date: 17 Oct 90 22:03:18 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: Gnus Not Usenet
Approved: bug-gnu-emacs@prep.ai.mit.edu
Lines: 69
When using the gdb mode within Emacs there is some strange behavior
with respect to the starting buffer. When I start gdb I am normally in
a shell buffer. I do M-x gdb and provide the filename which is usually
not in the current directory. The gdb buffer comes up fine and it
thinks that its default-directory is where the file is. Everything is
fine and dandy except that the shell buffer from where I was
previously residing now also thinks that its default-directory is
where the file is.
I did some modification to the gdb defun so that it would do what I
expected. Since I am not even an Elisp novice there may be problems
with it, but so far it has been working fine for me.
Enjoy, Tom
From gdb.el from Emacs 18.55
----------------------------
;; Run gdb under Emacs
;; Author: W. Schelter, University of Texas
;; wfs@rascal.ics.utexas.edu
;; Rewritten by rms.
;; Some ideas are due to Masanobu.
;; This file is part of GNU Emacs.
;; Copyright (C) 1988 Free Software Foundation, Inc.
(defun gdb (path)
"Run gdb on program FILE in buffer *gdb-FILE*.
The directory containing FILE becomes the initial working directory
and source-file directory for GDB. If you wish to change this, use
the GDB commands `cd DIR' and `directory'."
(interactive "FRun gdb on file: ")
(setq path (expand-file-name path))
(let ((file (file-name-nondirectory path)))
(switch-to-buffer (concat "*gdb-" file "*"))
(setq default-directory (file-name-directory path))
(or (bolp) (newline))
(insert "Current directory is " default-directory "\n")
(make-shell (concat "gdb-" file) gdb-command-name nil "-fullname"
"-cd" default-directory file)
(gdb-mode)
(set-process-filter (get-buffer-process (current-buffer)) 'gdb-filter)
(set-process-sentinel (get-buffer-process (current-buffer)) 'gdb-sentinel)
(gdb-set-buffer)))
My Version
----------
(defun gdb (path)
"Run gdb on program FILE in buffer *gdb-FILE*.
The directory containing FILE becomes the initial working directory
and source-file directory for GDB. If you wish to change this, use
the GDB commands `cd DIR' and `directory'."
(interactive "FRun gdb on file: ")
(setq path (expand-file-name path))
(let ((file (file-name-nondirectory path))
(directory (file-name-directory path)))
(make-shell (concat "gdb-" file) gdb-command-name nil "-fullname"
"-cd" directory file)
(switch-to-buffer (concat "*gdb-" file "*"))
(setq default-directory directory)
(message "Current directory is %s" directory)
(gdb-mode)
(set-process-filter (get-buffer-process (current-buffer)) 'gdb-filter)
(set-process-sentinel (get-buffer-process (current-buffer)) 'gdb-sentinel)
(gdb-set-buffer)))
Technical Details
Message-ID:
<138E8129B19F800042@VAX1.CC.LEHIGH.EDU>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!VAX1.CC.LEHIGH.EDU!LUSYSNZShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb2f1,e14a9e8213ca5742,start X-Google-Attributes: gidfb2f1,public X-Google-ArrivalTime: 1990-10-26 14:36:00 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!VAX1.CC.LEHIGH.EDU!LUSYSNZ From: LUSYSNZ@VAX1.CC.LEHIGH.EDU Newsgroups: gnu.emacs.bug Subject: Strange behavior using gdb.el Message-ID: <138E8129B19F800042@VAX1.CC.LEHIGH.EDU> Date: 26 Oct 90 21:36:00 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 82 Approved: bug-gnu-emacs@prep.ai.mit.edu Posted: Fri Oct 26 22:36:00 1990