diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2010-02-19 06:19:45 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2010-02-19 06:19:45 +0000 |
commit | 672d9c23b3246028ca5f134f67895f59b6f98c8e (patch) | |
tree | eef0c3ea96099d38a0644a581ac65b9721778a34 /gdb | |
parent | c16153aed7cc77c39bb5e78b2880a9792e1d0554 (diff) | |
download | gdb-672d9c23b3246028ca5f134f67895f59b6f98c8e.zip gdb-672d9c23b3246028ca5f134f67895f59b6f98c8e.tar.gz gdb-672d9c23b3246028ca5f134f67895f59b6f98c8e.tar.bz2 |
gdb/
* symfile.c (addr_info_make_relative): Extend comment. Move SECT to
a more inner block. Initialize ADDR by LOWER_OFFSET only if it was
found by bfd_get_section_by_name.
* symfile.h (struct section_addr_info) <sectindex>: New comment.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/symfile.c | 30 | ||||
-rw-r--r-- | gdb/symfile.h | 2 |
3 files changed, 26 insertions, 13 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c962ea4..fe5a572 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2010-02-19 Jan Kratochvil <jan.kratochvil@redhat.com> + + * symfile.c (addr_info_make_relative): Extend comment. Move SECT to + a more inner block. Initialize ADDR by LOWER_OFFSET only if it was + found by bfd_get_section_by_name. + * symfile.h (struct section_addr_info) <sectindex>: New comment. + 2010-02-19 Joel Brobecker <brobecker@adacore.com> * NEWS: Add new "[...] since 7.1" section. Rename the "[...] since diff --git a/gdb/symfile.c b/gdb/symfile.c index 53266a7..8705420 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -562,13 +562,13 @@ relative_addr_info_to_section_offsets (struct section_offsets *section_offsets, } /* Relativize absolute addresses in ADDRS into offsets based on ABFD. Fill-in - also SECTINDEXes there. */ + also SECTINDEXes specific to ABFD there. This function can be used to + rebase ADDRS to start referencing different BFD than before. */ void addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd) { asection *lower_sect; - asection *sect; CORE_ADDR lower_offset; int i; @@ -597,25 +597,29 @@ addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd) for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++) { - if (addrs->other[i].addr != 0) + asection *sect = bfd_get_section_by_name (abfd, addrs->other[i].name); + + if (sect) { - sect = bfd_get_section_by_name (abfd, addrs->other[i].name); - if (sect) + /* This is the index used by BFD. */ + addrs->other[i].sectindex = sect->index; + + if (addrs->other[i].addr != 0) { addrs->other[i].addr -= bfd_section_vma (abfd, sect); lower_offset = addrs->other[i].addr; - /* This is the index used by BFD. */ - addrs->other[i].sectindex = sect->index; } else - { - warning (_("section %s not found in %s"), addrs->other[i].name, - bfd_get_filename (abfd)); - addrs->other[i].addr = 0; - } + addrs->other[i].addr = lower_offset; } else - addrs->other[i].addr = lower_offset; + { + warning (_("section %s not found in %s"), addrs->other[i].name, + bfd_get_filename (abfd)); + addrs->other[i].addr = 0; + + /* SECTINDEX is invalid if ADDR is zero. */ + } } } diff --git a/gdb/symfile.h b/gdb/symfile.h index 302c29f..fe95255 100644 --- a/gdb/symfile.h +++ b/gdb/symfile.h @@ -80,6 +80,8 @@ struct section_addr_info { CORE_ADDR addr; char *name; + + /* SECTINDEX must be valid for associated BFD if ADDR is not zero. */ int sectindex; } other[1]; }; |