]> Git Repo - binutils.git/blobdiff - gdb/arm-tdep.c
Add startswith function and use it instead of CONST_STRNEQ.
[binutils.git] / gdb / arm-tdep.c
index 9e4cf07aff874d33171193f55911a76936ff0aeb..23540092e77f12dc5d8196a4f8e4706bf21755df 100644 (file)
 
 static bool arm_debug;
 
+/* Print an "arm" debug statement.  */
+
+#define arm_debug_printf(fmt, ...) \
+  debug_prefixed_printf_cond (arm_debug, "arm", fmt, ##__VA_ARGS__)
+
 /* Macros for setting and testing a bit in a minimal symbol that marks
    it as Thumb function.  The MSB of the minimal symbol's "info" field
    is used for this purpose.
@@ -1122,9 +1127,8 @@ thumb_analyze_prologue (struct gdbarch *gdbarch,
       start += 2;
     }
 
-  if (arm_debug)
-    fprintf_unfiltered (gdb_stdlog, "Prologue scan stopped at %s\n",
-                       paddress (gdbarch, start));
+  arm_debug_printf ("Prologue scan stopped at %s",
+                   paddress (gdbarch, start));
 
   if (unrecognized_pc == 0)
     unrecognized_pc = start;
@@ -1782,9 +1786,8 @@ arm_analyze_prologue (struct gdbarch *gdbarch,
          cache->saved_regs[regno].set_addr (offset);
     }
 
-  if (arm_debug)
-    fprintf_unfiltered (gdb_stdlog, "Prologue scan stopped at %s\n",
-                       paddress (gdbarch, unrecognized_pc));
+  arm_debug_printf ("Prologue scan stopped at %s",
+                   paddress (gdbarch, unrecognized_pc));
 
   return unrecognized_pc;
 }
@@ -1906,7 +1909,7 @@ arm_make_prologue_cache (struct frame_info *this_frame)
   /* Calculate actual addresses of saved registers using offsets
      determined by arm_scan_prologue.  */
   for (reg = 0; reg < gdbarch_num_regs (get_frame_arch (this_frame)); reg++)
-    if (trad_frame_addr_p (cache->saved_regs, reg))
+    if (cache->saved_regs[reg].is_addr ())
       cache->saved_regs[reg].set_addr (cache->saved_regs[reg].addr ()
                                       + cache->prev_sp);
 
@@ -2024,7 +2027,7 @@ arm_prologue_prev_register (struct frame_info *this_frame,
                                       prev_regnum);
 }
 
