Patchwork [v2,10/11] s390: Add comments to uncommented functions in s390-tdep.c

login
register
mail settings
Submitter Philipp Rudo
Date Dec. 5, 2017, 12:28 p.m.
Message ID <20171205122859.2919-11-prudo@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/24734/
State New
Headers show

Comments

Philipp Rudo - Dec. 5, 2017, 12:28 p.m.
Moving common functions from s390-linux-tdep to s390-tdep showed that some
of them are lacking a description.  Fix that now.

gdb/ChangeLog:
	* s390-tdep.c: Add comments to uncommented functions
---
 gdb/s390-tdep.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 56 insertions(+), 2 deletions(-)

Patch

diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index 0961c5d8c7..8b05dfc130 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -79,7 +79,9 @@  s390_readinstruction (bfd_byte instr[], CORE_ADDR at)
    come first, even though they're sometimes scattered around the
    instructions.  And displacements appear before base and extension
    registers, as they do in the assembly syntax, not at the end, as
-   they do in the machine language.  */
+   they do in the machine language.
+
+   Test for RI instruction format.  */
 
 static int
 is_ri (bfd_byte *insn, int op1, int op2, unsigned int *r1, int *i2)
@@ -95,6 +97,8 @@  is_ri (bfd_byte *insn, int op1, int op2, unsigned int *r1, int *i2)
     return 0;
 }
 
+/* Test for RIL instruction format.  See comment on is_ri for details.  */
+
 static int
 is_ril (bfd_byte *insn, int op1, int op2,
 	unsigned int *r1, int *i2)
@@ -115,6 +119,8 @@  is_ril (bfd_byte *insn, int op1, int op2,
     return 0;
 }
 
+/* Test for RR instruction format.  See comment on is_ri for details.  */
+
 static int
 is_rr (bfd_byte *insn, int op, unsigned int *r1, unsigned int *r2)
 {
@@ -128,6 +134,8 @@  is_rr (bfd_byte *insn, int op, unsigned int *r1, unsigned int *r2)
     return 0;
 }
 
+/* Test for RRE instruction format.  See comment on is_ri for details.  */
+
 static int
 is_rre (bfd_byte *insn, int op, unsigned int *r1, unsigned int *r2)
 {
@@ -142,6 +150,8 @@  is_rre (bfd_byte *insn, int op, unsigned int *r1, unsigned int *r2)
     return 0;
 }
 
+/* Test for RS instruction format.  See comment on is_ri for details.  */
+
 static int
 is_rs (bfd_byte *insn, int op,
        unsigned int *r1, unsigned int *r3, int *d2, unsigned int *b2)
@@ -158,6 +168,8 @@  is_rs (bfd_byte *insn, int op,
     return 0;
 }
 
+/* Test for RSY instruction format.  See comment on is_ri for details.  */
+
 static int
 is_rsy (bfd_byte *insn, int op1, int op2,
 	unsigned int *r1, unsigned int *r3, int *d2, unsigned int *b2)
@@ -177,6 +189,8 @@  is_rsy (bfd_byte *insn, int op1, int op2,
     return 0;
 }
 
+/* Test for RX instruction format.  See comment on is_ri for details.  */
+
 static int
 is_rx (bfd_byte *insn, int op,
        unsigned int *r1, int *d2, unsigned int *x2, unsigned int *b2)
@@ -193,6 +207,8 @@  is_rx (bfd_byte *insn, int op,
     return 0;
 }
 
+/* Test for RXY instruction format.  See comment on is_ri for details.  */
+
 static int
 is_rxy (bfd_byte *insn, int op1, int op2,
 	unsigned int *r1, int *d2, unsigned int *x2, unsigned int *b2)
@@ -526,6 +542,8 @@  s390_displaced_step_fixup (struct gdbarch *gdbarch,
 			paddress (gdbarch, regcache_read_pc (regs)));
 }
 
+/* Implement displaced_step_hw_singlestep gdbarch method.  */
+
 static int
 s390_displaced_step_hw_singlestep (struct gdbarch *gdbarch,
 				   struct displaced_step_closure *closure)
@@ -1088,6 +1106,9 @@  s390_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
 
 /* Pseudo registers.  */
 
