aboutsummaryrefslogtreecommitdiff
path: root/gdb/symfile.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2010-01-09 09:11:00 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2010-01-09 09:11:00 +0000
commit567995e103055787c86c42096397015a55e02fd4 (patch)
treea0de58b90d278e233552c471b8111ccd2203a108 /gdb/symfile.c
parenta2beed37dbcc39524abf8a86b2133ea49f766205 (diff)
downloadgdb-567995e103055787c86c42096397015a55e02fd4.zip
gdb-567995e103055787c86c42096397015a55e02fd4.tar.gz
gdb-567995e103055787c86c42096397015a55e02fd4.tar.bz2
gdb/
Fix displacement of separate debug info files. * objfiles.c (objfile_relocate): Rename to ... (objfile_relocate1): ... here and make it static. Extend the comment. (objfile_relocate): New function. * solib-spu.c (spu_relocate_main_executable): Explicitly check if SYMFILE_OBJFILE is NULL. Remove variables objfile and old_chain. Remove following of SEPARATE_DEBUG_OBJFILE. new_offsets is now allocated using alloca. * symfile.c (copy_section_addr_info): Remove. (build_section_addr_info_from_objfile): Make it global. New variables addr_bit and mask, use them. * symfile.h (build_section_addr_info_from_objfile): New prototype. (copy_section_addr_info): Remove.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r--gdb/symfile.c35
1 files changed, 7 insertions, 28 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 42aff0d..89cc07c 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -328,32 +328,6 @@ alloc_section_addr_info (size_t num_sections)
return sap;
}
-
-/* Return a freshly allocated copy of ADDRS. The section names, if
- any, are also freshly allocated copies of those in ADDRS. */
-struct section_addr_info *
-copy_section_addr_info (struct section_addr_info *addrs)
-{
- struct section_addr_info *copy
- = alloc_section_addr_info (addrs->num_sections);
- int i;
-
- copy->num_sections = addrs->num_sections;
- for (i = 0; i < addrs->num_sections; i++)
- {
- copy->other[i].addr = addrs->other[i].addr;
- if (addrs->other[i].name)
- copy->other[i].name = xstrdup (addrs->other[i].name);
- else
- copy->other[i].name = NULL;
- copy->other[i].sectindex = addrs->other[i].sectindex;
- }
-
- return copy;
-}
-
-
-
/* Build (allocate and populate) a section_addr_info struct from
an existing section table. */
@@ -386,12 +360,17 @@ build_section_addr_info_from_section_table (const struct target_section *start,
/* Create a section_addr_info from section offsets in OBJFILE. */
-static struct section_addr_info *
+struct section_addr_info *
build_section_addr_info_from_objfile (const struct objfile *objfile)
{
struct section_addr_info *sap;
int i;
struct bfd_section *sec;
+ int addr_bit = gdbarch_addr_bit (objfile->gdbarch);
+ CORE_ADDR mask = CORE_ADDR_MAX;
+
+ if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
+ mask = ((CORE_ADDR) 1 << addr_bit) - 1;
sap = alloc_section_addr_info (objfile->num_sections);
for (i = 0, sec = objfile->obfd->sections;
@@ -400,7 +379,7 @@ build_section_addr_info_from_objfile (const struct objfile *objfile)
{
gdb_assert (sec != NULL);
sap->other[i].addr = (bfd_get_section_vma (objfile->obfd, sec)
- + objfile->section_offsets->offsets[i]);
+ + objfile->section_offsets->offsets[i]) & mask;
sap->other[i].name = xstrdup (bfd_get_section_name (objfile->obfd, sec));
sap->other[i].sectindex = sec->index;
}