[PATCH]: fix netbsd/ns32k target

J.T. Conklin jtc@redback.com
Mon Jan 22 12:20:00 GMT 2001


I will be committing the enclosed patch.  This should fix the problems
that Andrew encountered while building a ns32k-netbsd GDB on a FreeBSD
host.

The first was the FRAME_FIND_SAVED_REGS macro in config/ns32k/tm-umax.h
mysteriously disappeared in May 1999.  As I mentioned last week, there
was no ChangeLog entry, and because at that time the Cygnus repository
was the master repository, I am unable to determine in what change this
occured.  But since neither the umax nor any target that inherits from 
it (like netbsd/ns32k) can build without it, I can only assume that it's
removal was inadvertant.  This patch restores the value to what it was
before.

The other was that I jumped the gun and moved shared library support
objects from NATDEPFILES to TDEPFILES for all NetBSD targets after
the same had been done for GNU/Linux targets.  This turned out to be 
a mistake. Since shared library support has not yet been made host
independent, it was impossible to build cross debuggers for NetBSD
targets on some hosts.

        --jtc

2001-01-22  J.T. Conklin  <jtc@redback.com>

	* ns32k-tdep.c: #include "frame.h"
	* config/ns32k/tm-umax.h (FRAME_FIND_SAVED_REGS): Restore.  It
 	appears to have been inadvertantly removed sometime in May 1999.

	* Revert 2000-11-09 changes where shared library objects were
 	moved from NATDEPFILES to TDEPFILES on NetBSD targets.  While
	we'd like to be able to debug dynamically linked executables,
	this makes it impossible to build a cross debugger on a many
	hosts.

	* config/i386/nbsd.mt: Remove solib.o, solib-svr4.o from TDEPFILES.
        * config/i386/nbsdelf.mt: Likewise.
        * config/m68k/nbsd.mt: Likewise.
        * config/ns32k/nbsd.mt: Likewise.
        * config/powerpc/nbsd.mt: Likewise.
        * config/sparc/nbsd.mt: Likewise.
        * config/sparc/nbsdelf.mt: Likewise.
        * config/i386/nbsd.mh: Add solib.o, solib-svr4.o to NATDEPFILES.
        * config/i386/nbsdelf.mh: Likewise. 
        * config/m68k/nbsd.mh: Likewise.
        * config/ns32k/nbsd.mh: Likewise.
        * config/powerpc/nbsd.mh: Likewise.
        * config/sparc/nbsd.mh: Likewise.

Index: ns32k-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ns32k-tdep.c,v
retrieving revision 1.2
diff -c -r1.2 ns32k-tdep.c
*** ns32k-tdep.c	2000/07/30 01:48:26	1.2
--- ns32k-tdep.c	2001/01/22 20:03:17
***************
*** 20,25 ****
--- 20,26 ----
     Boston, MA 02111-1307, USA.  */
  
  #include "defs.h"
+ #include "frame.h"
  
  void
  _initialize_ns32k_tdep (void)
Index: config/i386/nbsd.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nbsd.mh,v
retrieving revision 1.6
diff -c -r1.6 nbsd.mh
*** nbsd.mh	2000/11/09 22:57:02	1.6
--- nbsd.mh	2001/01/22 20:03:17
***************
*** 1,5 ****
  # Host: Intel 386 running NetBSD
  XDEPFILES=
! NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o i386nbsd-nat.o
  XM_FILE= xm-nbsd.h
  NAT_FILE= nm-nbsd.h
--- 1,5 ----
  # Host: Intel 386 running NetBSD
  XDEPFILES=
! NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o i386nbsd-nat.o solib.o solib-svr4.o
  XM_FILE= xm-nbsd.h
  NAT_FILE= nm-nbsd.h
Index: config/i386/nbsd.mt
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nbsd.mt,v
retrieving revision 1.5
diff -c -r1.5 nbsd.mt
*** nbsd.mt	2000/11/09 22:57:02	1.5
--- nbsd.mt	2001/01/22 20:03:17
***************
*** 1,5 ****
  # Target: Intel 386 running NetBSD
! TDEPFILES= i386-tdep.o i387-tdep.o i386nbsd-tdep.o solib.o solib-svr4.o
  TM_FILE= tm-nbsd.h
  
  GDBSERVER_DEPFILES= low-nbsd.o
--- 1,5 ----
  # Target: Intel 386 running NetBSD
! TDEPFILES= i386-tdep.o i387-tdep.o i386nbsd-tdep.o
  TM_FILE= tm-nbsd.h
  
  GDBSERVER_DEPFILES= low-nbsd.o
Index: config/i386/nbsdelf.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nbsdelf.mh,v
retrieving revision 1.4
diff -c -r1.4 nbsdelf.mh
*** nbsdelf.mh	2000/11/09 22:57:02	1.4
--- nbsdelf.mh	2001/01/22 20:03:17
***************
*** 1,5 ****
  # Host: Intel 386 running NetBSD
  XDEPFILES=
! NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o i386nbsd-nat.o
  XM_FILE= xm-nbsd.h
  NAT_FILE= nm-nbsdelf.h
--- 1,5 ----
  # Host: Intel 386 running NetBSD
  XDEPFILES=
! NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o i386nbsd-nat.o solib.o solib-svr4.o
  XM_FILE= xm-nbsd.h
  NAT_FILE= nm-nbsdelf.h
Index: config/i386/nbsdelf.mt
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/nbsdelf.mt,v
retrieving revision 1.2
diff -c -r1.2 nbsdelf.mt
*** nbsdelf.mt	2000/11/09 22:57:02	1.2
--- nbsdelf.mt	2001/01/22 20:03:17
***************
*** 1,5 ****
  # Target: Intel 386 running NetBSD
! TDEPFILES= i386-tdep.o i387-tdep.o solib.o solib-svr4.o
  TM_FILE= tm-nbsdelf.h
  
  GDBSERVER_DEPFILES= low-nbsd.o
--- 1,5 ----
  # Target: Intel 386 running NetBSD
! TDEPFILES= i386-tdep.o i387-tdep.o
  TM_FILE= tm-nbsdelf.h
  
  GDBSERVER_DEPFILES= low-nbsd.o
Index: config/m68k/nbsd.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/m68k/nbsd.mh,v
retrieving revision 1.5
diff -c -r1.5 nbsd.mh
*** nbsd.mh	2000/11/09 22:57:02	1.5
--- nbsd.mh	2001/01/22 20:03:17
***************
*** 1,5 ****
  # Host: Motorola m68k running NetBSD
  XDEPFILES=
! NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o m68knbsd-nat.o
  XM_FILE= xm-nbsd.h
  NAT_FILE= nm-nbsd.h
--- 1,5 ----
  # Host: Motorola m68k running NetBSD
  XDEPFILES=
! NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o m68knbsd-nat.o solib.o solib-svr4.o
  XM_FILE= xm-nbsd.h
  NAT_FILE= nm-nbsd.h
Index: config/m68k/nbsd.mt
===================================================================
RCS file: /cvs/src/src/gdb/config/m68k/nbsd.mt,v
retrieving revision 1.5
diff -c -r1.5 nbsd.mt
*** nbsd.mt	2001/01/17 23:07:15	1.5
--- nbsd.mt	2001/01/22 20:03:17
***************
*** 1,5 ****
  # Target: Motorola m68k running NetBSD
! TDEPFILES= m68k-tdep.o m68knbsd-tdep.o solib.o solib-svr4.o
  TM_FILE= tm-nbsd.h
  
  GDBSERVER_DEPFILES= low-nbsd.o
--- 1,5 ----
  # Target: Motorola m68k running NetBSD
! TDEPFILES= m68k-tdep.o m68knbsd-tdep.o
  TM_FILE= tm-nbsd.h
  
  GDBSERVER_DEPFILES= low-nbsd.o
Index: config/ns32k/nbsd.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/ns32k/nbsd.mh,v
retrieving revision 1.5
diff -c -r1.5 nbsd.mh
*** nbsd.mh	2000/11/09 22:57:02	1.5
--- nbsd.mh	2001/01/22 20:03:17
***************
*** 1,5 ****
  # Host: PC532 running NetBSD
  XDEPFILES=
! NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o ns32knbsd-nat.o
  XM_FILE= xm-nbsd.h
  NAT_FILE= nm-nbsd.h
--- 1,5 ----
  # Host: PC532 running NetBSD
  XDEPFILES=
! NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o ns32knbsd-nat.o solib.o solib-svr4.o
  XM_FILE= xm-nbsd.h
  NAT_FILE= nm-nbsd.h
Index: config/ns32k/nbsd.mt
===================================================================
RCS file: /cvs/src/src/gdb/config/ns32k/nbsd.mt,v
retrieving revision 1.4
diff -c -r1.4 nbsd.mt
*** nbsd.mt	2000/12/08 19:46:07	1.4
--- nbsd.mt	2001/01/22 20:03:17
***************
*** 1,5 ****
  # Target: PC532 running NetBSD
! TDEPFILES= ns32k-tdep.o solib.o solib-svr4.o
  TM_FILE= tm-nbsd.h
  
  GDBSERVER_DEPFILES= low-nbsd.o
--- 1,5 ----
  # Target: PC532 running NetBSD
! TDEPFILES= ns32k-tdep.o
  TM_FILE= tm-nbsd.h
  
  GDBSERVER_DEPFILES= low-nbsd.o
Index: config/ns32k/tm-umax.h
===================================================================
RCS file: /cvs/src/src/gdb/config/ns32k/tm-umax.h,v
retrieving revision 1.2
diff -c -r1.2 tm-umax.h
*** tm-umax.h	2000/05/28 01:12:37	1.2
--- tm-umax.h	2001/01/22 20:03:18
***************
*** 222,227 ****
--- 222,233 ----
  
  extern CORE_ADDR ns32k_get_enter_addr ();
  
+ /* Return number of args passed to a frame.
+    Can return -1, meaning no way to tell.  */
+ 
+ extern int umax_frame_num_args (struct frame_info *fi);
+ #define FRAME_NUM_ARGS(fi) (umax_frame_num_args ((fi)))
+ 
  /* Return number of bytes at start of arglist that are not really args.  */
  
  #define FRAME_ARGS_SKIP 8
***************
*** 232,239 ****
     ways in the stack frame.  sp is even more special:
     the address we return for it IS the sp for the next frame.  */
  
! extern int umax_frame_num_args (struct frame_info *fi);
! #define FRAME_NUM_ARGS(fi) (umax_frame_num_args ((fi)))
  
  /* Things needed for making the inferior call functions.  */
  
--- 238,272 ----
     ways in the stack frame.  sp is even more special:
     the address we return for it IS the sp for the next frame.  */
  
! #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs)	\
! { 								\
!   register int	regmask, regnum;				\
!   int		localcount;					\
!   register CORE_ADDR	enter_addr;				\
!   register CORE_ADDR	next_addr;				\
! 								\
!   memset (&(frame_saved_regs), '\0', sizeof (frame_saved_regs));	\
!   enter_addr = ns32k_get_enter_addr ((frame_info)->pc);		\
!   if (enter_addr > 1)						\
!     {								\
!       regmask = read_memory_integer (enter_addr+1, 1) & 0xff;	\
!       localcount = ns32k_localcount (enter_addr);		\
!       next_addr = (frame_info)->frame + localcount;		\
!       for (regnum = 0; regnum < 8; regnum++, regmask >>= 1)	\
! 	(frame_saved_regs).regs[regnum] = (regmask & 1) ?	\
! 					  (next_addr -= 4) : 0;	\
!       (frame_saved_regs).regs[SP_REGNUM] = (frame_info)->frame + 4;\
!       (frame_saved_regs).regs[PC_REGNUM] = (frame_info)->frame + 4;\
!       (frame_saved_regs).regs[FP_REGNUM] =			\
! 		  (read_memory_integer ((frame_info)->frame, 4));\
!     }								\
!   else if (enter_addr == 1)					\
!     {								\
!       CORE_ADDR sp = read_register (SP_REGNUM);			\
!       (frame_saved_regs).regs[PC_REGNUM] = sp;			\
!       (frame_saved_regs).regs[SP_REGNUM] = sp + 4;		\
!     }								\
! }
  
  /* Things needed for making the inferior call functions.  */
  
