aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-11-08 19:52:42 +0000
committerTom Tromey <tromey@redhat.com>2012-11-08 19:52:42 +0000
commitea9f10bb87523d421e6c863a7ec66dfee41692b4 (patch)
tree4ffaabac48c8d7f9209e224d1de031c7db0f3406 /gdb/python
parentd071a26bbc15eff9beaa74baef98ffdf4ae2653d (diff)
downloadbinutils-ea9f10bb87523d421e6c863a7ec66dfee41692b4.zip
binutils-ea9f10bb87523d421e6c863a7ec66dfee41692b4.tar.gz
binutils-ea9f10bb87523d421e6c863a7ec66dfee41692b4.tar.bz2
PR gdb/14704:
* gdb_bfd.c (gdb_bfd_ref): Set BFD_DECOMPRESS. (zlib_decompress_section): Remove. (gdb_bfd_map_section): Only check for compressed section in mmap case. Use bfd_get_full_section_contents. * osabi.c (check_note): Add 'sectsize' argument. Read section data. (generic_elf_osabi_sniff_abi_tag_sections): Don't read section data. Update for check_note change. * xcoffread.c (xcoff_initial_scan): Use bfd_get_full_section_contents. * py-auto-load.c (auto_load_section_scripts): Use bfd_get_full_section_contents. * contrib/cc-with-tweaks.sh: Add -Z option. testsuite * gdb.base/comprdebug.exp: New file.
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-auto-load.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/gdb/python/py-auto-load.c b/gdb/python/py-auto-load.c
index a018f5f..91bb34d 100644
--- a/gdb/python/py-auto-load.c
+++ b/gdb/python/py-auto-load.c
@@ -197,26 +197,25 @@ auto_load_section_scripts (struct objfile *objfile, const char *section_name)
{
bfd *abfd = objfile->obfd;
asection *scripts_sect;
- bfd_size_type size;
- char *p;
- struct cleanup *cleanups;
+ bfd_byte *data = NULL;
scripts_sect = bfd_get_section_by_name (abfd, section_name);
if (scripts_sect == NULL)
return;
- size = bfd_get_section_size (scripts_sect);
- p = xmalloc (size);
-
- cleanups = make_cleanup (xfree, p);
-
- if (bfd_get_section_contents (abfd, scripts_sect, p, (file_ptr) 0, size))
- source_section_scripts (objfile, section_name, p, p + size);
- else
+ if (!bfd_get_full_section_contents (abfd, scripts_sect, &data))
warning (_("Couldn't read %s section of %s"),
section_name, bfd_get_filename (abfd));
+ else
+ {
+ struct cleanup *cleanups;
+ char *p = (char *) data;
- do_cleanups (cleanups);
+ cleanups = make_cleanup (xfree, p);
+ source_section_scripts (objfile, section_name, p,
+ p + bfd_get_section_size (scripts_sect));
+ do_cleanups (cleanups);
+ }
}
/* Load any Python auto-loaded scripts for OBJFILE. */