putchar ('\n');
}
-/* Uncompresses a section that was compressed using zlib, in place.
- This is a copy of bfd_uncompress_section_contents, in bfd/compress.c */
+/* Uncompresses a section that was compressed using zlib, in place. */
static int
uncompress_section_contents (unsigned char **buffer ATTRIBUTE_UNUSED,
fail:
free (uncompressed_buffer);
+ /* Indicate decompression failure. */
+ *buffer = NULL;
return 0;
#endif /* HAVE_ZLIB_H */
}
{
struct dwarf_section * section = &debug_displays [debug].section;
char buf [64];
- int section_is_compressed;
/* If it is already loaded, do nothing. */
if (section->start != NULL)
return 1;
- section_is_compressed = section->name == section->compressed_name;
-
snprintf (buf, sizeof (buf), _("%s section data"), section->name);
section->address = sec->sh_addr;
section->size = sec->sh_size;
section->start = (unsigned char *) get_data (NULL, (FILE *) file,
sec->sh_offset, 1,
sec->sh_size, buf);
+ if (uncompress_section_contents (§ion->start, §ion->size))
+ sec->sh_size = section->size;
+
if (section->start == NULL)
return 0;
- if (section_is_compressed)
- {
- if (! uncompress_section_contents (§ion->start, §ion->size))
- return 0;
- sec->sh_size = section->size;
- }
-
if (debug_displays [debug].relocate)
apply_relocations ((FILE *) file, sec, section->start);