Index: config/powerpc/nbsd.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/powerpc/nbsd.mh,v
retrieving revision 1.4
diff -c -r1.4 nbsd.mh
*** nbsd.mh	2000/11/09 22:57:03	1.4
--- nbsd.mh	2001/01/22 20:03:18
***************
*** 1,5 ****
  # Host: PowerPC, running NetBSD
  XDEPFILES=
! NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o ppcnbsd-nat.o
  XM_FILE= xm-nbsd.h
  NAT_FILE= nm-nbsd.h
--- 1,5 ----
  # Host: PowerPC, running NetBSD
  XDEPFILES=
! NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o ppcnbsd-nat.o solib.o solib-svr4.o
  XM_FILE= xm-nbsd.h
  NAT_FILE= nm-nbsd.h
Index: config/powerpc/nbsd.mt
===================================================================
RCS file: /cvs/src/src/gdb/config/powerpc/nbsd.mt,v
retrieving revision 1.4
diff -c -r1.4 nbsd.mt
*** nbsd.mt	2000/11/09 22:57:03	1.4
--- nbsd.mt	2001/01/22 20:03:18
***************
*** 1,5 ****
  # Target: PowerPC, running NetBSD
! TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o solib.o solib-svr4.o
  TM_FILE= tm-nbsd.h
  
  GDBSERVER_DEPFILES= low-nbsd.o
--- 1,5 ----
  # Target: PowerPC, running NetBSD
! TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o
  TM_FILE= tm-nbsd.h
  
  GDBSERVER_DEPFILES= low-nbsd.o
Index: config/sparc/nbsd.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/nbsd.mh,v
retrieving revision 1.4
diff -c -r1.4 nbsd.mh
*** nbsd.mh	2000/11/09 22:57:03	1.4
--- nbsd.mh	2001/01/22 20:03:18
***************
*** 1,6 ****
  # Host: Sun 4 or Sparcstation, running NetBSD
  XDEPFILES=
  XM_FILE= xm-nbsd.h
  NAT_FILE= nm-nbsd.h
- NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o
  HOST_IPC=-DBSD_IPC
--- 1,6 ----
  # Host: Sun 4 or Sparcstation, running NetBSD
  XDEPFILES=
+ NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o solib.o solib-svr4.o
  XM_FILE= xm-nbsd.h
  NAT_FILE= nm-nbsd.h
  HOST_IPC=-DBSD_IPC
Index: config/sparc/nbsd.mt
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/nbsd.mt,v
retrieving revision 1.2
diff -c -r1.2 nbsd.mt
*** nbsd.mt	2000/11/09 22:57:03	1.2
--- nbsd.mt	2001/01/22 20:03:18
***************
*** 1,3 ****
  # Target: Sun 4 or Sparcstation, running NetBSD
! TDEPFILES= sparc-tdep.o solib.o solib-svr4.o
  TM_FILE= tm-nbsd.h
--- 1,3 ----
  # Target: Sun 4 or Sparcstation, running NetBSD
! TDEPFILES= sparc-tdep.o
  TM_FILE= tm-nbsd.h
Index: config/sparc/nbsdelf.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/nbsdelf.mh,v
retrieving revision 1.4
diff -c -r1.4 nbsdelf.mh
*** nbsdelf.mh	2000/11/09 22:57:03	1.4
--- nbsdelf.mh	2001/01/22 20:03:18
***************
*** 1,6 ****
  # Host: Sun 4 or Sparcstation, running NetBSD
  XDEPFILES=
  XM_FILE= xm-nbsd.h
  NAT_FILE= nm-nbsdelf.h
- NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o 
  HOST_IPC=-DBSD_IPC
--- 1,6 ----
  # Host: Sun 4 or Sparcstation, running NetBSD
  XDEPFILES=
+ NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o sparc-nat.o solib.o solib-svr4.o
  XM_FILE= xm-nbsd.h
  NAT_FILE= nm-nbsdelf.h
  HOST_IPC=-DBSD_IPC



-- 
J.T. Conklin
RedBack Networks


More information about the Gdb-patches mailing list