aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2008-09-05 14:49:05 +0000
committerDaniel Jacobowitz <drow@false.org>2008-09-05 14:49:05 +0000
commitd966045b7b22448c0c4cdfa90eb1afab34d07c46 (patch)
treeef2f60f05029d33e996a83306810225d575a49d4
parent0b1553bcdd4db0c7ddb09f01cd281917447d5769 (diff)
downloadgdb-d966045b7b22448c0c4cdfa90eb1afab34d07c46.zip
gdb-d966045b7b22448c0c4cdfa90eb1afab34d07c46.tar.gz
gdb-d966045b7b22448c0c4cdfa90eb1afab34d07c46.tar.bz2
* readelf.c (load_specific_debug_section): New function, from
load_debug_section. (load_debug_section): Use load_specific_debug_section. (display_debug_section): Use load_specific_debug_section. Check for multiple sections with the same name.
-rw-r--r--binutils/ChangeLog8
-rw-r--r--binutils/readelf.c52
2 files changed, 43 insertions, 17 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 525dbe2..eff5d7b 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,11 @@
+2008-09-05 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * readelf.c (load_specific_debug_section): New function, from
+ load_debug_section.
+ (load_debug_section): Use load_specific_debug_section.
+ (display_debug_section): Use load_specific_debug_section. Check for
+ multiple sections with the same name.
+
2008-08-28 Tristan Gingold <gingold@adacore.com>
* objdump.c (dump_stabs): Add sections for Darwin.
diff --git a/binutils/readelf.c b/binutils/readelf.c
index ea48ba1..9f1008c 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -8486,11 +8486,11 @@ debug_apply_relocations (void *file,
}
}
-int
-load_debug_section (enum dwarf_section_display_enum debug, void *file)
+static int
+load_specific_debug_section (enum dwarf_section_display_enum debug,
+ Elf_Internal_Shdr *sec, void *file)
{
struct dwarf_section *section = &debug_displays [debug].section;
- Elf_Internal_Shdr *sec;
char buf [64];
int section_is_compressed;
@@ -8498,18 +8498,6 @@ load_debug_section (enum dwarf_section_display_enum debug, void *file)
if (section->start != NULL)
return 1;
- /* Locate the debug section. */
- sec = find_section (section->uncompressed_name);
- if (sec != NULL)
- section->name = section->uncompressed_name;
- else
- {
- sec = find_section (section->compressed_name);
- if (sec != NULL)
- section->name = section->compressed_name;
- }
- if (sec == NULL)
- return 0;
section_is_compressed = section->name == section->compressed_name;
snprintf (buf, sizeof (buf), _("%s section data"), section->name);
@@ -8530,6 +8518,28 @@ load_debug_section (enum dwarf_section_display_enum debug, void *file)
return 1;
}
+int
+load_debug_section (enum dwarf_section_display_enum debug, void *file)
+{
+ struct dwarf_section *section = &debug_displays [debug].section;
+ Elf_Internal_Shdr *sec;
+
+ /* Locate the debug section. */
+ sec = find_section (section->uncompressed_name);
+ if (sec != NULL)
+ section->name = section->uncompressed_name;
+ else
+ {
+ sec = find_section (section->compressed_name);
+ if (sec != NULL)
+ section->name = section->compressed_name;
+ }
+ if (sec == NULL)
+ return 0;
+
+ return load_specific_debug_section (debug, sec, file);
+}
+
void
free_debug_section (enum dwarf_section_display_enum debug)
{
@@ -8568,12 +8578,20 @@ display_debug_section (Elf_Internal_Shdr *section, FILE *file)
|| streq (debug_displays[i].section.compressed_name, name))
{
struct dwarf_section *sec = &debug_displays [i].section;
+ int secondary = (section != find_section (name));
+
+ if (secondary)
+ free_debug_section (i);
- if (load_debug_section (i, file))
+ if (streq (debug_displays[i].section.uncompressed_name, name))
+ sec->name = sec->uncompressed_name;
+ else
+ sec->name = sec->compressed_name;
+ if (load_specific_debug_section (i, section, file))
{
result &= debug_displays[i].display (sec, file);
- if (i != info && i != abbrev)
+ if (secondary || (i != info && i != abbrev))
free_debug_section (i);
}