[RFC] Target vectors: s390

Ulrich Weigand uweigand@de.ibm.com
Fri Aug 19 22:27:00 GMT 2005


Hello,

this patch converts s390-nat.c to use linux_target () instead of
infptrace/inftarg.  There are no functional changes.

Tested on s390x-ibm-linux without regressions.

Bye,
Ulrich


ChangeLog:

	* Makefile.in (s390-nat.o): Depend on $(target_h) and $(linux_nat_h).
	* s390-nat.c: Include "target.h" and "linux-nat.h".
	(fetch_inferior_registers): Rename to s390_fetch_inferior_registers.
	(store_inferior_registers): Rename to s390_store_inferior_registers.
	(s390_fetch_inferior_registers, s390_fetch_inferior_registers,
	s390_stopped_by_watchpoint, s390_insert_watchpoint,
	s390_remove_watchpoint): Make static.
	(kernel_u_size): Remove.
	(s390_can_use_hw_breakpoint): New function.
	(s390_region_size_ok_for_hw_watchpoint): Likewise.
	(_initialize_s390_nat): Likewise.
	* config/s390/nm-linux.h (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE, 
	FETCH_INFERIOR_REGISTERS, KERNEL_U_SIZE, kernel_u_size, 
	s390_stopped_by_watchpoint, s390_insert_watchpoint,
	s390_remove_watchpoint, TARGET_CAN_USE_HARDWARE_WATCHPOINT,
	TARGET_REGION_OK_FOR_HW_WATCHPOINT, HAVE_CONTINUABLE_WATCHPOINT,
	STOPPED_BY_WATCHPOINT, target_insert_watchpoint,
	target_remove_watchpoint): Remove.
	(USE_LINUX_TARGET): Define.
	* config/s390/s390.mh (NATDEPFILES): Replace infptrace.o and
	inftarg.o by inf-ptrace.o.

Index: gdb/Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.742
diff -c -p -r1.742 Makefile.in
*** gdb/Makefile.in	8 Aug 2005 20:59:18 -0000	1.742
--- gdb/Makefile.in	18 Aug 2005 23:49:25 -0000
*************** rs6000-tdep.o: rs6000-tdep.c $(defs_h) $
*** 2471,2477 ****
  	$(ppc_tdep_h) $(gdb_assert_h) $(dis_asm_h) $(trad_frame_h) \
  	$(frame_unwind_h) $(frame_base_h) $(reggroups_h)
  s390-nat.o: s390-nat.c $(defs_h) $(tm_h) $(regcache_h) $(inferior_h) \
! 	$(s390_tdep_h)
  s390-tdep.o: s390-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) $(inferior_h) \
  	$(symtab_h) $(target_h) $(gdbcore_h) $(gdbcmd_h) $(objfiles_h) \
  	$(tm_h) $(__bfd_bfd_h) $(floatformat_h) $(regcache_h) \
--- 2471,2477 ----
  	$(ppc_tdep_h) $(gdb_assert_h) $(dis_asm_h) $(trad_frame_h) \
  	$(frame_unwind_h) $(frame_base_h) $(reggroups_h)
  s390-nat.o: s390-nat.c $(defs_h) $(tm_h) $(regcache_h) $(inferior_h) \
! 	$(target_h) $(linux_nat_h) $(s390_tdep_h)
  s390-tdep.o: s390-tdep.c $(defs_h) $(arch_utils_h) $(frame_h) $(inferior_h) \
  	$(symtab_h) $(target_h) $(gdbcore_h) $(gdbcmd_h) $(objfiles_h) \
  	$(tm_h) $(__bfd_bfd_h) $(floatformat_h) $(regcache_h) \
Index: gdb/s390-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/s390-nat.c,v
retrieving revision 1.13
diff -c -p -r1.13 s390-nat.c
*** gdb/s390-nat.c	11 Feb 2005 18:13:52 -0000	1.13
--- gdb/s390-nat.c	18 Aug 2005 23:49:26 -0000
***************
*** 25,30 ****
--- 25,32 ----
  #include "tm.h"
  #include "regcache.h"
  #include "inferior.h"
+ #include "target.h"
+ #include "linux-nat.h"
  
  #include "s390-tdep.h"
  
*************** store_fpregs (int tid, int regnum)
*** 200,207 ****
  
  /* Fetch register REGNUM from the child process.  If REGNUM is -1, do
     this for all registers.  */
