[PATCH] NetBSD signal trampoline fixes

Jason R Thorpe thorpej@wasabisystems.com
Sat Aug 31 13:53:00 GMT 2002


NetBSD recently switched to signal trampolines which are provided by
libc, not the kernel.  This patch updates most of the NetBSD targets
to reflect that (changes for the ones not addressed by this patch are
forthcoming -- some touch shared-by-other-targets code).

Committed to trunk.

	* Makefile.in (mipsnbsd-tdep.o): Add nbsd-tdep.h to dependency
	list.
	(nbsd-tdep.o): Add $(gdb_string_h) to dependency list.
	* alphanbsd-tdep.c (alphanbsd_pc_in_sigtramp): Use
	nbsd_pc_in_sigtramp.
	* mipsnbsd-tdep.c: Include nbsd-tdep.h.
	(mipsnbsd_pc_in_sigtramp): Use nbsd_pc_in_sigtramp.
	* nbsd-tdep.c: Include gdb_string.h.
	(nbsd_pc_in_sigtramp): New function.
	* nbsd-tdep.h (nbsd_pc_in_sigtramp): New prototype.
	* ppcnbsd-tdep.c (ppcnbsd_pc_in_sigtramp): New function.
	(ppcnbsd_init_abi): Set gdbarch_pc_in_sigtramp to
	ppcnbsd_pc_in_sigtramp.
	* shnbsd-tdep.c (shnbsd_pc_in_sigtramp): New function.
	(shnbsd_init_abi): Set gdbarch_pc_in_sigtramp to
	shnbsd_pc_in_sigtramp.
	* sparcnbsd-tdep.c (sparcnbsd_init_abi_elf): Set
	gdbarch_pc_in_sigtramp to nbsd_pc_in_sigtramp.
	* config/mips/nbsd.mt (TDEPFILES): Add nbsd-tdep.o.

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>
-------------- next part --------------
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.252
diff -c -r1.252 Makefile.in
*** Makefile.in	28 Aug 2002 14:02:18 -0000	1.252
--- Makefile.in	31 Aug 2002 20:24:28 -0000
***************
*** 1905,1911 ****
  mipsnbsd-nat.o: mipsnbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
  	$(mipsnbsd_tdep_h)
  mipsnbsd-tdep.o: mipsnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) \
! 	$(target_h) $(value_h) $(osabi_h) $(mipsnbsd_tdep_h) $(solib_svr4_h)
  mipsread.o: mipsread.c $(defs_h) $(gdb_string_h) $(bfd_h) $(symtab_h) \
  	$(symfile_h) $(objfiles_h) $(buildsym_h) $(stabsread_h) \
  	$(coff_sym_h) $(coff_internal_h) $(coff_ecoff_h) $(libcoff_h) \
--- 1905,1912 ----
  mipsnbsd-nat.o: mipsnbsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
  	$(mipsnbsd_tdep_h)
  mipsnbsd-tdep.o: mipsnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) \
! 	$(target_h) $(value_h) $(osabi_h) $(mipsnbsd_tdep_h) $(solib_svr4_h) \
! 	nbsd-tdep.h
  mipsread.o: mipsread.c $(defs_h) $(gdb_string_h) $(bfd_h) $(symtab_h) \
  	$(symfile_h) $(objfiles_h) $(buildsym_h) $(stabsread_h) \
  	$(coff_sym_h) $(coff_internal_h) $(coff_ecoff_h) $(libcoff_h) \
***************
*** 1924,1930 ****
  monitor.o: monitor.c $(defs_h) $(gdbcore_h) $(target_h) $(gdb_string_h) \
  	$(command_h) $(serial_h) $(monitor_h) $(gdbcmd_h) $(inferior_h) \
  	$(gdb_regex_h) $(srec_h) $(regcache_h)
! nbsd-tdep.o: nbsd-tdep.c $(defs_h) $(solib_svr4_h)
  nindy-tdep.o: nindy-tdep.c $(defs_h) $(symtab_h) $(frame_h) $(gdbcore_h)
  nlmread.o: nlmread.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_h) \
  	$(objfiles_h) $(buildsym_h) $(stabsread_h)
