gdb: remove duplicate declaration of 'find_thread_ptid'
[deliverable/binutils-gdb.git] / gdb / exec.c
index c55a41aa8a19d44519bf0a92dadebcb89e4327a1..35bf7bd450668e9969f51c7cfaa74d27ffbf569a 100644 (file)
@@ -75,7 +75,6 @@ struct exec_target final : public target_ops
                                        const gdb_byte *writebuf,
                                        ULONGEST offset, ULONGEST len,
                                        ULONGEST *xfered_len) override;
-  const target_section_table *get_section_table () override;
   void files_info () override;
 
   bool has_memory () override;
@@ -617,7 +616,7 @@ program_space::add_target_sections (void *owner,
            continue;
 
          switch_to_inferior_no_thread (inf);
-         push_target (&exec_ops);
+         inf->push_target (&exec_ops);
        }
     }
 }
@@ -637,8 +636,7 @@ program_space::add_target_sections (struct objfile *objfile)
       if (bfd_section_size (osect->the_bfd_section) == 0)
        continue;
 
-      m_target_sections.emplace_back (obj_section_addr (osect),
-                                     obj_section_endaddr (osect),
+      m_target_sections.emplace_back (osect->addr (), osect->endaddr (),
                                      osect->the_bfd_section, (void *) objfile);
     }
 }
@@ -672,7 +670,7 @@ program_space::remove_target_sections (void *owner)
            continue;
 
          switch_to_inferior_no_thread (inf);
-         unpush_target (&exec_ops);
+         inf->unpush_target (&exec_ops);
        }
     }
 }
@@ -683,7 +681,7 @@ void
 exec_on_vfork ()
 {
   if (!current_program_space->target_sections ().empty ())
-    push_target (&exec_ops);
+    current_inferior ()->push_target (&exec_ops);
 }
 
 \f
@@ -775,7 +773,8 @@ enum target_xfer_status
 section_table_read_available_memory (gdb_byte *readbuf, ULONGEST offset,
                                     ULONGEST len, ULONGEST *xfered_len)
 {
-  const target_section_table *table = target_get_section_table (&exec_ops);
+  const target_section_table *table
+    = target_get_section_table (current_inferior ()->top_target ());
   std::vector<mem_range> available_memory
     = section_table_available_memory (offset, len, *table);
 
@@ -884,12 +883,6 @@ section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf,
   return TARGET_XFER_EOF;              /* We can't help.  */
 }
 
-const target_section_table *
-exec_target::get_section_table ()
-{
-  return &current_program_space->target_sections ();
-}
-
 enum target_xfer_status
 exec_target::xfer_partial (enum target_object object,
                           const char *annex, gdb_byte *readbuf,
@@ -995,27 +988,23 @@ static void
 set_section_command (const char *args, int from_tty)
 {
   const char *secname;
-  unsigned seclen;
-  unsigned long secaddr;
-  char secprint[100];
-  long offset;
 
   if (args == 0)
     error (_("Must specify section name and its virtual address"));
 
   /* Parse out section name.  */
   for (secname = args; !isspace (*args); args++);
-  seclen = args - secname;
+  unsigned seclen = args - secname;
 
   /* Parse out new virtual address.  */
-  secaddr = parse_and_eval_address (args);
+  CORE_ADDR secaddr = parse_and_eval_address (args);
 
   for (target_section &p : current_program_space->target_sections ())
     {
       if (!strncmp (secname, bfd_section_name (p.the_bfd_section), seclen)
          && bfd_section_name (p.the_bfd_section)[seclen] == '\0')
        {
-         offset = secaddr - p.addr;
+         long offset = secaddr - p.addr;
          p.addr += offset;
          p.endaddr += offset;
          if (from_tty)
@@ -1023,11 +1012,9 @@ set_section_command (const char *args, int from_tty)
          return;
        }
     }
-  if (seclen >= sizeof (secprint))
-    seclen = sizeof (secprint) - 1;
-  strncpy (secprint, secname, seclen);
-  secprint[seclen] = '\0';
-  error (_("Section %s not found"), secprint);
+
+  std::string secprint (secname, seclen);
+  error (_("Section %s not found"), secprint.c_str ());
 }
 
 /* If we can find a section in FILENAME with BFD index INDEX, adjust
This page took 0.025061 seconds and 4 git commands to generate.