diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2020-05-19 12:18:04 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2020-05-19 12:18:36 -0400 |
commit | 68b888fff3164b5e8e347d9c1ca351c366f0aac4 (patch) | |
tree | 407df662edc349c3ec33bf23379f33d3bce06cd4 /gdb/solib-target.c | |
parent | 62982abdee45cb20a7cfadb2b1bcc358655d4ad3 (diff) | |
download | fsf-binutils-gdb-68b888fff3164b5e8e347d9c1ca351c366f0aac4.zip fsf-binutils-gdb-68b888fff3164b5e8e347d9c1ca351c366f0aac4.tar.gz fsf-binutils-gdb-68b888fff3164b5e8e347d9c1ca351c366f0aac4.tar.bz2 |
gdb: use std::vector to store segments in symfile_segment_data
Instead of maintaining two vectors, I added a small `segment` class
which holds both the base address and size of one segment and replaced
the two `segment_bases` and `segment_sizes` arrays with a single vector.
The rest of the changes are straightforward, no behavior changes are
expected.
gdb/ChangeLog:
* symfile.h (struct symfile_segment_data) <struct segment>: New.
<segments>: New.
<segment_bases, segment_sizes>: Remove.
* symfile.c (default_symfile_segments): Update.
* elfread.c (elf_symfile_segments): Update.
* remote.c (remote_target::get_offsets): Update.
* solib-target.c (solib_target_relocate_section_addresses):
Update.
Diffstat (limited to 'gdb/solib-target.c')
-rw-r--r-- | gdb/solib-target.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gdb/solib-target.c b/gdb/solib-target.c index 35e50a3..ba05647 100644 --- a/gdb/solib-target.c +++ b/gdb/solib-target.c @@ -386,9 +386,9 @@ Could not relocate shared library \"%s\": bad offsets"), so->so_name); "info sharedlibrary". Report any consecutive segments which were relocated as a single unit. */ gdb_assert (li->segment_bases.size () > 0); - orig_delta = li->segment_bases[0] - data->segment_bases[0]; + orig_delta = li->segment_bases[0] - data->segments[0].base; - for (i = 1; i < data->num_segments; i++) + for (i = 1; i < data->segments.size (); i++) { /* If we have run out of offsets, assume all remaining segments have the same offset. */ @@ -397,14 +397,14 @@ Could not relocate shared library \"%s\": bad offsets"), so->so_name); /* If this segment does not have the same offset, do not include it in the library's range. */ - if (li->segment_bases[i] - data->segment_bases[i] + if (li->segment_bases[i] - data->segments[i].base != orig_delta) break; } so->addr_low = li->segment_bases[0]; - so->addr_high = (data->segment_bases[i - 1] - + data->segment_sizes[i - 1] + so->addr_high = (data->segments[i - 1].base + + data->segments[i - 1].size + orig_delta); gdb_assert (so->addr_low <= so->addr_high); } |