Check for <sys/poll.h>.
[deliverable/binutils-gdb.git] / gdb / arm-tdep.c
index 24f54667f2cbe430cc5007694f1973ea2f1614c5..7cc53e0691cafefd5e76f13b7548ccabf4a3cddb 100644 (file)
 #include "symfile.h"
 #include "gdb_string.h"
 #include "coff/internal.h"     /* Internal format of COFF symbols in BFD */
+#include "dis-asm.h"           /* For register flavors. */
+#include <ctype.h>             /* for isupper () */
 
 extern void _initialize_arm_tdep (void);
 
-/* From opcodes/arm-dis.c */
-
-extern int get_arm_regname_num_options (void);
-
-extern int set_arm_regname_option (int option);
-
-extern int get_arm_regnames (int option, const char **setname,
-                            const char **setdescription,
-                            const char ***regnames);
-
 /* Number of different reg name sets (options). */
 static int num_flavor_options;
 
@@ -60,10 +52,10 @@ static char * arm_register_name_strings[] =
 char **arm_register_names = arm_register_name_strings;
 
 /* Valid register name flavors.  */
-static char **valid_flavors;
+static const char **valid_flavors;
 
 /* Disassembly flavor to use. Default to "std" register names. */
-static char *disassembly_flavor;
+static const char *disassembly_flavor;
 static int current_option;     /* Index to that option in the opcodes table. */
 
 /* This is used to keep the bfd arch_info in sync with the disassembly
@@ -336,7 +328,7 @@ arm_frameless_function_invocation (struct frame_info *fi)
    */
 
 static CORE_ADDR
-thumb_skip_prologue (CORE_ADDR pc)
+thumb_skip_prologue (CORE_ADDR pc, CORE_ADDR func_end)
 {
   CORE_ADDR current_pc;
   int findmask = 0;    /* findmask:
@@ -345,7 +337,7 @@ thumb_skip_prologue (CORE_ADDR pc)
                           bit 2 - sub sp, #simm  OR  add sp, #simm  (adjusting of sp)
                        */
 
-  for (current_pc = pc; current_pc < pc + 40; current_pc += 2)
+  for (current_pc = pc; current_pc + 2 < func_end && current_pc < pc + 40; current_pc += 2)
     {
       unsigned short insn = read_memory_unsigned_integer (current_pc, 2);
 
@@ -407,7 +399,7 @@ arm_skip_prologue (CORE_ADDR pc)
 
   /* Check if this is Thumb code.  */
   if (arm_pc_is_thumb (pc))
-    return thumb_skip_prologue (pc);
+    return thumb_skip_prologue (pc, func_end);
 
   /* Can't find the prologue end in the symbol table, try it the hard way
      by disassembling the instructions. */
@@ -2045,7 +2037,9 @@ _initialize_arm_tdep (void)
   struct ui_file *stb;
   long length;
   struct cmd_list_element *new_cmd;
-  const char *setname, *setdesc, **regnames;
+  const char *setname;
+  const char *setdesc;
+  const char **regnames;
   int numregs, i, j;
   static char *helptext;
 
@@ -2067,13 +2061,13 @@ The valid values are:\n");
   for (i = 0; i < num_flavor_options; i++)
     {
       numregs = get_arm_regnames (i, &setname, &setdesc, &regnames);
-      valid_flavors[i] = (char *) setname;
+      valid_flavors[i] = setname;
       fprintf_unfiltered (stb, "%s - %s\n", setname,
                          setdesc);
       /* Copy the default names (if found) and synchronize disassembler. */
       if (!strcmp (setname, "std"))
        {
-          disassembly_flavor = (char *) setname;
+          disassembly_flavor = setname;
           current_option = i;
          for (j = 0; j < numregs; j++)
             arm_register_names[j] = (char *) regnames[j];
@@ -2091,7 +2085,7 @@ The valid values are:\n");
   /* Add the disassembly-flavor command */
   new_cmd = add_set_enum_cmd ("disassembly-flavor", no_class,
                              valid_flavors,
-                             (char *) &disassembly_flavor,
+                             &disassembly_flavor,
                              helptext,
                              &setlist);
   new_cmd->function.sfunc = set_disassembly_flavor_sfunc;
This page took 0.024884 seconds and 4 git commands to generate.