diff options
author | Daniel Jacobowitz <drow@false.org> | 2008-06-05 16:17:54 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2008-06-05 16:17:54 +0000 |
commit | 8d3854312650473c3244bc3c10767aa29751a754 (patch) | |
tree | 813b118fff95c896d09a779a36e571e1a18b403f | |
parent | 7cfbafbcb4abd37b07dec657f5fe471530a45b48 (diff) | |
download | gdb-8d3854312650473c3244bc3c10767aa29751a754.zip gdb-8d3854312650473c3244bc3c10767aa29751a754.tar.gz gdb-8d3854312650473c3244bc3c10767aa29751a754.tar.bz2 |
* remote.c (get_offsets): Handle a single segment.
* symfile.c (symfile_map_offsets_to_segments): Allow more bases
than segments.
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/remote.c | 10 | ||||
-rw-r--r-- | gdb/symfile.c | 13 |
3 files changed, 19 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c21daf0..2845468 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2008-06-05 Daniel Jacobowitz <dan@codesourcery.com> + + * remote.c (get_offsets): Handle a single segment. + * symfile.c (symfile_map_offsets_to_segments): Allow more bases + than segments. + 2008-06-03 Daniel Jacobowitz <dan@codesourcery.com> * solib-svr4.c (struct lm_info): Add lm_addr. diff --git a/gdb/remote.c b/gdb/remote.c index 429f30b..7e15873 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -2134,6 +2134,16 @@ get_offsets (void) segments[1] = data->segment_bases[1] + data_addr; num_segments = 2; } + /* If the object file has only one segment, assume that it is text + rather than data; main programs with no writable data are rare, + 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) + { + segments[0] = data->segment_bases[0] + text_addr; + num_segments = 1; + } /* There's no way to relocate by segment. */ else do_segments = 0; diff --git a/gdb/symfile.c b/gdb/symfile.c index b641220..99bebc8 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -3999,10 +3999,9 @@ free_symfile_segment_data (struct symfile_segment_data *data) If there are fewer entries in SEGMENT_BASES than there are segments in DATA, then apply SEGMENT_BASES' last entry to all the segments. - If there are more, then verify that all the excess addresses are - the same as the last legitimate one, and then ignore them. This - allows "TextSeg=X;DataSeg=X" qOffset replies for files which have - only a single segment. */ + If there are more entries, then ignore the extra. The target may + not be able to distinguish between an empty data segment and a + missing data segment; a missing text segment is less plausible. */ int symfile_map_offsets_to_segments (bfd *abfd, struct symfile_segment_data *data, struct section_offsets *offsets, @@ -4021,12 +4020,6 @@ symfile_map_offsets_to_segments (bfd *abfd, struct symfile_segment_data *data, gdb_assert (data != NULL); gdb_assert (data->num_segments > 0); - /* Check any extra SEGMENT_BASES entries. */ - if (num_segment_bases > data->num_segments) - for (i = data->num_segments; i < num_segment_bases; i++) - if (segment_bases[i] != segment_bases[data->num_segments - 1]) - return 0; - for (i = 0, sect = abfd->sections; sect != NULL; i++, sect = sect->next) { int which = data->segment_info[i]; |