* c-valprint.c (c_value_print): Fix up some formatting. Use
[deliverable/binutils-gdb.git] / gdb / arm-tdep.c
index 0d12630947f785d098026cd27cdc6cead42d6e79..fc7e8feef431c83b6ed98ca9cce4e85937efbbfb 100644 (file)
@@ -37,6 +37,8 @@
 #include "frame-unwind.h"
 #include "frame-base.h"
 #include "trad-frame.h"
+#include "objfiles.h"
+#include "dwarf2-frame.h"
 
 #include "arm-tdep.h"
 #include "gdb/sim-arm.h"
@@ -182,20 +184,6 @@ struct arm_prologue_cache
 
 int arm_apcs_32 = 1;
 
-/* Flag set by arm_fix_call_dummy that tells whether the target
-   function is a Thumb function.  This flag is checked by
-   arm_push_arguments.  FIXME: Change the PUSH_ARGUMENTS macro (and
-   its use in valops.c) to pass the function address as an additional
-   parameter.  */
-
-static int target_is_thumb;
-
-/* Flag set by arm_fix_call_dummy that tells whether the calling
-   function is a Thumb function.  This flag is checked by
-   arm_pc_is_thumb.  */
-
-static int caller_is_thumb;
-
 /* Determine if the program counter specified in MEMADDR is in a Thumb
    function.  */
 
@@ -220,27 +208,6 @@ arm_pc_is_thumb (CORE_ADDR memaddr)
     }
 }
 
-/* Determine if the program counter specified in MEMADDR is in a call
-   dummy being called from a Thumb function.  */
-
-int
-arm_pc_is_thumb_dummy (CORE_ADDR memaddr)
-{
-  CORE_ADDR sp = read_sp ();
-
-  /* FIXME: Until we switch for the new call dummy macros, this heuristic
-     is the best we can do.  We are trying to determine if the pc is on
-     the stack, which (hopefully) will only happen in a call dummy.
-     We hope the current stack pointer is not so far alway from the dummy
-     frame location (true if we have not pushed large data structures or
-     gone too many levels deep) and that our 1024 is not enough to consider
-     code regions as part of the stack (true for most practical purposes).  */
-  if (deprecated_pc_in_call_dummy (memaddr))
-    return caller_is_thumb;
-  else
-    return 0;
-}
-
 /* Remove useless bits from addresses in a running program.  */
 static CORE_ADDR
 arm_addr_bits_remove (CORE_ADDR val)
@@ -1013,6 +980,56 @@ arm_prologue_unwind_sniffer (struct frame_info *next_frame)
   return &arm_prologue_unwind;
 }
 
