sim: parse_args: display getopt error ourselves
[deliverable/binutils-gdb.git] / sim / arm / wrapper.c
index b494354fcd3b2e9a82270e1f64271814f7190a7f..9e61ed6cfc656ad19dc816a9cf667ed3c12226c5 100644 (file)
@@ -1,5 +1,5 @@
 /* run front end support for arm
-   Copyright (C) 1995-2015 Free Software Foundation, Inc.
+   Copyright (C) 1995-2016 Free Software Foundation, Inc.
 
    This file is part of ARM SIM.
 
@@ -114,7 +114,7 @@ struct maverick_regs
     int i;
     float f;
   } upper;
-  
+
   union
   {
     int i;
@@ -140,7 +140,7 @@ init (void)
     {
       ARMul_EmulateInit ();
       state = ARMul_NewState ();
-      state->bigendSig = (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN ? HIGH : LOW);
+      state->bigendSig = (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? HIGH : LOW);
       ARMul_MemoryInit (state, mem_size);
       ARMul_OSInit (state);
       state->verbose = 0;
@@ -163,14 +163,6 @@ ARMul_ConsolePrint (ARMul_State * state,
     }
 }
 
-ARMword
-ARMul_Debug (ARMul_State * state ATTRIBUTE_UNUSED,
-            ARMword       pc    ATTRIBUTE_UNUSED,
-            ARMword       instr ATTRIBUTE_UNUSED)
-{
-  return 0;
-}
-
 int
 sim_write (SIM_DESC sd ATTRIBUTE_UNUSED,
           SIM_ADDR addr,
@@ -439,11 +431,8 @@ tomem (struct ARMul_State *state,
     }
 }
 
-int
-sim_store_register (SIM_DESC sd ATTRIBUTE_UNUSED,
-                   int rn,
-                   unsigned char *memory,
-                   int length)
+static int
+arm_reg_store (SIM_CPU *cpu, int rn, unsigned char *memory, int length)
 {
   init ();
 
@@ -547,11 +536,8 @@ sim_store_register (SIM_DESC sd ATTRIBUTE_UNUSED,
   return length;
 }
 
-int
-sim_fetch_register (SIM_DESC sd ATTRIBUTE_UNUSED,
-                   int rn,
-                   unsigned char *memory,
-                   int length)
+static int
+arm_reg_fetch (SIM_CPU *cpu, int rn, unsigned char *memory, int length)
 {
   ARMword regval;
   int len = length;
@@ -664,7 +650,7 @@ sim_fetch_register (SIM_DESC sd ATTRIBUTE_UNUSED,
       len -= 4;
       memory += 4;
       regval = 0;
-    }  
+    }
 
   return length;
 }
@@ -710,7 +696,7 @@ sim_target_parse_command_line (int argc, char ** argv)
          trace = 1;
          continue;
        }
-      
+
       if (strcmp (ptr, "-z") == 0)
        {
          /* Remove this option from the argv array.  */
@@ -721,7 +707,7 @@ sim_target_parse_command_line (int argc, char ** argv)
          trace_funcs = 1;
          continue;
        }
-      
+
       if (strcmp (ptr, "-d") == 0)
        {
          /* Remove this option from the argv array.  */
@@ -742,14 +728,14 @@ sim_target_parse_command_line (int argc, char ** argv)
          for (arg = i; arg < argc; arg ++)
            argv[arg] = argv[arg + 1];
          argc --;
-         
+
          ptr = argv[i];
        }
       else
        ptr += sizeof SWI_SWITCH;
 
       swi_mask = 0;
-      
+
       while (* ptr)
        {
          int i;
@@ -773,7 +759,7 @@ sim_target_parse_command_line (int argc, char ** argv)
 
       if (* ptr != 0)
        fprintf (stderr, "Ignoring swi options: %s\n", ptr);
-      
+
       /* Remove this option from the argv array.  */
       for (arg = i; arg < argc; arg ++)
        argv[arg] = argv[arg + 1];
@@ -786,12 +772,7 @@ sim_target_parse_command_line (int argc, char ** argv)
 static void
 sim_target_parse_arg_array (char ** argv)
 {
-  int i;
-
-  for (i = 0; argv[i]; i++)
-    ;
-
-  sim_target_parse_command_line (i, argv);
+  sim_target_parse_command_line (countargv (argv), argv);
 }
 
 static sim_cia
@@ -838,9 +819,7 @@ sim_open (SIM_OPEN_KIND kind,
       return 0;
     }
 
-  /* getopt will print the error message so we just have to exit if this fails.
-     FIXME: Hmmm...  in the case of gdb we need getopt to call
-     print_filtered.  */
+  /* The parser will print an error message for us, so we silently return.  */
   if (sim_parse_args (sd, argv) != SIM_RC_OK)
     {
       free_state (sd);
@@ -878,6 +857,8 @@ sim_open (SIM_OPEN_KIND kind,
     {
       SIM_CPU *cpu = STATE_CPU (sd, i);
 
+      CPU_REG_FETCH (cpu) = arm_reg_fetch;
+      CPU_REG_STORE (cpu) = arm_reg_store;
       CPU_PC_FETCH (cpu) = arm_pc_get;
       CPU_PC_STORE (cpu) = arm_pc_set;
     }
@@ -907,20 +888,12 @@ sim_open (SIM_OPEN_KIND kind,
                                               "Missing argument to -m option\n");
                return NULL;
              }
-             
          }
     }
 
   return sd;
 }
 
-void
-sim_close (SIM_DESC sd ATTRIBUTE_UNUSED,
-          int quitting ATTRIBUTE_UNUSED)
-{
-  /* Nothing to do.  */
-}
-
 void
 sim_stop_reason (SIM_DESC sd ATTRIBUTE_UNUSED,
                 enum sim_stop *reason,
This page took 0.024984 seconds and 4 git commands to generate.