! void
! fetch_inferior_registers (int regnum)
  {
    int tid = s390_inferior_tid ();
  
--- 202,209 ----
  
  /* Fetch register REGNUM from the child process.  If REGNUM is -1, do
     this for all registers.  */
! static void
! s390_fetch_inferior_registers (int regnum)
  {
    int tid = s390_inferior_tid ();
  
*************** fetch_inferior_registers (int regnum)
*** 216,223 ****
  
  /* Store register REGNUM back into the child process.  If REGNUM is
     -1, do this for all registers.  */
! void
! store_inferior_registers (int regnum)
  {
    int tid = s390_inferior_tid ();
  
--- 218,225 ----
  
  /* Store register REGNUM back into the child process.  If REGNUM is
     -1, do this for all registers.  */
! static void
! s390_store_inferior_registers (int regnum)
  {
    int tid = s390_inferior_tid ();
  
*************** struct watch_area
*** 248,254 ****
  
  static struct watch_area *watch_base = NULL;
  
! int
  s390_stopped_by_watchpoint (void)
  {
    per_lowcore_bits per_lowcore;
--- 250,256 ----
  
  static struct watch_area *watch_base = NULL;
  
! static int
  s390_stopped_by_watchpoint (void)
  {
    per_lowcore_bits per_lowcore;
*************** s390_fix_watch_points (void)
*** 308,315 ****
      perror_with_name (_("Couldn't modify watchpoint status"));
  }
  
! int
! s390_insert_watchpoint (CORE_ADDR addr, int len)
  {
    struct watch_area *area = xmalloc (sizeof (struct watch_area));
    if (!area)
--- 310,317 ----
      perror_with_name (_("Couldn't modify watchpoint status"));
  }
  
! static int
! s390_insert_watchpoint (CORE_ADDR addr, int len, int type)
  {
    struct watch_area *area = xmalloc (sizeof (struct watch_area));
    if (!area)
*************** s390_insert_watchpoint (CORE_ADDR addr, 
*** 325,332 ****
    return 0;
  }
  
! int
! s390_remove_watchpoint (CORE_ADDR addr, int len)
  {
    struct watch_area *area, **parea;
  
--- 327,334 ----
    return 0;
  }
  
! static int
! s390_remove_watchpoint (CORE_ADDR addr, int len, int type)
  {
    struct watch_area *area, **parea;
  
*************** s390_remove_watchpoint (CORE_ADDR addr, 
*** 350,359 ****
    return 0;
  }
  
  
! int
! kernel_u_size (void)
  {
!   return sizeof (struct user);
  }
  
--- 352,385 ----
    return 0;
  }
  
+ static int
+ s390_can_use_hw_breakpoint (int type, int cnt, int othertype)
+ {
+   return 1;
+ }
+ 
+ static int
+ s390_region_size_ok_for_hw_watchpoint (int cnt)
+ {
+   return 1;
+ }
+ 
+ extern initialize_file_ftype _initialize_s390_nat; /* -Wmissing-prototypes */
  
! void
! _initialize_s390_nat (void)
  {
!   struct target_ops *t = linux_target ();
!   t->to_fetch_registers = s390_fetch_inferior_registers;
!   t->to_store_registers = s390_store_inferior_registers;
! 
!   t->to_can_use_hw_breakpoint = s390_can_use_hw_breakpoint;
!   t->to_region_size_ok_for_hw_watchpoint = s390_region_size_ok_for_hw_watchpoint;
!   t->to_have_continuable_watchpoint = 1;
!   t->to_stopped_by_watchpoint = s390_stopped_by_watchpoint;
!   t->to_insert_watchpoint = s390_insert_watchpoint;
!   t->to_remove_watchpoint = s390_remove_watchpoint;
!   
!   add_target (t);
  }
  
Index: gdb/config/s390/nm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/s390/nm-linux.h,v
retrieving revision 1.11
diff -c -p -r1.11 nm-linux.h
*** gdb/config/s390/nm-linux.h	13 Sep 2004 14:06:04 -0000	1.11
--- gdb/config/s390/nm-linux.h	18 Aug 2005 23:49:26 -0000
***************
*** 25,62 ****
  #ifndef NM_LINUX_H
  #define NM_LINUX_H
  
  #include "config/nm-linux.h"
  
- 
- /* ptrace access.  */
- 
- #define PTRACE_ARG3_TYPE long
- #define PTRACE_XFER_TYPE long
- 
- #define FETCH_INFERIOR_REGISTERS
- 
- #define KERNEL_U_SIZE kernel_u_size()
- extern int kernel_u_size (void);
- 
- 
- /* Hardware watchpoints.  */
- 
- extern int s390_stopped_by_watchpoint (void);
- extern int s390_insert_watchpoint (CORE_ADDR addr, int len);
- extern int s390_remove_watchpoint (CORE_ADDR addr, int len);
- 
- #define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) 1
- #define TARGET_REGION_OK_FOR_HW_WATCHPOINT(addr, len) 1
- #define HAVE_CONTINUABLE_WATCHPOINT 1
- 
- #define STOPPED_BY_WATCHPOINT(w) \
-   s390_stopped_by_watchpoint ()
- 
- #define target_insert_watchpoint(addr, len, type) \
-   s390_insert_watchpoint (addr, len)
- 
- #define target_remove_watchpoint(addr, len, type) \
-   s390_remove_watchpoint (addr, len)
- 
- 
  #endif /* nm_linux.h */
--- 25,31 ----
  #ifndef NM_LINUX_H
  #define NM_LINUX_H
  
+ #define USE_LINUX_TARGET
  #include "config/nm-linux.h"
  
  #endif /* nm_linux.h */
Index: gdb/config/s390/s390.mh
===================================================================
RCS file: /cvs/src/src/gdb/config/s390/s390.mh,v
retrieving revision 1.12
diff -c -p -r1.12 s390.mh
*** gdb/config/s390/s390.mh	14 Nov 2004 18:47:52 -0000	1.12
--- gdb/config/s390/s390.mh	18 Aug 2005 23:49:26 -0000
***************
*** 1,5 ****
  # Host: S390, running Linux
  NAT_FILE= nm-linux.h
! NATDEPFILES= infptrace.o inftarg.o fork-child.o corelow.o s390-nat.o \
  	gcore.o linux-thread-db.o proc-service.o linux-nat.o
  LOADLIBES = -ldl -rdynamic
--- 1,5 ----
  # Host: S390, running Linux
  NAT_FILE= nm-linux.h
! NATDEPFILES= inf-ptrace.o fork-child.o corelow.o s390-nat.o \
  	gcore.o linux-thread-db.o proc-service.o linux-nat.o
  LOADLIBES = -ldl -rdynamic
-- 
  Dr. Ulrich Weigand
  Linux on zSeries Development
  Ulrich.Weigand@de.ibm.com



More information about the Gdb-patches mailing list