struct dwarf_section *section = &debug_displays [debug].section;
bfd *abfd = (bfd *) file;
bfd_boolean ret;
- 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;
-
section->address = 0;
section->size = bfd_get_section_size (sec);
- section->start = (unsigned char *) xmalloc (section->size);
-
- ret = bfd_get_section_contents (abfd, sec, section->start, 0,
- section->size);
+ section->start = NULL;
+ ret = bfd_get_full_section_contents (abfd, sec, §ion->start);
if (! ret)
{
return 0;
}
- if (section_is_compressed)
- {
- bfd_size_type size = section->size;
- if (! bfd_uncompress_section_contents (§ion->start, &size))
- {
- free_debug_section (debug);
- printf (_("\nCan't uncompress section '%s'.\n"), section->name);
- return 0;
- }
- section->size = size;
- }
-
if (is_relocatable && debug_displays [debug].relocate)
{
/* We want to relocate the data we've already read (and
(unsigned long) (section->filepos + start_offset));
printf ("\n");
- data = (bfd_byte *) xmalloc (datasize);
-
- bfd_get_section_contents (abfd, section, data, 0, datasize);
+ if (!bfd_get_full_section_contents (abfd, section, &data))
+ {
+ non_fatal (_("Reading section failed"));
+ return;
+ }
width = 4;
return;
}
+ /* Decompress sections unless dumping the section contents. */
+ if (!dump_section_contents)
+ file->flags |= BFD_DECOMPRESS;
+
/* If the file is an archive, process all of its elements. */
if (bfd_check_format (file, bfd_archive))
{