public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Redefining n on Solaris
@ 2004-08-18 19:13 Allen Hopkins
  2004-08-19 15:56 ` Dave Korn
  0 siblings, 1 reply; 2+ messages in thread
From: Allen Hopkins @ 2004-08-18 19:13 UTC (permalink / raw)
  To: gdb

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: Redefining n on Solaris
  2004-08-18 19:13 Redefining n on Solaris Allen Hopkins
@ 2004-08-19 15:56 ` Dave Korn
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Korn @ 2004-08-19 15:56 UTC (permalink / raw)
  To: 'gdb'

> -----Original Message-----
> From: gdb-owner On Behalf Of Allen Hopkins
> Sent: 18 August 2004 20:13

> 
> Any help?  Thanks.
> 
> -Allen
> 

  I suggest you use an unmodified sun gdb to debug your modified sun gdb.
You have the source, you have the core file.....


    cheers, 
      DaveK
-- 
Can't think of a witty .sigline today....
 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-08-19 15:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-18 19:13 Redefining n on Solaris Allen Hopkins
2004-08-19 15:56 ` Dave Korn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).