Subject: GDB-5.2 vs. NetBSD/sparc 1.5W and 1.5ZC
To: NetBSD-current Discussion List <current-users@NetBSD.ORG>
From: Greg A. Woods <woods@weird.com>
List: current-users
Date: 05/02/2002 16:42:15
Seeing that GDB-5.2 was released I thought I'd give it a try.....

Tweaking pkgsrc to build it was trivial -- patch below....

It seems to work fine on i386, at least for 1.5W (i.e. prior to the
core-file format changes).

However it doesn't work at all on sparc, not for 1.5W, nor for 1.5ZC.
This is odd because 5.1.1 works well enough on 1.5W, and that it doesn't
seem to understand the new core file format is also strange since in my
peeks through the GDB master CVS repository it seemed as though all
Jason's changes for the new core format were included in the new
release, but I may be mistaken about that....  (maybe only for i386 and
arm?)


$ /usr/local/bin/gdb /bin/ksh ~/ksh.core                                                                     
GNU gdb 5.2
Copyright 2002 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-unknown-netbsdelf1.5W"...

warning: "/home/most/woods/Xsun.cores/XsunMono-ssp-1.5ZC-1.core": no core file handler recognizes format, using default
Core was generated by `XsunMono'.
Program terminated with signal 11, Segmentation fault.
Couldn't read float regs from core file
Couldn't read float regs from core file
#0  0x001a4c54 in __hash_open ()
(gdb) where
#0  0x001a4c54 in __hash_open ()
Cannot access memory at address 0x38
(gdb) 


$ gdb /bin/ksh ~/ksh.core                                                                     
GNU gdb 4.17
Copyright 1998 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--netbsd"...(no debugging symbols found)...
Core was generated by `ksh'.
Program terminated with signal 11, Segmentation fault.
#0  0x2fce0 in trapsig ()
(gdb) trace
trace command requires an argument
(gdb) where
#0  0x2fce0 in trapsig ()
#1  0xefffff74 in ?? ()
#2  0x15c28 in test_nexpr ()
#3  0x1d3b4 in execute ()
#4  0x1c570 in comsub ()
#5  0x1b1c0 in expand ()
#6  0x1adac in eval ()
#7  0x1d42c in execute ()
#8  0x1de14 in execute ()
#9  0x1d8b4 in execute ()
#10 0x1ddb0 in execute ()
#11 0x1d8b4 in execute ()
#12 0x1df28 in execute ()
#13 0x1e794 in comexec ()
#14 0x1d724 in execute ()
#15 0x28f88 in shell ()
#16 0x28bd8 in include ()
#17 0x288a8 in main ()
#18 0x10238 in ___start ()
(gdb) 

