aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2024-10-17 16:57:03 -0600
committerTom Tromey <tom@tromey.com>2024-10-24 14:17:47 -0600
commitabbc4d4435aade0773974f05acaff2fab67dbf78 (patch)
treeae1d1ae6f45afedc7c1d839c6c7f5090eae7ab19
parent86b26b453f65404b29ce035a2eb3d62671aa0612 (diff)
downloadgdb-abbc4d4435aade0773974f05acaff2fab67dbf78.zip
gdb-abbc4d4435aade0773974f05acaff2fab67dbf78.tar.gz
gdb-abbc4d4435aade0773974f05acaff2fab67dbf78.tar.bz2
Use gdb_bfd_get_full_section_contents in auto-load.c
This changes auto-load.c ot use gdb_bfd_get_full_section_contents. This shouldn't change any behavior, but makes it easier to add locking in a subsequent patch. Reviewed-by: Kevin Buettner <kevinb@redhat.com>
-rw-r--r--gdb/auto-load.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index e753333..d4307ea 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -1114,25 +1114,22 @@ auto_load_section_scripts (struct objfile *objfile, const char *section_name)
{
bfd *abfd = objfile->obfd.get ();
asection *scripts_sect;
- bfd_byte *data = NULL;
scripts_sect = bfd_get_section_by_name (abfd, section_name);
if (scripts_sect == NULL
|| (bfd_section_flags (scripts_sect) & SEC_HAS_CONTENTS) == 0)
return;
- if (!bfd_get_full_section_contents (abfd, scripts_sect, &data))
+ gdb::byte_vector data;
+ if (!gdb_bfd_get_full_section_contents (abfd, scripts_sect, &data))
warning (_("Couldn't read %s section of %ps"),
section_name,
styled_string (file_name_style.style (),
bfd_get_filename (abfd)));
else
{
- gdb::unique_xmalloc_ptr<bfd_byte> data_holder (data);
-
- char *p = (char *) data;
- source_section_scripts (objfile, section_name, p,
- p + bfd_section_size (scripts_sect));
+ const char *p = (const char *) data.data ();
+ source_section_scripts (objfile, section_name, p, p + data.size ());
}
}