--- 1925,1931 ----
  monitor.o: monitor.c $(defs_h) $(gdbcore_h) $(target_h) $(gdb_string_h) \
  	$(command_h) $(serial_h) $(monitor_h) $(gdbcmd_h) $(inferior_h) \
  	$(gdb_regex_h) $(srec_h) $(regcache_h)
! nbsd-tdep.o: nbsd-tdep.c $(defs_h) $(gdb_string_h) $(solib_svr4_h)
  nindy-tdep.o: nindy-tdep.c $(defs_h) $(symtab_h) $(frame_h) $(gdbcore_h)
  nlmread.o: nlmread.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_h) \
  	$(objfiles_h) $(buildsym_h) $(stabsread_h)
Index: alphanbsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/alphanbsd-tdep.c,v
retrieving revision 1.8
diff -c -r1.8 alphanbsd-tdep.c
*** alphanbsd-tdep.c	22 May 2002 04:30:46 -0000	1.8
--- alphanbsd-tdep.c	31 Aug 2002 20:24:28 -0000
***************
*** 178,184 ****
  static int
  alphanbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name)
  {
!   return (alphanbsd_sigtramp_offset (pc) >= 0);
  }
  
  static void
--- 178,185 ----
  static int
  alphanbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name)
  {
!   return (nbsd_pc_in_sigtramp (pc, func_name)
! 	  || alphanbsd_sigtramp_offset (pc) >= 0);
  }
  
  static void
Index: mipsnbsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mipsnbsd-tdep.c,v
retrieving revision 1.1
diff -c -r1.1 mipsnbsd-tdep.c
*** mipsnbsd-tdep.c	21 May 2002 15:58:41 -0000	1.1
--- mipsnbsd-tdep.c	31 Aug 2002 20:24:30 -0000
***************
*** 26,31 ****
--- 26,32 ----
  #include "value.h"
  #include "osabi.h"
  
+ #include "nbsd-tdep.h"
  #include "mipsnbsd-tdep.h"
  
  #include "solib-svr4.h"
***************
*** 219,225 ****
  static int
  mipsnbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name)
  {
!   return (mipsnbsd_sigtramp_offset (pc) >= 0);
  }
  
  /* Figure out where the longjmp will land.  We expect that we have
--- 220,227 ----
  static int
  mipsnbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name)
  {
!   return (nbsd_pc_in_sigtramp (pc, func_name)
! 	  || mipsnbsd_sigtramp_offset (pc) >= 0);
  }
  
  /* Figure out where the longjmp will land.  We expect that we have
Index: nbsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/nbsd-tdep.c,v
retrieving revision 1.2
diff -c -r1.2 nbsd-tdep.c
*** nbsd-tdep.c	11 May 2002 22:21:26 -0000	1.2
--- nbsd-tdep.c	31 Aug 2002 20:24:30 -0000
***************
*** 20,25 ****
--- 20,26 ----
     Boston, MA 02111-1307, USA.  */
  
  #include "defs.h"
+ #include "gdb_string.h"
  #include "solib-svr4.h"
  
  /* Fetch (and possibly build) an appropriate link_map_offsets
***************
*** 95,98 ****
--- 96,109 ----
      }
  
    return lmp;
+ }
+ 
+ int
+ nbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name)
+ {
+   /* Check for libc-provided signal trampoline.  All such trampolines
+      have function names which begin with "__sigtramp".  */
+ 
+   return (func_name != NULL
+ 	  && strncmp (func_name, "__sigtramp", 10) == 0);
  }
Index: nbsd-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/nbsd-tdep.h,v
retrieving revision 1.1
diff -c -r1.1 nbsd-tdep.h
*** nbsd-tdep.h	11 May 2002 22:14:19 -0000	1.1
--- nbsd-tdep.h	31 Aug 2002 20:24:30 -0000
***************
*** 25,28 ****
--- 25,30 ----
  struct link_map_offsets *nbsd_ilp32_solib_svr4_fetch_link_map_offsets (void);
  struct link_map_offsets *nbsd_lp64_solib_svr4_fetch_link_map_offsets (void);
  
