Don't write to inferior_ptid in linux_get_siginfo_data
[deliverable/binutils-gdb.git] / sim / rl78 / gdb-if.c
index 5dce5cd8f6c318e2fb50fbf7a5cbf13c43e65c60..ba07038c009d581f1c54fe874cb65c04647be29d 100644 (file)
@@ -1,6 +1,6 @@
 /* gdb-if.c -- sim interface to GDB.
 
 /* gdb-if.c -- sim interface to GDB.
 
-Copyright (C) 2011-2014 Free Software Foundation, Inc.
+Copyright (C) 2011-2020 Free Software Foundation, Inc.
 Contributed by Red Hat, Inc.
 
 This file is part of the GNU simulators.
 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,
 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");
 {
   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;
 
   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;
 }
 
   return &the_minisim;
 }
 
@@ -140,7 +171,7 @@ open_objfile (const char *filename)
 /* Load a program.  */
 
 SIM_RC
 /* Load a program.  */
 
 SIM_RC
-sim_load (SIM_DESC sd, char *prog, struct bfd *abfd, int from_tty)
+sim_load (SIM_DESC sd, const char *prog, struct bfd *abfd, int from_tty)
 {
   check_desc (sd);
 
 {
   check_desc (sd);
 
@@ -157,7 +188,8 @@ sim_load (SIM_DESC sd, char *prog, struct bfd *abfd, int from_tty)
 /* Create inferior.  */
 
 SIM_RC
 /* 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);
 
 {
   check_desc (sd);
 
@@ -499,9 +531,10 @@ sim_stop_reason (SIM_DESC sd, enum sim_stop *reason_p, int *sigrc_p)
    command.  */
 
 void
    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);
 
 
   check_desc (sd);
 
@@ -512,8 +545,6 @@ sim_do_command (SIM_DESC sd, char *cmd)
     }
   else
     {
     }
   else
     {
-      char *p = cmd;
-
       /* Skip leading whitespace.  */
       while (isspace (*p))
        p++;
       /* 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");
   else
     printf ("The 'sim' command expects either 'trace' or 'verbose'"
            " as a subcommand.\n");
+
+  free (p);
 }
 
 /* Stub for command completion.  */
 }
 
 /* Stub for command completion.  */
This page took 0.024203 seconds and 4 git commands to generate.