diff options
author | Jim Blandy <jimb@codesourcery.com> | 2007-09-24 21:48:29 +0000 |
---|---|---|
committer | Jim Blandy <jimb@codesourcery.com> | 2007-09-24 21:48:29 +0000 |
commit | 28c32713ac37a0123d8397527e5fe9cc2d108f1a (patch) | |
tree | 770106fda5f1fb4c9ae15786fc82610724c8479f /gdb/remote.c | |
parent | 322766326763e8d4765940a4c332a9f012f1e5a2 (diff) | |
download | gdb-28c32713ac37a0123d8397527e5fe9cc2d108f1a.zip gdb-28c32713ac37a0123d8397527e5fe9cc2d108f1a.tar.gz gdb-28c32713ac37a0123d8397527e5fe9cc2d108f1a.tar.bz2 |
* symfile.h (struct symfile_segment_data): Doc fixes.
* symfile.c (symfile_map_offsets_to_segments): Doc fixes.
Assert that we were passed some loaded segment addresses,
and that sections' segment numbers are valid.
Simplify offset calculation.
* remote.c (get_offsets): Clarify selection of relocate-by-segment
strategy, and set num_segments correctly. Delete redundant
assignments to do_sections.
Diffstat (limited to 'gdb/remote.c')
-rw-r--r-- | gdb/remote.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/gdb/remote.c b/gdb/remote.c index 4d37643..b46fb13 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -2103,28 +2103,24 @@ get_offsets (void) do_segments = (data != NULL); do_sections = num_segments == 0; - /* Text= and Data= specify offsets for the text and data sections, - but symfile_map_offsets_to_segments expects base addresses - instead of offsets. If we have two segments, we can still - try to relocate the whole segments instead of just ".text" - and ".data". */ - if (num_segments == 0) - { - do_sections = 1; - if (data == NULL || data->num_segments != 2) - do_segments = 0; - else - { - segments[0] = data->segment_bases[0] + text_addr; - segments[1] = data->segment_bases[1] + data_addr; - } - } - else + if (num_segments > 0) { - do_sections = 0; segments[0] = text_addr; segments[1] = data_addr; } + /* If we have two segments, we can still try to relocate everything + 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) + { + segments[0] = data->segment_bases[0] + text_addr; + segments[1] = data->segment_bases[1] + data_addr; + num_segments = 2; + } + /* There's no way to relocate by segment. */ + else + do_segments = 0; if (do_segments) { |