From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29515 invoked by alias); 18 Aug 2004 19:13:06 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 29506 invoked from network); 18 Aug 2004 19:13:05 -0000 Received: from unknown (HELO relay0.EECS.Berkeley.EDU) (169.229.60.163) by sourceware.org with SMTP; 18 Aug 2004 19:13:05 -0000 Received: from gateway.EECS.Berkeley.EDU (nsmail@gateway.EECS.Berkeley.EDU [169.229.60.73]) by relay0.EECS.Berkeley.EDU (8.13.0/8.12.10) with ESMTP id i7IJD4wx029076 for ; Wed, 18 Aug 2004 12:13:04 -0700 (PDT) Received: from eecs.berkeley.edu (markov.EECS.Berkeley.EDU [128.32.33.224]) by gateway.EECS.Berkeley.EDU (Netscape Messaging Server 4.15) with ESMTP id I2NPDP00.1DC for ; Wed, 18 Aug 2004 12:13:01 -0700 Message-ID: <4123AA3D.60402@eecs.berkeley.edu> Date: Wed, 18 Aug 2004 19:13:00 -0000 From: "Allen Hopkins" User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.0.1) Gecko/20020920 Netscape/7.0 MIME-Version: 1.0 To: gdb Subject: Redefining n on Solaris Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-08/txt/msg00233.txt.bz2 I'm trying to redefine "next" (to create a debugger for code from which C++ code is generated), and I find that I also have to redefine "n", to be able to use it as a shortcut for "next" (or else I get a segmentation fault when I type "n"). That's fine, and it works OK w/ gdb 6.0 on an Intel/Linux system, but not on a Sun/Solaris 2.8 system. Here's a successful example on the Linux system: ------ linux% uname -a Linux fortytwo.eecs.berkeley.edu 2.4.20-28.8smp #1 SMP Thu Dec 18 12:25:21 EST 2003 i686 i686 i386 GNU/Linux linux% cat foo.ini define next printf "Boo!\n" end define n next end break main linux% gdb -x foo.ini s GNU gdb 6.0 Copyright 2003 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 "i586-suse-linux"... Breakpoint 1 at 0x8048354: file s.cpp, line 4. (gdb) run Starting program: /users/allenh/projects/metropolis/testing/foodir/s Breakpoint 1, main (argc=1, argv=0xbfffe6c4) at s.cpp:4 4 int i = 0; (gdb) n Boo! ------ Now here's the same thing on the Sun: sun% uname -a SunOS markov.eecs.berkeley.edu 5.8 Generic_117350-02 sun4u sparc SUNW,Ultra-60 sun% cat foo.ini define next printf "Boo!\n" end define n next end break main sun% gdb -x foo.ini s GNU gdb 6.0 Copyright 2003 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 "sparc-sun-solaris2.8"... Segmentation Fault sun% gdb -x foo.ini GNU gdb 6.0 Copyright 2003 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 "sparc-sun-solaris2.8". Segmentation Fault sun% ------ I did the second gdb on the Sun, without the executable argument, to show that it has nothing to do with the executable being debugged, which is this: main(int argc, char* argv[]) { int i = 0; return(i); } Interestingly, it works OK on the Sun if I enter the commands from the initialization file by hand: ------ sun% gdb s GNU gdb 6.0 Copyright 2003 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 "sparc-sun-solaris2.8"... (gdb) define next Really redefine built-in command "next"? (y or n) y Type commands for definition of "next". End with a line saying just "end". >printf "Boo!\n" >end (gdb) define n Type commands for definition of "n". End with a line saying just "end". >next >end (gdb) break main Breakpoint 1 at 0x106c8: file s.cpp, line 4. (gdb) run Starting program: /export/home/allenh/projects/metropolis/testing/foodir/s Breakpoint 1, main (argc=1, argv=0xffbeecac) at s.cpp:4 4 int i = 0; (gdb) n Boo! (gdb) ------ Any help? Thanks. -Allen