+/* Check whether REGNUM indicates a coupled general purpose register.
+   These pseudo-registers are composed of two adjacent gprs.  */
+
 static int
 regnum_is_gpr_full (struct gdbarch_tdep *tdep, int regnum)
 {
@@ -1129,6 +1150,8 @@  s390_value_from_register (struct gdbarch *gdbarch, struct type *type,
   return value;
 }
 
+/* Implement pseudo_register_name tdesc method.  */
+
 static const char *
 s390_pseudo_register_name (struct gdbarch *gdbarch, int regnum)
 {
@@ -1161,6 +1184,8 @@  s390_pseudo_register_name (struct gdbarch *gdbarch, int regnum)
   internal_error (__FILE__, __LINE__, _("invalid regnum"));
 }
 
+/* Implement pseudo_register_type tdesc method.  */
+
 static struct type *
 s390_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
 {
@@ -1181,6 +1206,8 @@  s390_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
   internal_error (__FILE__, __LINE__, _("invalid regnum"));
 }
 
+/* Implement pseudo_register_read gdbarch method.  */
+
 static enum register_status
 s390_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
 			   int regnum, gdb_byte *buf)
@@ -1255,6 +1282,8 @@  s390_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
   internal_error (__FILE__, __LINE__, _("invalid regnum"));
 }
 
+/* Implement pseudo_register_write gdbarch method.  */
+
 static void
 s390_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
 			    int regnum, const gdb_byte *buf)
@@ -1312,6 +1341,8 @@  s390_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
 
 /* Register groups.  */
 
+/* Implement pseudo_register_reggroup_p tdesc method.  */
+
 static int
 s390_pseudo_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
 				 struct reggroup *group)
@@ -1435,12 +1466,18 @@  s390_gen_return_address (struct gdbarch *gdbarch,
 
 /* Address handling.  */
 
+/* Implement addr_bits_remove gdbarch method.
+   Only used for ABI_LINUX_S390.  */
+
 static CORE_ADDR
 s390_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr)
 {
   return addr & 0x7fffffff;
 }
 
+/* Implement addr_class_type_flags gdbarch method.
+   Only used for ABI_LINUX_ZSERIES.  */
+
 static int
 s390_address_class_type_flags (int byte_size, int dwarf2_addr_class)
 {
@@ -1450,6 +1487,9 @@  s390_address_class_type_flags (int byte_size, int dwarf2_addr_class)
     return 0;
 }
 
+/* Implement addr_class_type_flags_to_name gdbarch method.
+   Only used for ABI_LINUX_ZSERIES.  */
+
 static const char *
 s390_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags)
 {
@@ -1459,6 +1499,9 @@  s390_address_class_type_flags_to_name (struct gdbarch *gdbarch, int type_flags)
     return NULL;
 }
 
+/* Implement addr_class_name_to_type_flags gdbarch method.
+   Only used for ABI_LINUX_ZSERIES.  */
+
 static int
 s390_address_class_name_to_type_flags (struct gdbarch *gdbarch,
 				       const char *name,
@@ -1842,6 +1885,8 @@  s390_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
 			 get_frame_pc (this_frame));
 }
 
+/* Implement frame_align gdbarch method.  */
+
 static CORE_ADDR
 s390_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr)
 {
@@ -1970,7 +2015,7 @@  s390_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
 {
   int word_size = gdbarch_ptr_bit (gdbarch) / 8;
 
-  /* In frameless functions, there's not frame to destroy and thus
+  /* In frameless functions, there's no frame to destroy and thus
      we don't care about the epilogue.
 
      In functions with frame, the epilogue sequence is a pair of
@@ -2014,6 +2059,8 @@  s390_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
   return 0;
 }
 
+/* Implement unwind_pc gdbarch method.  */
+
 static CORE_ADDR
 s390_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
@@ -2023,6 +2070,8 @@  s390_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
   return gdbarch_addr_bits_remove (gdbarch, pc);
 }
 
+/* Implement unwind_sp gdbarch method.  */
+
 static CORE_ADDR
 s390_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
@@ -2101,6 +2150,9 @@  s390_adjust_frame_regnum (struct gdbarch *gdbarch, int num, int eh_frame_p)
 
 /* DWARF-2 frame unwinding.  */
 
+/* Function to unwind a pseudo-register in dwarf2_frame unwinder.  Used by
+   s390_dwarf2_frame_init_reg.  */
+
 static struct value *
 s390_dwarf2_prev_register (struct frame_info *this_frame, void **this_cache,
 			   int regnum)
@@ -2108,6 +2160,8 @@  s390_dwarf2_prev_register (struct frame_info *this_frame, void **this_cache,
   return s390_unwind_pseudo_register (this_frame, regnum);
 }
 
+/* Implement init_reg dwarf2_frame method.  */
+
 static void
 s390_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
 			    struct dwarf2_frame_state_reg *reg,