diff options
author | Andrew Burgess <aburgess@redhat.com> | 2025-08-21 12:58:30 +0100 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2025-08-26 21:48:34 +0100 |
commit | 2bd87cef85034dbf39a2817fba4f03828c0ca782 (patch) | |
tree | 4275d2a6611dfcbbcf8552916f58cc74c93b0dd4 | |
parent | e3a6f62033cd3a1acdafc34d8bf7e22e532dff9b (diff) | |
download | binutils-2bd87cef85034dbf39a2817fba4f03828c0ca782.zip binutils-2bd87cef85034dbf39a2817fba4f03828c0ca782.tar.gz binutils-2bd87cef85034dbf39a2817fba4f03828c0ca782.tar.bz2 |
gdb: use current_program_space->core_bfd() a little less
The function linux_read_core_file_mappings is passed an argument CBFD,
which is the BFD for the core file. In
core_target::build_file_mappings, where the function is called, we
pass current_program_space->core_bfd() as the argument.
However, in linux_read_core_file_mappings, in some places we use the
CBFD argument, and in other places we directly use
current_program_space->core_bfd(). This is confusing, and
unnecessary. Lets not do that.
Standardise on just using CBFD. This removes some references to
global state in favour of passing the global state in as an argument,
I think this is a good thing.
There should be no user visible changes after this commit.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
-rw-r--r-- | gdb/linux-tdep.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index 5c4bbf6..f57ee85 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -1147,8 +1147,8 @@ linux_read_core_file_mappings } gdb::byte_vector contents (note_size); - if (!bfd_get_section_contents (current_program_space->core_bfd (), section, - contents.data (), 0, note_size)) + if (!bfd_get_section_contents (cbfd, section, contents.data (), 0, + note_size)) { warning (_("could not get core note contents")); return; @@ -1163,13 +1163,10 @@ linux_read_core_file_mappings return; } - ULONGEST count = bfd_get (addr_size_bits, current_program_space->core_bfd (), - descdata); + ULONGEST count = bfd_get (addr_size_bits, cbfd, descdata); descdata += addr_size; - ULONGEST page_size = bfd_get (addr_size_bits, - current_program_space->core_bfd (), - descdata); + ULONGEST page_size = bfd_get (addr_size_bits, cbfd, descdata); descdata += addr_size; if (note_size < 2 * addr_size + count * 3 * addr_size) @@ -1216,12 +1213,11 @@ linux_read_core_file_mappings for (int i = 0; i < count; i++) { - ULONGEST start = bfd_get (addr_size_bits, current_program_space->core_bfd (), descdata); + ULONGEST start = bfd_get (addr_size_bits, cbfd, descdata); descdata += addr_size; - ULONGEST end = bfd_get (addr_size_bits, current_program_space->core_bfd (), descdata); + ULONGEST end = bfd_get (addr_size_bits, cbfd, descdata); descdata += addr_size; - ULONGEST file_ofs - = bfd_get (addr_size_bits, current_program_space->core_bfd (), descdata) * page_size; + ULONGEST file_ofs = bfd_get (addr_size_bits, cbfd, descdata) * page_size; descdata += addr_size; char * filename = filenames; filenames += strlen ((char *) filenames) + 1; |