+static struct arm_prologue_cache *
+arm_make_stub_cache (struct frame_info *next_frame)
+{
+  int reg;
+  struct arm_prologue_cache *cache;
+  CORE_ADDR unwound_fp;
+
+  cache = frame_obstack_zalloc (sizeof (struct arm_prologue_cache));
+  cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
+
+  cache->prev_sp = frame_unwind_register_unsigned (next_frame, ARM_SP_REGNUM);
+
+  return cache;
+}
+
+/* Our frame ID for a stub frame is the current SP and LR.  */
+
+static void
+arm_stub_this_id (struct frame_info *next_frame,
+                 void **this_cache,
+                 struct frame_id *this_id)
+{
+  struct arm_prologue_cache *cache;
+
+  if (*this_cache == NULL)
+    *this_cache = arm_make_stub_cache (next_frame);
+  cache = *this_cache;
+
+  *this_id = frame_id_build (cache->prev_sp,
+                            frame_pc_unwind (next_frame));
+}
+
+struct frame_unwind arm_stub_unwind = {
+  NORMAL_FRAME,
+  arm_stub_this_id,
+  arm_prologue_prev_register
+};
+
+static const struct frame_unwind *
+arm_stub_unwind_sniffer (struct frame_info *next_frame)
+{
+  char dummy[4];
+
+  if (in_plt_section (frame_unwind_address_in_block (next_frame), NULL)
+      || target_read_memory (frame_pc_unwind (next_frame), dummy, 4) != 0)
+    return &arm_stub_unwind;
+
+  return NULL;
+}
+
 static CORE_ADDR
 arm_normal_frame_base (struct frame_info *next_frame, void **this_cache)
 {
@@ -1964,7 +1981,7 @@ arm_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
 
-  if (arm_pc_is_thumb (*pcptr) || arm_pc_is_thumb_dummy (*pcptr))
+  if (arm_pc_is_thumb (*pcptr))
     {
       *pcptr = UNMAKE_THUMB_ADDR (*pcptr);
       *lenptr = tdep->thumb_breakpoint_size;
@@ -2396,11 +2413,12 @@ set_fp_model_sfunc (char *args, int from_tty,
 }
 
 static void
-show_fp_model (char *args, int from_tty,
-              struct cmd_list_element *c)
+show_fp_model (struct ui_file *file, int from_tty,
+              struct cmd_list_element *c, const char *value)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
 
+  deprecated_show_value_hack (file, from_tty, c, value);
   if (arm_fp_model == ARM_FLOAT_AUTO 
       && gdbarch_bfd_arch_info (current_gdbarch)->arch == bfd_arch_arm)
     /* i18n: "the default [floating point model] for the current ABI..." */
@@ -2736,7 +2754,9 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   gdbarch_init_osabi (info, gdbarch);
 
   /* Add some default predicates.  */
+  frame_unwind_append_sniffer (gdbarch, arm_stub_unwind_sniffer);
   frame_unwind_append_sniffer (gdbarch, arm_sigtramp_unwind_sniffer);
+  frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
   frame_unwind_append_sniffer (gdbarch, arm_prologue_unwind_sniffer);
 
   /* Now we have tuned the configuration, set a few final things,
@@ -2847,7 +2867,8 @@ _initialize_arm_tdep (void)
   /* Sync the opcode insn printer with our register viewer.  */
   parse_arm_disassembler_option ("reg-names-std");
 
-  /* Initialize the array that will be passed to add_set_enum_cmd().  */
+  /* Initialize the array that will be passed to
+     add_setshow_enum_cmd().  */
   valid_disassembly_styles
     = xmalloc ((num_disassembly_options + 1) * sizeof (char *));
   for (i = 0; i < num_disassembly_options; i++)
@@ -2884,16 +2905,16 @@ _initialize_arm_tdep (void)
                       _("Set the disassembly style."),
                       _("Show the disassembly style."),
                       helptext,
-                      _("The disassembly style is \"%s\"."),
-                      set_disassembly_style_sfunc, NULL,
+                      set_disassembly_style_sfunc,
+                      NULL, /* FIXME: i18n: The disassembly style is \"%s\".  */
                       &setarmcmdlist, &showarmcmdlist);
 
   add_setshow_boolean_cmd ("apcs32", no_class, &arm_apcs_32,
                           _("Set usage of ARM 32-bit mode."),
                           _("Show usage of ARM 32-bit mode."),
                           _("When off, a 26-bit PC will be used."),
-                          _("Usage of ARM 32-bit mode is %s."),
-                          NULL, NULL,
+                          NULL,
+                          NULL, /* FIXME: i18n: Usage of ARM 32-bit mode is %s.  */
                           &setarmcmdlist, &showarmcmdlist);
 
   /* Add a command to allow the user to force the FPU model.  */
@@ -2905,7 +2926,6 @@ softfpa - Software FP, mixed-endian doubles on little-endian ARMs.\n\
 fpa - FPA co-processor (GCC compiled).\n\
 softvfp - Software FP with pure-endian doubles.\n\
 vfp - VFP co-processor."),
-                       _("The floating point type is \"%s\"."),
                        set_fp_model_sfunc, show_fp_model,
                        &setarmcmdlist, &showarmcmdlist);
 
@@ -2914,7 +2934,7 @@ vfp - VFP co-processor."),
                           _("Set ARM debugging."),
                           _("Show ARM debugging."),
                           _("When on, arm-specific debugging is enabled."),
-                          _("ARM debugging is %s."),
-                          NULL, NULL,
+                          NULL,
+                          NULL, /* FIXME: i18n: "ARM debugging is %s.  */
                           &setdebuglist, &showdebuglist);
 }
This page took 0.026211 seconds and 4 git commands to generate.