From: "Allen Hopkins" <allenh@eecs.berkeley.edu>
To: gdb <gdb@sources.redhat.com>
Subject: Redefining n on Solaris
Date: Wed, 18 Aug 2004 19:13:00 -0000 [thread overview]
Message-ID: <4123AA3D.60402@eecs.berkeley.edu> (raw)
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
next reply other threads:[~2004-08-18 19:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-18 19:13 Allen Hopkins [this message]
2004-08-19 15:56 ` Dave Korn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4123AA3D.60402@eecs.berkeley.edu \
--to=allenh@eecs.berkeley.edu \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox