ubsan: bpf: left shift cannot be represented in type 'DI' (aka 'long')
[deliverable/binutils-gdb.git] / sim / rl78 / gdb-if.c
index 6c4b5b5fc896cf9e3ecd3d6de6fd4c339ebc7e0c..09f369779eaef4dc8826f8660afcdc21f98fb538 100644 (file)
@@ -1,6 +1,6 @@
 /* gdb-if.c -- sim interface to GDB.
 
-Copyright (C) 2011-2014 Free Software Foundation, Inc.
+Copyright (C) 2011-2019 Free Software Foundation, Inc.
 Contributed by Red Hat, Inc.
 
 This file is part of the GNU simulators.
@@ -64,7 +64,7 @@ static struct host_callback_struct *host_callbacks;
 SIM_DESC
 sim_open (SIM_OPEN_KIND kind,
          struct host_callback_struct *callback,
-         struct bfd *abfd, char **argv)
+         struct bfd *abfd, char * const *argv)
 {
   if (open)
     fprintf (stderr, "rl78 minisim: re-opened sim\n");
@@ -86,6 +86,37 @@ sim_open (SIM_OPEN_KIND kind,
 
   sim_disasm_init (abfd);
   open = 1;
+
+  while (argv != NULL && *argv != NULL)
+    {
+      if (strcmp (*argv, "g10") == 0 || strcmp (*argv, "-Mg10") == 0)
+       {
+         fprintf (stderr, "rl78 g10 support enabled.\n");
+         rl78_g10_mode = 1;
+         g13_multiply = 0;
+         g14_multiply = 0;
+         mem_set_mirror (0, 0xf8000, 4096);
+         break;
+       }
+      if (strcmp (*argv, "g13") == 0 || strcmp (*argv, "-Mg13") == 0)
+       {
+         fprintf (stderr, "rl78 g13 support enabled.\n");
+         rl78_g10_mode = 0;
+         g13_multiply = 1;
+         g14_multiply = 0;
+         break;
+       }
+      if (strcmp (*argv, "g14") == 0 || strcmp (*argv, "-Mg14") == 0)
+       {
+         fprintf (stderr, "rl78 g14 support enabled.\n");
+         rl78_g10_mode = 0;
+         g13_multiply = 0;
+         g14_multiply = 1;
+         break;
+       }
+      argv++;
+    }
+
   return &the_minisim;
 }
 
@@ -157,7 +188,8 @@ sim_load (SIM_DESC sd, const char *prog, struct bfd *abfd, int from_tty)
 /* Create inferior.  */
 
 SIM_RC
-sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char **argv, char **env)
+sim_create_inferior (SIM_DESC sd, struct bfd *abfd,
+                    char * const *argv, char * const *env)
 {
   check_desc (sd);
 
@@ -499,9 +531,10 @@ sim_stop_reason (SIM_DESC sd, enum sim_stop *reason_p, int *sigrc_p)
    command.  */
 
 void
-sim_do_command (SIM_DESC sd, char *cmd)
+sim_do_command (SIM_DESC sd, const char *cmd)
 {
-  char *args;
+  const char *args;
+  char *p = strdup (cmd);
 
   check_desc (sd);
 
@@ -512,8 +545,6 @@ sim_do_command (SIM_DESC sd, char *cmd)
     }
   else
     {
-      char *p = cmd;
-
       /* Skip leading whitespace.  */
       while (isspace (*p))
        p++;
@@ -561,6 +592,8 @@ sim_do_command (SIM_DESC sd, char *cmd)
   else
     printf ("The 'sim' command expects either 'trace' or 'verbose'"
            " as a subcommand.\n");
+
+  free (p);
 }
 
 /* Stub for command completion.  */
This page took 0.039955 seconds and 4 git commands to generate.