aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-10-29 15:04:33 -0600
committerTom Tromey <tom@tromey.com>2020-10-29 15:04:36 -0600
commitb55221abba07302964f697db7eb996ff33b26f5a (patch)
treefeb17b005f5243dc5e3463314c2627764f8f47e5 /gdb
parent5a36e71525564fe8767bc9f00b29dcc0fec59837 (diff)
downloadgdb-b55221abba07302964f697db7eb996ff33b26f5a.zip
gdb-b55221abba07302964f697db7eb996ff33b26f5a.tar.gz
gdb-b55221abba07302964f697db7eb996ff33b26f5a.tar.bz2
Remove current_target_sections macro
This removes the current_target_sections macro, replacing it with uses of the appropriate member from current_program_space. gdb/ChangeLog 2020-10-29 Tom Tromey <tom@tromey.com> * progspace.h (current_target_sections): Remove macro. * solib-svr4.c (scan_dyntag): Update. * solib-dsbt.c (scan_dyntag): Update. * exec.c (exec_target::close): Update. (add_target_sections, add_target_sections_of_objfile) (remove_target_sections, exec_target::get_section_table) (exec_target::files_info, set_section_command) (exec_set_section_address, exec_target::has_memory) (exec_target::has_memory): Update.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog12
-rw-r--r--gdb/exec.c18
-rw-r--r--gdb/progspace.h4
-rw-r--r--gdb/solib-dsbt.c2
-rw-r--r--gdb/solib-svr4.c2
5 files changed, 23 insertions, 15 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b47133e..3ab3564 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,17 @@
2020-10-29 Tom Tromey <tom@tromey.com>
+ * progspace.h (current_target_sections): Remove macro.
+ * solib-svr4.c (scan_dyntag): Update.
+ * solib-dsbt.c (scan_dyntag): Update.
+ * exec.c (exec_target::close): Update.
+ (add_target_sections, add_target_sections_of_objfile)
+ (remove_target_sections, exec_target::get_section_table)
+ (exec_target::files_info, set_section_command)
+ (exec_set_section_address, exec_target::has_memory)
+ (exec_target::has_memory): Update.
+
+2020-10-29 Tom Tromey <tom@tromey.com>
+
* source-cache.c (source_cache::get_plain_source_lines): Use
current_program_space.
* corefile.c (reopen_exec_file): Use current_program_space.
diff --git a/gdb/exec.c b/gdb/exec.c
index 4345f35..2db207a 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -159,7 +159,7 @@ exec_target::close ()
for (struct program_space *ss : program_spaces)
{
set_current_program_space (ss);
- current_target_sections->clear ();
+ ss->target_sections.clear ();
ss->exec_close ();
}
}
@@ -591,7 +591,7 @@ void
add_target_sections (void *owner,
const target_section_table &sections)
{
- target_section_table *table = current_target_sections;
+ target_section_table *table = &current_program_space->target_sections;
if (!sections.empty ())
{
@@ -626,7 +626,7 @@ add_target_sections (void *owner,
void
add_target_sections_of_objfile (struct objfile *objfile)
{
- target_section_table *table = current_target_sections;
+ target_section_table *table = &current_program_space->target_sections;
struct obj_section *osect;
gdb_assert (objfile != nullptr);
@@ -649,7 +649,7 @@ add_target_sections_of_objfile (struct objfile *objfile)
void
remove_target_sections (void *owner)
{
- target_section_table *table = current_target_sections;
+ target_section_table *table = &current_program_space->target_sections;
gdb_assert (owner != NULL);
@@ -893,7 +893,7 @@ section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf,
target_section_table *
exec_target::get_section_table ()
{
- return current_target_sections;
+ return &current_program_space->target_sections;
}
enum target_xfer_status
@@ -991,7 +991,7 @@ void
exec_target::files_info ()
{
if (exec_bfd)
- print_section_info (current_target_sections, exec_bfd);
+ print_section_info (&current_program_space->target_sections, exec_bfd);
else
puts_filtered (_("\t<no file loaded>\n"));
}
@@ -1015,7 +1015,7 @@ set_section_command (const char *args, int from_tty)
/* Parse out new virtual address. */
secaddr = parse_and_eval_address (args);
- for (target_section &p : *current_target_sections)
+ 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')
@@ -1041,7 +1041,7 @@ set_section_command (const char *args, int from_tty)
void
exec_set_section_address (const char *filename, int index, CORE_ADDR address)
{
- for (target_section &p : *current_target_sections)
+ for (target_section &p : current_program_space->target_sections)
{
if (filename_cmp (filename,
bfd_get_filename (p.the_bfd_section->owner)) == 0
@@ -1058,7 +1058,7 @@ exec_target::has_memory ()
{
/* We can provide memory if we have any file/target sections to read
from. */
- return !current_target_sections->empty ();
+ return !current_program_space->target_sections.empty ();
}
gdb::unique_xmalloc_ptr<char>
diff --git a/gdb/progspace.h b/gdb/progspace.h
index 6dcec9c..0363403 100644
--- a/gdb/progspace.h
+++ b/gdb/progspace.h
@@ -365,10 +365,6 @@ struct address_space
#define symfile_objfile current_program_space->symfile_object_file
-/* The set of target sections matching the sections mapped into the
- current program space. */
-#define current_target_sections (&current_program_space->target_sections)
-
/* The list of all program spaces. There's always at least one. */
extern std::vector<struct program_space *>program_spaces;
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
index 57c7ab1..6f610c5 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
@@ -424,7 +424,7 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
return 0;
bool found = false;
- for (target_section &target_section : *current_target_sections)
+ for (target_section &target_section : current_program_space->target_sections)
if (sect == target_section.the_bfd_section)
{
dyn_addr = target_section.addr;
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index a780f8d..faaba47 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -608,7 +608,7 @@ scan_dyntag (const int desired_dyntag, bfd *abfd, CORE_ADDR *ptr,
return 0;
bool found = false;
- for (target_section &target_section : *current_target_sections)
+ for (target_section &target_section : current_program_space->target_sections)
if (sect == target_section.the_bfd_section)
{
dyn_addr = target_section.addr;