-struct frame_unwind arm_prologue_unwind = {
+static frame_unwind arm_prologue_unwind = {
   NORMAL_FRAME,
   arm_prologue_unwind_stop_reason,
   arm_prologue_this_id,
@@ -2366,7 +2369,7 @@ arm_exidx_fill_cache (struct frame_info *this_frame, gdb_byte *entry)
         actual value in the current frame.  */
       if (!vsp_valid)
        {
-         if (trad_frame_realreg_p (cache->saved_regs, ARM_SP_REGNUM))
+         if (cache->saved_regs[ARM_SP_REGNUM].is_realreg ())
            {
              int reg = cache->saved_regs[ARM_SP_REGNUM].realreg ();
              vsp = get_frame_register_unsigned (this_frame, reg);
@@ -2452,7 +2455,7 @@ arm_exidx_fill_cache (struct frame_info *this_frame, gdb_byte *entry)
        {
          /* We could only have updated PC by popping into it; if so, it
             will show up as address.  Otherwise, copy LR into PC.  */
-         if (!trad_frame_addr_p (cache->saved_regs, ARM_PC_REGNUM))
+         if (!cache->saved_regs[ARM_PC_REGNUM].is_addr ())
            cache->saved_regs[ARM_PC_REGNUM]
              = cache->saved_regs[ARM_LR_REGNUM];
 
@@ -2623,7 +2626,7 @@ arm_exidx_fill_cache (struct frame_info *this_frame, gdb_byte *entry)
 
   /* If we restore SP from a register, assume this was the frame register.
      Otherwise just fall back to SP as frame register.  */
-  if (trad_frame_realreg_p (cache->saved_regs, ARM_SP_REGNUM))
+  if (cache->saved_regs[ARM_SP_REGNUM].is_realreg ())
     cache->framereg = cache->saved_regs[ARM_SP_REGNUM].realreg ();
   else
     cache->framereg = ARM_SP_REGNUM;
@@ -2760,7 +2763,7 @@ arm_make_epilogue_frame_cache (struct frame_info *this_frame)
   /* Calculate actual addresses of saved registers using offsets
      determined by arm_scan_prologue.  */
   for (reg = 0; reg < gdbarch_num_regs (get_frame_arch (this_frame)); reg++)
-    if (trad_frame_addr_p (cache->saved_regs, reg))
+    if (cache->saved_regs[reg].is_addr ())
       cache->saved_regs[reg].set_addr (cache->saved_regs[reg].addr ()
                                       + cache->prev_sp);
 
@@ -3789,10 +3792,10 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
      passing register.  */
   if (return_method == return_method_struct)
     {
-      if (arm_debug)
-       fprintf_unfiltered (gdb_stdlog, "struct return in %s = %s\n",
-                           gdbarch_register_name (gdbarch, argreg),
-                           paddress (gdbarch, struct_addr));
+      arm_debug_printf ("struct return in %s = %s",
+                       gdbarch_register_name (gdbarch, argreg),
+                       paddress (gdbarch, struct_addr));
+
       regcache_cooked_write_unsigned (regcache, argreg, struct_addr);
       argreg++;
     }
@@ -3938,12 +3941,11 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
                 register.  */
              if (byte_order == BFD_ENDIAN_BIG)
                regval <<= (ARM_INT_REGISTER_SIZE - partial_len) * 8;
-             if (arm_debug)
-               fprintf_unfiltered (gdb_stdlog, "arg %d in %s = 0x%s\n",
-                                   argnum,
-                                   gdbarch_register_name
-                                     (gdbarch, argreg),
-                                   phex (regval, ARM_INT_REGISTER_SIZE));
+
+             arm_debug_printf ("arg %d in %s = 0x%s", argnum,
+                               gdbarch_register_name (gdbarch, argreg),
+                               phex (regval, ARM_INT_REGISTER_SIZE));
+
              regcache_cooked_write_unsigned (regcache, argreg, regval);
              argreg++;
            }
@@ -3955,9 +3957,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
              store_unsigned_integer (buf, partial_len, byte_order, regval);
 
              /* Push the arguments onto the stack.  */
-             if (arm_debug)
-               fprintf_unfiltered (gdb_stdlog, "arg %d @ sp + %d\n",
-                                   argnum, nstack);
+             arm_debug_printf ("arg %d @ sp + %d", argnum, nstack);
              si = push_stack_item (si, buf, ARM_INT_REGISTER_SIZE);
              nstack += ARM_INT_REGISTER_SIZE;
            }
@@ -8535,7 +8535,7 @@ show_disassembly_style_sfunc (struct ui_file *file, int from_tty,
   const char *opt;
 
   FOR_EACH_DISASSEMBLER_OPTION (opt, options)
-    if (CONST_STRNEQ (opt, "reg-names-"))
+    if (startswith (opt, "reg-names-"))
       {
        style = &opt[strlen ("reg-names-")];
        len = strcspn (style, ",");
@@ -9575,14 +9575,14 @@ _initialize_arm_tdep ()
     = &disassembler_options_arm ()->options;
   int num_disassembly_styles = 0;
   for (i = 0; disasm_options->name[i] != NULL; i++)
-    if (CONST_STRNEQ (disasm_options->name[i], "reg-names-"))
+    if (startswith (disasm_options->name[i], "reg-names-"))
       num_disassembly_styles++;
 
   /* Initialize the array that will be passed to add_setshow_enum_cmd().  */
   valid_disassembly_styles = XNEWVEC (const char *,
                                      num_disassembly_styles + 1);
   for (i = j = 0; disasm_options->name[i] != NULL; i++)
-    if (CONST_STRNEQ (disasm_options->name[i], "reg-names-"))
+    if (startswith (disasm_options->name[i], "reg-names-"))
       {
        size_t offset = strlen ("reg-names-");
        const char *style = disasm_options->name[i];
This page took 0.031606 seconds and 4 git commands to generate.