bfd_section_* macros
[deliverable/binutils-gdb.git] / sim / rx / gdb-if.c
index 4c4434ce39434fb16911fed9c6d7b361bf29c068..68e4b96ed634b406e614513f4a3b7caa18970120 100644 (file)
@@ -1,6 +1,6 @@
 /* gdb-if.c -- sim interface to GDB.
 
-Copyright (C) 2008-2014 Free Software Foundation, Inc.
+Copyright (C) 2008-2019 Free Software Foundation, Inc.
 Contributed by Red Hat, Inc.
 
 This file is part of the GNU simulators.
@@ -54,14 +54,14 @@ static struct sim_state the_minisim = {
   "This is the sole rx minisim instance.  See libsim.a's global variables."
 };
 
-static int open;
+static int rx_sim_is_open;
 
 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)
+  if (rx_sim_is_open)
     fprintf (stderr, "rx minisim: re-opened sim\n");
 
   /* The 'run' interface doesn't use this function, so we don't care
@@ -79,7 +79,7 @@ sim_open (SIM_OPEN_KIND kind,
   execution_error_init_debugger ();
 
   sim_disasm_init (abfd);
-  open = 1;
+  rx_sim_is_open = 1;
   return &the_minisim;
 }
 
@@ -98,7 +98,7 @@ sim_close (SIM_DESC sd, int quitting)
   /* Not much to do.  At least free up our memory.  */
   init_mem ();
 
-  open = 0;
+  rx_sim_is_open = 0;
 }
 
 static bfd *
@@ -164,14 +164,14 @@ build_swap_list (struct bfd *abfd)
          struct swap_list *sl;
          bfd_size_type size;
 
-         size = bfd_get_section_size (s);
+         size = bfd_section_size (s);
          if (size <= 0)
            continue;
          
          sl = malloc (sizeof (struct swap_list));
          assert (sl != NULL);
          sl->next = swap_list;
-         sl->start = bfd_section_lma (abfd, s);
+         sl->start = bfd_section_lma (s);
          sl->end = sl->start + size;
          swap_list = sl;
        }
@@ -192,7 +192,7 @@ addr_in_swap_list (bfd_vma addr)
 }
 
 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);
 
@@ -208,7 +208,8 @@ sim_load (SIM_DESC sd, char *prog, struct bfd *abfd, int from_tty)
 }
 
 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);
 
@@ -791,11 +792,12 @@ sim_stop_reason (SIM_DESC sd, enum sim_stop *reason_p, int *sigrc_p)
 }
 
 void
-sim_do_command (SIM_DESC sd, char *cmd)
+sim_do_command (SIM_DESC sd, const char *cmd)
 {
-  check_desc (sd);
+  const char *args;
+  char *p = strdup (cmd);
 
-  char *p = cmd;
+  check_desc (sd);
 
   /* Skip leading whitespace.  */
   while (isspace (*p))
@@ -808,7 +810,6 @@ sim_do_command (SIM_DESC sd, char *cmd)
 
   /* Null-terminate the command word, and record the start of any
      further arguments.  */
-  char *args;
   if (*p)
     {
       *p = '\0';
@@ -844,6 +845,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);
 }
 
 char **
This page took 0.026732 seconds and 4 git commands to generate.