$ /usr/local/bin/gdb /bin/ksh ~/ksh.core                                                      
GNU gdb 5.2
Copyright 2002 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-unknown-netbsdelf1.5W"...
(no debugging symbols found)...
Core was generated by `ksh'.
Program terminated with signal 11, Segmentation fault.
#0  0xe0fc0200 in ?? ()
(gdb) where
#0  0xe0fc0200 in ?? ()
Cannot access memory at address 0x10e2002b
(gdb) 



Anyways, here's the patch to the pkgsrc module in case anyone wants to
test further.  I won't send-pr unless this can be fixed and tested to
work on -current on more platforms....

Index: Makefile
===================================================================
RCS file: /cvs/master/m-NetBSD/main/pkgsrc/devel/gdb/Makefile,v
retrieving revision 1.4
diff -c -r1.4 Makefile
*** Makefile	18 Feb 2002 15:14:10 -0000	1.4
--- Makefile	2 May 2002 16:55:50 -0000
***************
*** 1,15 ****
  # $NetBSD: Makefile,v 1.4 2002/02/18 15:14:10 seb Exp $
  #
  
! DISTNAME=       gdb-4.18
  CATEGORIES=	devel
  MASTER_SITES=   ${MASTER_SITE_GNU:=gdb/}
  
  MAINTAINER=	packages@netbsd.org
  HOMEPAGE=	http://www.gnu.org/software/gdb/gdb.html
  COMMENT=	symbolic debugger for multiple language frontends
- 
- ONLY_FOR_PLATFORM=	SunOS-*-*	# in NetBSD base system
  
  MAKE_ENV+=	CPPFLAGS=
  INFO_FILES=	gdb.info gdbint.info stabs.info bfd.info
--- 1,13 ----
  # $NetBSD: Makefile,v 1.4 2002/02/18 15:14:10 seb Exp $
  #
  
! DISTNAME=       gdb-5.2
  CATEGORIES=	devel
  MASTER_SITES=   ${MASTER_SITE_GNU:=gdb/}
  
  MAINTAINER=	packages@netbsd.org
  HOMEPAGE=	http://www.gnu.org/software/gdb/gdb.html
  COMMENT=	symbolic debugger for multiple language frontends
  
  MAKE_ENV+=	CPPFLAGS=
  INFO_FILES=	gdb.info gdbint.info stabs.info bfd.info
Index: PLIST
===================================================================
RCS file: /cvs/master/m-NetBSD/main/pkgsrc/devel/gdb/PLIST,v
retrieving revision 1.2
diff -c -r1.2 PLIST
*** PLIST	18 Feb 2002 15:14:10 -0000	1.2
--- PLIST	16 Mar 2002 02:24:39 -0000
***************
*** 18,26 ****
--- 18,36 ----
  info/bfd.info-4
  info/bfd.info-5
  info/bfd.info-6
+ info/bfd.info-7
+ info/configure.info
+ info/configure.info-1
+ info/configure.info-2
+ info/configure.info-3
  info/gdb.info
  info/gdb.info-1
  info/gdb.info-10
+ info/gdb.info-11
+ info/gdb.info-12
+ info/gdb.info-13
+ info/gdb.info-14
+ info/gdb.info-15
  info/gdb.info-2
  info/gdb.info-3
  info/gdb.info-4
***************
*** 33,43 ****
--- 43,57 ----
  info/gdbint.info-1
  info/gdbint.info-2
  info/gdbint.info-3
+ info/gdbint.info-4
+ info/gdbint.info-5
+ info/mmalloc.info
  info/stabs.info
  info/stabs.info-1
  info/stabs.info-2
  info/stabs.info-3
  info/stabs.info-4
+ info/standards.info
  @exec ${INSTALL_INFO} %D/info/standards.info %D/info/dir
  @exec ${INSTALL_INFO} %D/info/mmalloc.info %D/info/dir
  @exec ${INSTALL_INFO} %D/info/bfd.info %D/info/dir
Index: distinfo
===================================================================
RCS file: /cvs/master/m-NetBSD/main/pkgsrc/devel/gdb/distinfo,v
retrieving revision 1.2
diff -c -r1.2 distinfo
*** distinfo	21 Apr 2001 00:44:18 -0000	1.2
--- distinfo	2 May 2002 17:01:20 -0000
***************
*** 1,5 ****
  $NetBSD: distinfo,v 1.2 2001/04/21 00:44:18 wiz Exp $
  
! SHA1 (gdb-4.18.tar.gz) = 4b8abe282a62e581ceb95dd8bf5e467a4521d971
! Size (gdb-4.18.tar.gz) = 11657032 bytes
  SHA1 (patch-aa) = a256a6a9e0fe126462ea92c8a5c8a3864333bb67
--- 1,5 ----
  $NetBSD: distinfo,v 1.2 2001/04/21 00:44:18 wiz Exp $
  
! SHA1 (gdb-5.2.tar.gz) = 409bafca16a6e654de6f23a207fa90261aa3ce17
! Size (gdb-5.2.tar.gz) = 14695979 bytes
  SHA1 (patch-aa) = a256a6a9e0fe126462ea92c8a5c8a3864333bb67


-- 
								Greg A. Woods

+1 416 218-0098;  <gwoods@acm.org>;  <g.a.woods@ieee.org>;  <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>