This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] build_section_addr_info* SEC_ALLOC/SEC_LOAD unification
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Tristan Gingold <gingold at adacore dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Sat, 13 Feb 2010 23:34:25 +0100
- Subject: [patch] build_section_addr_info* SEC_ALLOC/SEC_LOAD unification
Hi Tristan,
http://sourceware.org/ml/gdb-patches/2010-01/msg00111.html
http://sourceware.org/ml/gdb-cvs/2010-01/msg00051.html
3bfec189bb0fa1a2a44f1645dd68a9572e7a841c
2010-01-07 Tristan Gingold <gingold@adacore.com>
* symfile.c (build_section_addr_info_from_objfile): New function.
(symbol_file_add_separate): Don't use offsets from objfile but
built an addr info.
this new function creates the address information for _all_ the sections while
former build_section_addr_info_from_section_table creates it only if section
is SEC_ALLOC or SEC_LOAD.
While I have no countercase I do not see a reason for such difference, do you?
My previous unchecked-in patch had implemented this function on top of
build_section_addr_info_from_section_table and thus conforming to this
SEC_ALLOC or SEC_LOAD conditional:
[patch 06/15] PIE: Fix displacement of separate debug info files
http://sourceware.org/ml/gdb-patches/2009-11/msg00173.html
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
Thanks,
Jan
2010-02-13 Jan Kratochvil <jan.kratochvil@redhat.com>
* symfile.c (build_section_addr_info_from_objfile): Include sections
only if they are SEC_ALLOC or SEC_LOAD.
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -371,16 +371,16 @@ build_section_addr_info_from_objfile (const struct objfile *objfile)
mask = ((CORE_ADDR) 1 << addr_bit) - 1;
sap = alloc_section_addr_info (objfile->num_sections);
- for (i = 0, sec = objfile->obfd->sections;
- i < objfile->num_sections;
- i++, sec = sec->next)
- {
- gdb_assert (sec != NULL);
- sap->other[i].addr = (bfd_get_section_vma (objfile->obfd, sec)
- + objfile->section_offsets->offsets[i]) & mask;
- sap->other[i].name = xstrdup (bfd_get_section_name (objfile->obfd, sec));
- sap->other[i].sectindex = sec->index;
- }
+ for (i = 0, sec = objfile->obfd->sections; sec != NULL; sec = sec->next)
+ if (bfd_get_section_flags (objfile->obfd, sec) & (SEC_ALLOC | SEC_LOAD))
+ {
+ sap->other[i].addr = (bfd_get_section_vma (objfile->obfd, sec)
+ + objfile->section_offsets->offsets[i]) & mask;
+ sap->other[i].name = xstrdup (bfd_get_section_name (objfile->obfd,
+ sec));
+ sap->other[i].sectindex = sec->index;
+ i++;
+ }
return sap;
}