aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2020-05-19 12:18:04 -0400
committerSimon Marchi <simon.marchi@efficios.com>2020-05-19 12:18:36 -0400
commit68b888fff3164b5e8e347d9c1ca351c366f0aac4 (patch)
tree407df662edc349c3ec33bf23379f33d3bce06cd4 /gdb/remote.c
parent62982abdee45cb20a7cfadb2b1bcc358655d4ad3 (diff)
downloadgdb-68b888fff3164b5e8e347d9c1ca351c366f0aac4.zip
gdb-68b888fff3164b5e8e347d9c1ca351c366f0aac4.tar.gz
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/remote.c')
-rw-r--r--gdb/remote.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gdb/remote.c b/gdb/remote.c
index a28f34d..312a03c 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -4198,10 +4198,10 @@ remote_target::get_offsets ()
by assuming that the .text and .data offsets apply to the whole
text and data segments. Convert the offsets given in the packet
to base addresses for symfile_map_offsets_to_segments. */
- else if (data && data->num_segments == 2)
+ else if (data != nullptr && data->segments.size () == 2)
{
- segments[0] = data->segment_bases[0] + text_addr;
- segments[1] = data->segment_bases[1] + data_addr;
+ segments[0] = data->segments[0].base + text_addr;
+ segments[1] = data->segments[1].base + data_addr;
num_segments = 2;
}
/* If the object file has only one segment, assume that it is text
@@ -4209,9 +4209,9 @@ remote_target::get_offsets ()
but programs with no code are useless. Of course the code might
have ended up in the data segment... to detect that we would need
the permissions here. */
- else if (data && data->num_segments == 1)
+ else if (data && data->segments.size () == 1)
{
- segments[0] = data->segment_bases[0] + text_addr;
+ segments[0] = data->segments[0].base + text_addr;
num_segments = 1;
}
/* There's no way to relocate by segment. */