aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/format.c20
-rw-r--r--bfd/version.h2
-rw-r--r--binutils/rescoff.c30
-rw-r--r--gas/config/tc-m68k.c15
-rw-r--r--gdb/dwarf2/read.c69
-rw-r--r--gdb/dwarf2/read.h33
-rw-r--r--gdb/microblaze-linux-tdep.c3
7 files changed, 120 insertions, 52 deletions
diff --git a/bfd/format.c b/bfd/format.c
index 3db0792..a909b70 100644
--- a/bfd/format.c
+++ b/bfd/format.c
@@ -470,7 +470,18 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
/* Avoid clashes with bfd_cache_close_all running in another
thread. */
if (!bfd_cache_set_uncloseable (abfd, true, &old_in_format_matches))
- return false;
+ {
+ free (matching_vector);
+ return false;
+ }
+
+ /* Locking is required here in order to manage _bfd_section_id. */
+ if (!bfd_lock ())
+ {
+ bfd_cache_set_uncloseable (abfd, old_in_format_matches, NULL);
+ free (matching_vector);
+ return false;
+ }
/* Presume the answer is yes. */
abfd->format = format;
@@ -480,10 +491,6 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
of an archive. */
orig_messages = _bfd_set_error_handler_caching (&messages);
- /* Locking is required here in order to manage _bfd_section_id. */
- if (!bfd_lock ())
- return false;
-
preserve_match.marker = NULL;
if (!bfd_preserve_save (abfd, &preserve, NULL))
goto err_ret;
@@ -779,7 +786,8 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
out:
if (preserve_match.marker != NULL)
bfd_preserve_finish (abfd, &preserve_match);
- bfd_preserve_restore (abfd, &preserve);
+ if (preserve.marker != NULL)
+ bfd_preserve_restore (abfd, &preserve);
_bfd_restore_error_handler_caching (orig_messages);
print_and_clear_messages (&messages, PER_XVEC_NO_TARGET);
bfd_cache_set_uncloseable (abfd, old_in_format_matches, NULL);
diff --git a/bfd/version.h b/bfd/version.h
index 0a230b6..5a40d14 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -16,7 +16,7 @@
In releases, the date is not included in either version strings or
sonames. */
-#define BFD_VERSION_DATE 20250420
+#define BFD_VERSION_DATE 20250422
#define BFD_VERSION @bfd_version@
#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
#define REPORT_BUGS_TO @report_bugs_to@
diff --git a/binutils/rescoff.c b/binutils/rescoff.c
index 88b5f34..6031602 100644
--- a/binutils/rescoff.c
+++ b/binutils/rescoff.c
@@ -138,12 +138,14 @@ read_coff_rsrc (const char *filename, const char *target)
if (bfd_get_error () == bfd_error_file_ambiguously_recognized)
list_matching_formats (matching);
free (matching);
+ bfd_close (abfd);
return NULL;
}
if (bfd_get_flavour (abfd) != bfd_target_coff_flavour
|| !obj_pe (abfd))
{
non_fatal (_("%s: not a PE file"), filename);
+ bfd_close (abfd);
return NULL;
}
@@ -151,6 +153,7 @@ read_coff_rsrc (const char *filename, const char *target)
if (sec == NULL)
{
non_fatal (_("%s: no resource section"), filename);
+ bfd_close (abfd);
return NULL;
}
@@ -163,6 +166,7 @@ read_coff_rsrc (const char *filename, const char *target)
if (size > (bfd_size_type) get_file_size (filename))
{
non_fatal (_("%s: .rsrc section is bigger than the file!"), filename);
+ bfd_close (abfd);
return NULL;
}
@@ -528,6 +532,7 @@ write_coff_file (const char *filename, const char *target,
if (! bfd_set_format (abfd, bfd_object))
{
bfd_nonfatal ("bfd_set_format");
+ bfd_close_all_done (abfd);
return false;
}
@@ -535,24 +540,28 @@ write_coff_file (const char *filename, const char *target,
if (! bfd_set_arch_mach (abfd, bfd_arch_sh, 0))
{
bfd_nonfatal ("bfd_set_arch_mach(sh)");
+ bfd_close_all_done (abfd);
return false;
}
#elif defined DLLTOOL_MIPS
if (! bfd_set_arch_mach (abfd, bfd_arch_mips, 0))
{
bfd_nonfatal ("bfd_set_arch_mach(mips)");
+ bfd_close_all_done (abfd);
return false;
}
#elif defined DLLTOOL_ARM
if (! bfd_set_arch_mach (abfd, bfd_arch_arm, 0))
{
bfd_nonfatal ("bfd_set_arch_mach(arm)");
+ bfd_close_all_done (abfd);
return false;
}
#elif defined DLLTOOL_AARCH64
if (! bfd_set_arch_mach (abfd, bfd_arch_aarch64, 0))
{
bfd_nonfatal ("bfd_set_arch_mach(aarch64)");
+ bfd_close_all_done (abfd);
return false;
}
#else
@@ -560,6 +569,7 @@ write_coff_file (const char *filename, const char *target,
if (! bfd_set_arch_mach (abfd, bfd_arch_i386, 0))
{
bfd_nonfatal ("bfd_set_arch_mach(i386)");
+ bfd_close_all_done (abfd);
return false;
}
#endif
@@ -567,6 +577,7 @@ write_coff_file (const char *filename, const char *target,
if (! bfd_set_file_flags (abfd, HAS_SYMS | HAS_RELOC))
{
bfd_nonfatal ("bfd_set_file_flags");
+ bfd_close_all_done (abfd);
return false;
}
@@ -576,12 +587,14 @@ write_coff_file (const char *filename, const char *target,
if (sec == NULL)
{
bfd_nonfatal ("bfd_make_section");
+ bfd_close_all_done (abfd);
return false;
}
if (! bfd_set_symtab (abfd, &sec->symbol, 1))
{
bfd_nonfatal ("bfd_set_symtab");
+ bfd_close_all_done (abfd);
return false;
}
@@ -628,7 +641,11 @@ write_coff_file (const char *filename, const char *target,
/* Actually convert the resources to binary. */
if (!coff_to_bin (resources, &cwi))
- return false;
+ {
+ bfd_close_all_done (abfd);
+ free (cwi.relocs);
+ return false;
+ }
/* Add another few bytes to the directory strings if needed for
alignment. */
@@ -655,6 +672,8 @@ write_coff_file (const char *filename, const char *target,
if (!bfd_set_section_size (sec, length))
{
bfd_nonfatal ("bfd_set_section_size");
+ bfd_close_all_done (abfd);
+ free (cwi.relocs);
return false;
}
@@ -666,6 +685,8 @@ write_coff_file (const char *filename, const char *target,
if (! bfd_set_section_contents (abfd, sec, d->data, offset, d->length))
{
bfd_nonfatal ("bfd_set_section_contents");
+ bfd_close_all_done (abfd);
+ free (cwi.relocs);
return false;
}
offset += d->length;
@@ -684,7 +705,11 @@ write_coff_file (const char *filename, const char *target,
{
if (res_to_bin (cwi.wrbfd, (rc_uint_type) offset, rd->res)
== (rc_uint_type) -1)
- return false;
+ {
+ bfd_close_all_done (abfd);
+ free (cwi.relocs);
+ return false;
+ }
offset += rd->length;
}
@@ -693,6 +718,7 @@ write_coff_file (const char *filename, const char *target,
if (! bfd_close (abfd))
{
bfd_nonfatal ("bfd_close");
+ free (cwi.relocs);
return false;
}
diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c
index 0f36741..46b26d4 100644
--- a/gas/config/tc-m68k.c
+++ b/gas/config/tc-m68k.c
@@ -6754,7 +6754,6 @@ s_mri_for (int qual)
struct mri_control_info *n;
char *buf;
char *s;
- char ex[2];
/* The syntax is
FOR.q var = init { TO | DOWNTO } end [ BY by ] DO.e
@@ -6935,12 +6934,14 @@ s_mri_for (int qual)
mri_assemble (buf);
/* bcc bottom. */
- ex[0] = TOLOWER (extent);
- ex[1] = '\0';
- if (up)
- sprintf (buf, "blt%s %s", ex, n->bottom);
- else
- sprintf (buf, "bgt%s %s", ex, n->bottom);
+ s = buf;
+ *s++ = 'b';
+ *s++ = up ? 'l' : 'g';
+ *s++ = 't';
+ if (extent != '\0')
+ *s++ = TOLOWER (extent);
+ *s++ = ' ';
+ strcpy (s, n->bottom);
mri_assemble (buf);
/* Put together the add or sub instruction used by ENDF. */
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 659c952..55cf02f 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -1041,13 +1041,6 @@ static struct dwo_unit *lookup_dwo_unit_in_dwp
static void open_and_init_dwp_file (dwarf2_per_objfile *per_objfile);
-static struct dwo_unit *lookup_dwo_comp_unit
- (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir,
- ULONGEST signature);
-
-static struct dwo_unit *lookup_dwo_type_unit
- (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir);
-
static void queue_and_load_all_dwo_tus (dwarf2_cu *cu);
static void process_cu_includes (dwarf2_per_objfile *per_objfile);
@@ -2396,10 +2389,11 @@ read_abbrev_offset (dwarf2_per_objfile *per_objfile,
and fill them into DWO_FILE's type unit hash table. It will process only
type units, therefore DW_UT_type. */
-static void
-create_dwo_debug_type_hash_table (dwarf2_per_bfd *per_bfd, dwo_file *dwo_file,
- dwarf2_section_info *section,
- rcuh_kind section_kind)
+void
+cutu_reader::create_dwo_debug_type_hash_table (dwarf2_per_bfd *per_bfd,
+ dwo_file *dwo_file,
+ dwarf2_section_info *section,
+ rcuh_kind section_kind)
{
struct dwarf2_section_info *abbrev_section;
bfd *abfd;
@@ -2484,8 +2478,8 @@ create_dwo_debug_type_hash_table (dwarf2_per_bfd *per_bfd, dwo_file *dwo_file,
Note: This function processes DWO files only, not DWP files. */
-static void
-create_dwo_debug_types_hash_table
+void
+cutu_reader::create_dwo_debug_types_hash_table
(dwarf2_per_bfd *per_bfd, dwo_file *dwo_file,
gdb::array_view<dwarf2_section_info> type_sections)
{
@@ -2879,8 +2873,9 @@ lookup_dwo_id (struct dwarf2_cu *cu, struct die_info* comp_unit_die)
Returns nullptr if the specified DWO unit cannot be found. */
-static struct dwo_unit *
-lookup_dwo_unit (dwarf2_cu *cu, die_info *comp_unit_die, const char *dwo_name)
+dwo_unit *
+cutu_reader::lookup_dwo_unit (dwarf2_cu *cu, die_info *comp_unit_die,
+ const char *dwo_name)
{
#if CXX_STD_THREAD
/* We need a lock here to handle the DWO hash table. */
@@ -6312,8 +6307,8 @@ lookup_dwo_file (dwarf2_per_bfd *per_bfd, const char *dwo_name,
/* Create the dwo_units for the CUs in a DWO_FILE.
Note: This function processes DWO files only, not DWP files. */
-static void
-create_dwo_cus_hash_table (dwarf2_cu *cu, dwo_file &dwo_file)
+void
+cutu_reader::create_dwo_cus_hash_table (dwarf2_cu *cu, dwo_file &dwo_file)
{
dwarf2_per_objfile *per_objfile = cu->per_objfile;
dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
@@ -7520,9 +7515,9 @@ try_open_dwop_file (dwarf2_per_bfd *per_bfd, const char *file_name, int is_dwp,
Upon success, the canonicalized path of the file is stored in the bfd,
same as symfile_bfd_open. */
-static gdb_bfd_ref_ptr
-open_dwo_file (dwarf2_per_bfd *per_bfd, const char *file_name,
- const char *comp_dir)
+gdb_bfd_ref_ptr
+cutu_reader::open_dwo_file (dwarf2_per_bfd *per_bfd, const char *file_name,
+ const char *comp_dir)
{
if (IS_ABSOLUTE_PATH (file_name))
return try_open_dwop_file (per_bfd, file_name,
@@ -7557,9 +7552,9 @@ open_dwo_file (dwarf2_per_bfd *per_bfd, const char *file_name,
/* This function is mapped across the sections and remembers the offset and
size of each of the DWO debugging sections we are interested in. */
-static void
-dwarf2_locate_dwo_sections (struct objfile *objfile, bfd *abfd,
- asection *sectp, dwo_sections *dwo_sections)
+void
+cutu_reader::locate_dwo_sections (struct objfile *objfile, bfd *abfd,
+ asection *sectp, dwo_sections *dwo_sections)
{
const struct dwop_section_names *names = &dwop_section_names;
@@ -7606,9 +7601,9 @@ dwarf2_locate_dwo_sections (struct objfile *objfile, bfd *abfd,
by PER_CU. This is for the non-DWP case.
The result is NULL if DWO_NAME can't be found. */
-static dwo_file_up
-open_and_init_dwo_file (dwarf2_cu *cu, const char *dwo_name,
- const char *comp_dir)
+dwo_file_up
+cutu_reader::open_and_init_dwo_file (dwarf2_cu *cu, const char *dwo_name,
+ const char *comp_dir)
{
dwarf2_per_objfile *per_objfile = cu->per_objfile;
dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
@@ -7628,8 +7623,8 @@ open_and_init_dwo_file (dwarf2_cu *cu, const char *dwo_name,
dwo_file->dbfd = std::move (dbfd);
for (asection *sec : gdb_bfd_sections (dwo_file->dbfd))
- dwarf2_locate_dwo_sections (per_objfile->objfile, dwo_file->dbfd.get (),
- sec, &dwo_file->sections);
+ this->locate_dwo_sections (per_objfile->objfile, dwo_file->dbfd.get (), sec,
+ &dwo_file->sections);
create_dwo_cus_hash_table (cu, *dwo_file);
@@ -7922,9 +7917,10 @@ open_and_init_dwp_file (dwarf2_per_objfile *per_objfile)
The result is a pointer to the dwo_unit object or NULL if we didn't find it
(dwo_id mismatch or couldn't find the DWO/DWP file). */
-static struct dwo_unit *
-lookup_dwo_cutu (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir,
- ULONGEST signature, int is_debug_types)
+dwo_unit *
+cutu_reader::lookup_dwo_cutu (dwarf2_cu *cu, const char *dwo_name,
+ const char *comp_dir, ULONGEST signature,
+ int is_debug_types)
{
dwarf2_per_objfile *per_objfile = cu->per_objfile;
dwarf2_per_bfd *per_bfd = per_objfile->per_bfd;
@@ -8038,9 +8034,9 @@ lookup_dwo_cutu (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir,
/* Lookup the DWO CU DWO_NAME/SIGNATURE referenced from THIS_CU.
See lookup_dwo_cutu_unit for details. */
-static struct dwo_unit *
-lookup_dwo_comp_unit (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir,
- ULONGEST signature)
+dwo_unit *
+cutu_reader::lookup_dwo_comp_unit (dwarf2_cu *cu, const char *dwo_name,
+ const char *comp_dir, ULONGEST signature)
{
gdb_assert (!cu->per_cu->is_debug_types);
@@ -8050,8 +8046,9 @@ lookup_dwo_comp_unit (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir,
/* Lookup the DWO TU DWO_NAME/SIGNATURE referenced from THIS_TU.
See lookup_dwo_cutu_unit for details. */
-static struct dwo_unit *
-lookup_dwo_type_unit (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir)
+dwo_unit *
+cutu_reader::lookup_dwo_type_unit (dwarf2_cu *cu, const char *dwo_name,
+ const char *comp_dir)
{
gdb_assert (cu->per_cu->is_debug_types);
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index a7f39fb..a9a2aa4 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -1025,6 +1025,39 @@ private:
const char *read_dwo_str_index (ULONGEST str_index);
+ gdb_bfd_ref_ptr open_dwo_file (dwarf2_per_bfd *per_bfd, const char *file_name,
+ const char *comp_dir);
+
+ dwo_file_up open_and_init_dwo_file (dwarf2_cu *cu, const char *dwo_name,
+ const char *comp_dir);
+
+ void locate_dwo_sections (struct objfile *objfile, bfd *abfd, asection *sectp,
+ struct dwo_sections *dwo_sections);
+
+ void create_dwo_cus_hash_table (dwarf2_cu *cu, dwo_file &dwo_file);
+
+ void create_dwo_debug_types_hash_table
+ (dwarf2_per_bfd *per_bfd, dwo_file *dwo_file,
+ gdb::array_view<dwarf2_section_info> type_sections);
+
+ void create_dwo_debug_type_hash_table (dwarf2_per_bfd *per_bfd,
+ dwo_file *dwo_file,
+ dwarf2_section_info *section,
+ rcuh_kind section_kind);
+
+ dwo_unit *lookup_dwo_cutu (dwarf2_cu *cu, const char *dwo_name,
+ const char *comp_dir, ULONGEST signature,
+ int is_debug_types);
+
+ dwo_unit *lookup_dwo_comp_unit (dwarf2_cu *cu, const char *dwo_name,
+ const char *comp_dir, ULONGEST signature);
+
+ dwo_unit *lookup_dwo_type_unit (dwarf2_cu *cu, const char *dwo_name,
+ const char *comp_dir);
+
+ dwo_unit *lookup_dwo_unit (dwarf2_cu *cu, die_info *comp_unit_die,
+ const char *dwo_name);
+
/* The bfd of die_section. */
bfd *m_abfd;
diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
index 0f2f272..8dcbeaa 100644
--- a/gdb/microblaze-linux-tdep.c
+++ b/gdb/microblaze-linux-tdep.c
@@ -49,6 +49,9 @@ microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
/* Determine appropriate breakpoint contents and size for this address. */
bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
+ /* Make sure we see the memory breakpoints. */
+ scoped_restore restore_memory
+ = make_scoped_restore_show_memory_breakpoints (1);
val = target_read_memory (addr, old_contents, bplen);
/* If our breakpoint is no longer at the address, this means that the