From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29504 invoked by alias); 14 Dec 2006 02:01:59 -0000 Received: (qmail 29456 invoked by uid 22791); 14 Dec 2006 02:01:58 -0000 X-Spam-Check-By: sourceware.org Received: from nf-out-0910.google.com (HELO nf-out-0910.google.com) (64.233.182.187) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 14 Dec 2006 02:01:54 +0000 Received: by nf-out-0910.google.com with SMTP id p77so713976nfc for ; Wed, 13 Dec 2006 18:01:52 -0800 (PST) Received: by 10.82.111.8 with SMTP id j8mr160346buc.1166061711604; Wed, 13 Dec 2006 18:01:51 -0800 (PST) Received: by 10.82.150.7 with HTTP; Wed, 13 Dec 2006 18:01:51 -0800 (PST) Message-ID: <77d8667c0612131801g34de0db7xded2053720115525@mail.gmail.com> Date: Thu, 14 Dec 2006 02:01:00 -0000 From: "Luo Yi" To: gdb@sourceware.org Subject: Re: How can I define the breakpoint-commands in my gdbinit file In-Reply-To: <20061214015351.GA5203@nevyn.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <77d8667c0612131751v2913b5d3l31f5d14fd94cdf40@mail.gmail.com> <20061214015351.GA5203@nevyn.them.org> Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-12/txt/msg00122.txt.bz2 luoyi@slack$ cat ~/.gdbinit define mybp b main commands silent printf "eax = %x\n", $eax end end luoyi@slack$ gdb a.out GNU gdb 6.5 Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i486-slackware-linux".../home/luoyi/.gdbinit:7: Error in sourced command file: This command cannot be used at the top level. Using host libthread_db library "/lib/tls/libthread_db.so.1". (gdb) mybp Breakpoint 1 at 0x8048440 Quit <<------------------ gdb stop here! after Ctrl+C, it go on with this (gdb) 2006/12/14, Daniel Jacobowitz : > On Thu, Dec 14, 2006 at 09:51:19AM +0800, Luo Yi wrote: > > How can I define the breakpoint-commands in my gdbinit file ? > > > > define b1 > > b *0x805d3bf > > commands > > silent > > printf "ne, eax = %x\n", $eax > > end <<< ------------ > > end > > > > the commands need a end instruction which can't appear in the middle > > of the gdbinit file. > > It should work fine. Are you using the latest GDB? > -- > Daniel Jacobowitz > CodeSourcery >