From: Jan Kratochvil Date: Thu, 22 Apr 2010 23:20:15 +0000 (+0000) Subject: gdb/ X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1fdf3e62fad0e7ddb5aa5cc2cf93d8cdab58901f;p=thirdparty%2Fbinutils-gdb.git gdb/ * symfile.c (addr_info_make_relative): Move sect declaration to the outer block. Initialize it to NULL. Prefer SECT->next more than bfd_get_section_by_name. gdb/testsuite/ * gdb.base/dup-sect.exp, gdb.base/dup-sect.S: New. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1a96104f72f..ede39492d98 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2010-04-22 Jan Kratochvil + + * symfile.c (addr_info_make_relative): Move sect declaration to the + outer block. Initialize it to NULL. Prefer SECT->next more than + bfd_get_section_by_name. + 2010-04-08 Sami Wagiaalla PR Breakpoints/11408: diff --git a/gdb/symfile.c b/gdb/symfile.c index 9c28fb0d9a2..6f136516ab2 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -566,6 +566,7 @@ addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd) asection *lower_sect; CORE_ADDR lower_offset; int i; + asection *sect; /* Find lowest loadable section to be used as starting point for continguous sections. */ @@ -590,10 +591,23 @@ addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd) (the loadable section directly below it in memory). this_offset = lower_offset = lower_addr - lower_orig_addr */ + sect = NULL; for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++) { - asection *sect = bfd_get_section_by_name (abfd, addrs->other[i].name); + const char *sect_name = addrs->other[i].name; + + /* Prefer the next section of that we have found last. The separate + debug info files have either the same section layout or just a few + sections are missing there. On the other hand the section name is not + unique and we could find an inappropraite section by its name. */ + + if (sect) + sect = sect->next; + if (sect && strcmp (sect_name, bfd_get_section_name (abfd, sect)) != 0) + sect = NULL; + if (sect == NULL) + sect = bfd_get_section_by_name (abfd, sect_name); if (sect) { /* This is the index used by BFD. */ diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index fa35e2c9dcc..7e386507e85 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2010-04-22 Jan Kratochvil + + * gdb.base/dup-sect.exp, gdb.base/dup-sect.S: New. + 2010-04-08 Sami Wagiaalla * gdb.cp/gdb2384-base.h: Created 'namespace B'.