From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 5/9] Remove current_target_sections macro
Date: Tue, 21 Jul 2020 21:34:40 -0600 [thread overview]
Message-ID: <20200722033444.18522-6-tom@tromey.com> (raw)
In-Reply-To: <20200722033444.18522-1-tom@tromey.com>
This removes the current_target_sections macro, replacing it with uses
of the appropriate member from current_program_space.
gdb/ChangeLog
2020-07-21 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.
---
gdb/ChangeLog | 12 ++++++++++++
gdb/exec.c | 23 +++++++++++++----------
gdb/progspace.h | 4 ----
gdb/solib-dsbt.c | 6 +++---
gdb/solib-svr4.c | 6 +++---
5 files changed, 31 insertions(+), 20 deletions(-)
diff --git a/gdb/exec.c b/gdb/exec.c
index 6ca867ab53e..e2a0cae787c 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);
- clear_section_table (current_target_sections);
+ clear_section_table (&ss->target_sections);
ss->exec_close ();
}
}
@@ -660,7 +660,8 @@ add_target_sections (void *owner,
struct target_section *sections_end)
{
int count;
- struct target_section_table *table = current_target_sections;
+ struct target_section_table *table
+ = ¤t_program_space->target_sections;
count = sections_end - sections;
@@ -700,7 +701,8 @@ add_target_sections (void *owner,
void
add_target_sections_of_objfile (struct objfile *objfile)
{
- struct target_section_table *table = current_target_sections;
+ struct target_section_table *table
+ = ¤t_program_space->target_sections;
struct obj_section *osect;
int space;
unsigned count = 0;
@@ -747,7 +749,8 @@ void
remove_target_sections (void *owner)
{
struct target_section *src, *dest;
- struct target_section_table *table = current_target_sections;
+ struct target_section_table *table
+ = ¤t_program_space->target_sections;
gdb_assert (owner != NULL);
@@ -1006,7 +1009,7 @@ section_table_xfer_memory_partial (gdb_byte *readbuf, const gdb_byte *writebuf,
struct target_section_table *
exec_target::get_section_table ()
{
- return current_target_sections;
+ return ¤t_program_space->target_sections;
}
enum target_xfer_status
@@ -1105,7 +1108,7 @@ void
exec_target::files_info ()
{
if (exec_bfd)
- print_section_info (current_target_sections, exec_bfd);
+ print_section_info (¤t_program_space->target_sections, exec_bfd);
else
puts_filtered (_("\t<no file loaded>\n"));
}
@@ -1131,7 +1134,7 @@ set_section_command (const char *args, int from_tty)
/* Parse out new virtual address. */
secaddr = parse_and_eval_address (args);
- table = current_target_sections;
+ table = ¤t_program_space->target_sections;
for (p = table->sections; p < table->sections_end; p++)
{
if (!strncmp (secname, bfd_section_name (p->the_bfd_section), seclen)
@@ -1161,7 +1164,7 @@ exec_set_section_address (const char *filename, int index, CORE_ADDR address)
struct target_section *p;
struct target_section_table *table;
- table = current_target_sections;
+ table = ¤t_program_space->target_sections;
for (p = table->sections; p < table->sections_end; p++)
{
if (filename_cmp (filename,
@@ -1179,8 +1182,8 @@ exec_target::has_memory ()
{
/* We can provide memory if we have any file/target sections to read
from. */
- return (current_target_sections->sections
- != current_target_sections->sections_end);
+ return (current_program_space->target_sections.sections
+ != current_program_space->target_sections.sections_end);
}
char *
diff --git a/gdb/progspace.h b/gdb/progspace.h
index 777bef2e38e..ef39f8a1dab 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 (¤t_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 94a6ac83754..ae76bb74c05 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
@@ -424,12 +424,12 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
if (sect == NULL)
return 0;
- for (target_section = current_target_sections->sections;
- target_section < current_target_sections->sections_end;
+ for (target_section = current_program_space->target_sections->sections;
+ target_section < current_program_space->target_sections->sections_end;
target_section++)
if (sect == target_section->the_bfd_section)
break;
- if (target_section < current_target_sections->sections_end)
+ if (target_section < current_program_space->target_sections->sections_end)
dyn_addr = target_section->addr;
else
{
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 570450c5400..520d9e8ed12 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -608,12 +608,12 @@ scan_dyntag (const int desired_dyntag, bfd *abfd, CORE_ADDR *ptr,
if (sect == NULL)
return 0;
- for (target_section = current_target_sections->sections;
- target_section < current_target_sections->sections_end;
+ for (target_section = current_program_space->target_sections.sections;
+ target_section < current_program_space->target_sections.sections_end;
target_section++)
if (sect == target_section->the_bfd_section)
break;
- if (target_section < current_target_sections->sections_end)
+ if (target_section < current_program_space->target_sections.sections_end)
dyn_addr = target_section->addr;
else
{
--
2.17.2
next prev parent reply other threads:[~2020-07-22 3:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-22 3:34 [PATCH 0/9] Remove some macros from exec.h and progspace.h Tom Tromey
2020-07-22 3:34 ` [PATCH 1/9] Remove exec_filename macro Tom Tromey
2020-07-22 3:34 ` [PATCH 2/9] Change exec_close to be a method on program_space Tom Tromey
2020-07-22 3:34 ` [PATCH 3/9] Remove commented-out code from gcore.c Tom Tromey
2020-07-22 3:34 ` [PATCH 4/9] Remove exec_bfd_mtime define Tom Tromey
2020-07-22 3:34 ` Tom Tromey [this message]
2020-07-22 12:20 ` [PATCH 5/9] Remove current_target_sections macro Simon Marchi
2020-07-22 12:39 ` Simon Marchi
2020-07-22 14:11 ` Tom Tromey
2020-07-22 3:34 ` [PATCH 6/9] Don't change current program space in exec_target::close Tom Tromey
2020-07-22 12:22 ` Simon Marchi
2020-07-22 3:34 ` [PATCH 7/9] Remove the exec_bfd macro Tom Tromey
2020-07-22 3:34 ` [PATCH 8/9] Change program_space::ebfd to a gdb_bfd_ref_ptr Tom Tromey
2020-07-22 3:34 ` [PATCH 9/9] Remove symfile_objfile macro Tom Tromey
2020-07-22 12:38 ` [PATCH 0/9] Remove some macros from exec.h and progspace.h Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200722033444.18522-6-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox