From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: nickrob@snap.net.nz (Nick Roberts) Newsgroups: gmane.emacs.help Subject: Re: How can I specify emacs to use a specified gdb with command parameters Date: Sat, 21 Mar 2009 20:16:31 +1300 Message-ID: <18884.37967.448138.515953@totara.tehura.co.nz> References: <528a76e70903191827s7ea90e4dicf657f3910aaf841@mail.gmail.com> <528a76e70903192247v49693f8fx2bbc12f32cbc9557@mail.gmail.com> <528a76e70903192323g23505882te25c60a62b973ae@mail.gmail.com> <528a76e70903202305je24c60ei53f436a37225bc2@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1237619832 11030 80.91.229.12 (21 Mar 2009 07:17:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 21 Mar 2009 07:17:12 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Lucius Fox Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Mar 21 08:18:29 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LkvTQ-0004ji-2m for geh-help-gnu-emacs@m.gmane.org; Sat, 21 Mar 2009 08:18:28 +0100 Original-Received: from localhost ([127.0.0.1]:38573 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LkvS3-0000yT-5G for geh-help-gnu-emacs@m.gmane.org; Sat, 21 Mar 2009 03:17:03 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LkvRh-0000yO-DO for help-gnu-emacs@gnu.org; Sat, 21 Mar 2009 03:16:41 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LkvRc-0000xd-N4 for help-gnu-emacs@gnu.org; Sat, 21 Mar 2009 03:16:40 -0400 Original-Received: from [199.232.76.173] (port=40741 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LkvRc-0000xa-HZ for help-gnu-emacs@gnu.org; Sat, 21 Mar 2009 03:16:36 -0400 Original-Received: from mx20.gnu.org ([199.232.41.8]:64038) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LkvRc-000683-1N for help-gnu-emacs@gnu.org; Sat, 21 Mar 2009 03:16:36 -0400 Original-Received: from viper.snap.net.nz ([202.37.101.23]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LkvRb-0000c4-6G for help-gnu-emacs@gnu.org; Sat, 21 Mar 2009 03:16:35 -0400 Original-Received: from totara (24.27.255.123.static.snap.net.nz [123.255.27.24]) by viper.snap.net.nz (Postfix) with ESMTP id 770183D9DDE; Sat, 21 Mar 2009 20:16:32 +1300 (NZDT) Original-Received: by totara (Postfix, from userid 1000) id 77985C080; Sat, 21 Mar 2009 20:16:31 +1300 (NZDT) In-Reply-To: <528a76e70903202305je24c60ei53f436a37225bc2@mail.gmail.com> X-Mailer: VM 7.19 under Emacs 22.2.1 X-detected-kernel: by mx20.gnu.org: Linux 2.4-2.6 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:63155 Archived-At: > >>>> Is there a way to specify what my gdb command (like in your exa= mple, > >>>> put '/tmp/mygdb --annotate=3D3 /tmp/myexec') =A0in .emacs file?= So that it > >>>> does not prompt me everytime I use M-x gdb? You can customize the variable 'gud-gdb-command-name'. However /tmp ge= nerally wouldn't be a good place to put your executable. As its name implies, = it's for temporary files and, on many systems, all files in it get deleted e= very time the system reboots. > >>> I do something like this in my .emacs: > >>> > >>> (defun my-gdb () > >>> =A0(interactive) > >>> =A0(setq gdb-many-windows nil) nil is default anyway. > >>> =A0(setq gdb-use-separate-io-buffer nil) nil is default anyway. > >>> =A0(tool-bar-mode t) (add-hook 'gdb-mode-hook '(lambda () (tool-bar-mode 1)) > >>> =A0(set-fringe-mode 'default) > >>> =A0(gdb "/tmp/mygdb --annotate=3D3")) This starts gdb without an executable. You could add it to the string argument but one day you might want to debug another program. Using: (setq gud-gdb-command-name "/pathto/yourgdb --annotate=3D3")=20 in your .emacs (or using customize to set it) means you will be prompte= d for (or Emacs will suggest) an executable name. > Right now, I need to do this at a shell in order to remote debug a c+= + program. > $ cd /Volumne/workingdirectory > $ source ./build/envsetup.sh > $ gdb attach $pid > How can I repeat the same steps in emacs gdb? > After I type M-x gdb, i enter 'gdb attach $pid' , it just said 'gdb' > command not found . > My gdb location is setup by the script build/envsetup.sh. Who knows what your script does. Gdb in Emacs (GUD buffer) works almos= t the same as gdb from the command line. If you do 'gdb attach $pid' from th= e command line you get: Undefined command: "gdb". Try "help" just as you do in the GUD buffer. Try typing just "attach $pid". Here $pid must be a GDB convenience var= iable and not a shell variable. Why not read the Emacs and GDB info manuals which are readily available= ? --=20 Nick http://www.inet.net.nz/~= nickrob