+ int nbsd_pc_in_sigtramp (CORE_ADDR, char *);
+ 
  #endif /* NBSD_TDEP_H */
Index: ppcnbsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ppcnbsd-tdep.c,v
retrieving revision 1.3
diff -c -r1.3 ppcnbsd-tdep.c
*** ppcnbsd-tdep.c	28 Jun 2002 22:07:20 -0000	1.3
--- ppcnbsd-tdep.c	31 Aug 2002 20:24:31 -0000
***************
*** 196,207 ****
--- 196,216 ----
    NULL					/* next */
  };
  
+ static int
+ ppcnbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name)
+ {
+   /* FIXME: Need to add support for kernel-provided signal trampolines.  */
+   return (nbsd_pc_in_sigtramp (pc, func_name));
+ }
+ 
  static void
  ppcnbsd_init_abi (struct gdbarch_info info,
                    struct gdbarch *gdbarch)
  {
    /* Stop at main.  */
    set_gdbarch_frame_chain_valid (gdbarch, generic_func_frame_chain_valid);
+ 
+   set_gdbarch_pc_in_sigtramp (gdbarch, ppcnbsd_pc_in_sigtramp);
  
    set_solib_svr4_fetch_link_map_offsets (gdbarch,
                                  nbsd_ilp32_solib_svr4_fetch_link_map_offsets);
Index: shnbsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/shnbsd-tdep.c,v
retrieving revision 1.6
diff -c -r1.6 shnbsd-tdep.c
*** shnbsd-tdep.c	22 May 2002 04:15:36 -0000	1.6
--- shnbsd-tdep.c	31 Aug 2002 20:24:31 -0000
***************
*** 165,174 ****
--- 165,183 ----
    NULL					/* next */
  };
  
+ static int
+ shnbsd_pc_in_sigtramp (CORE_ADDR pc, char *func_name)
+ {
+   /* FIXME: Need to add support for kernel-provided signal trampolines.  */
+   return (nbsd_pc_in_sigtramp (pc, func_name));
+ }
+ 
  static void
  shnbsd_init_abi (struct gdbarch_info info,
                    struct gdbarch *gdbarch)
  {
+   set_gdbarch_pc_in_sigtramp (gdbarch, shnbsd_pc_in_sigtramp);
+ 
    set_solib_svr4_fetch_link_map_offsets (gdbarch,
  		                nbsd_ilp32_solib_svr4_fetch_link_map_offsets);
  }
Index: sparcnbsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparcnbsd-tdep.c,v
retrieving revision 1.1
diff -c -r1.1 sparcnbsd-tdep.c
*** sparcnbsd-tdep.c	31 May 2002 00:59:13 -0000	1.1
--- sparcnbsd-tdep.c	31 Aug 2002 20:24:31 -0000
***************
*** 500,505 ****
--- 500,507 ----
  {
    sparcnbsd_init_abi_common (info, gdbarch);
  
+   set_gdbarch_pc_in_sigtramp (gdbarch, nbsd_pc_in_sigtramp);
+ 
    set_solib_svr4_fetch_link_map_offsets (gdbarch,
  				         gdbarch_ptr_bit (gdbarch) == 32 ?
                                  nbsd_ilp32_solib_svr4_fetch_link_map_offsets :
Index: config/mips/nbsd.mt
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/nbsd.mt,v
retrieving revision 1.1
diff -c -r1.1 nbsd.mt
*** config/mips/nbsd.mt	21 May 2002 15:58:41 -0000	1.1
--- config/mips/nbsd.mt	31 Aug 2002 20:24:32 -0000
***************
*** 1,5 ****
  # Target: MIPS running NetBSD
! TDEPFILES= mips-tdep.o mipsnbsd-tdep.o corelow.o solib.o solib-svr4.o
  TM_FILE= tm-nbsd.h
  
  SIM_OBS = remote-sim.o
--- 1,6 ----
  # Target: MIPS running NetBSD
! TDEPFILES= mips-tdep.o mipsnbsd-tdep.o corelow.o solib.o solib-svr4.o \
! 	nbsd-tdep.o
  TM_FILE= tm-nbsd.h
  
  SIM_OBS = remote-sim.o


More information about the Gdb-patches mailing list