Skip to content

Commit 2ca1ef1

Browse files
author
Jenkins
committed
Merge branch 'master' into merge-job
2 parents dbdf657 + 2786cbf commit 2ca1ef1

20 files changed

Lines changed: 64 additions & 42 deletions

bfd/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
1717
In releases, the date is not included in either version strings or
1818
sonames. */
19-
#define BFD_VERSION_DATE 20260528
19+
#define BFD_VERSION_DATE 20260529
2020
#define BFD_VERSION @bfd_version@
2121
#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
2222
#define REPORT_BUGS_TO @report_bugs_to@

gdb/build-id.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ build_id_bfd_get (bfd *abfd)
4242
if (abfd == nullptr)
4343
return nullptr;
4444

45-
if (!bfd_check_format (abfd, bfd_object)
46-
&& !bfd_check_format (abfd, bfd_core))
45+
if (!gdb_bfd_check_format (abfd, bfd_object)
46+
&& !gdb_bfd_check_format (abfd, bfd_core))
4747
return NULL;
4848

4949
if (abfd->build_id != NULL)

gdb/cli/cli-dump.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ bfd_openr_or_error (const char *filename, const char *target)
8989
styled_string (file_name_style.style (), filename),
9090
bfd_errmsg (bfd_get_error ()));
9191

92-
if (!bfd_check_format (ibfd.get (), bfd_object))
92+
if (!gdb_bfd_check_format (ibfd.get (), bfd_object))
9393
error (_("'%ps' is not a recognized file format."),
9494
styled_string (file_name_style.style (), filename));
9595

gdb/compile/compile-object-load.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ compile_object_load (const compile_file_names &file_names,
621621
styled_string (file_name_style.style (), filename.get ()),
622622
bfd_errmsg (bfd_get_error ()));
623623

624-
if (!bfd_check_format_matches (abfd.get (), bfd_object, &matching))
624+
if (!gdb_bfd_check_format_matches (abfd.get (), bfd_object, &matching))
625625
error (_("\"%ps\": not in loadable format: %s"),
626626
styled_string (file_name_style.style (), filename.get ()),
627627
gdb_bfd_errmsg (bfd_get_error (), matching).c_str ());

gdb/corelow.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ core_target::build_file_mappings ()
468468
= gdb_bfd_open (expanded_fname.get (), gnutarget);
469469

470470
if (tmp_bfd != nullptr
471-
&& bfd_check_format (tmp_bfd.get (), bfd_object)
471+
&& gdb_bfd_check_format (tmp_bfd.get (), bfd_object)
472472
&& build_id_bfd_get (tmp_bfd.get ()) != nullptr)
473473
{
474474
/* The newly opened TMP_BFD has a build-id, and this mapped
@@ -487,7 +487,7 @@ core_target::build_file_mappings ()
487487

488488
if ((expanded_fname == nullptr
489489
|| abfd == nullptr
490-
|| !bfd_check_format (abfd.get (), bfd_object))
490+
|| !gdb_bfd_check_format (abfd.get (), bfd_object))
491491
&& file_data.build_id != nullptr)
492492
{
493493
abfd = find_objfile_by_build_id (current_program_space,
@@ -510,7 +510,7 @@ core_target::build_file_mappings ()
510510

511511
if (expanded_fname == nullptr
512512
|| abfd == nullptr
513-
|| !bfd_check_format (abfd.get (), bfd_object))
513+
|| !gdb_bfd_check_format (abfd.get (), bfd_object))
514514
{
515515
/* If ABFD was opened, but the wrong format, close it now. */
516516
abfd = nullptr;
@@ -1089,7 +1089,7 @@ core_target_open (const char *arg, int from_tty)
10891089
if (temp_bfd == NULL)
10901090
perror_with_name (filename.c_str ());
10911091

1092-
if (!bfd_check_format (temp_bfd.get (), bfd_core))
1092+
if (!gdb_bfd_check_format (temp_bfd.get (), bfd_core))
10931093
{
10941094
/* Do it after the err msg */
10951095
/* FIXME: should be checking for errors from bfd_close (for one

gdb/dwarf2/dwz.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ get_debug_sup_info (bfd *abfd,
171171
static bool
172172
verify_id (bfd *abfd, size_t len, const bfd_byte *buildid, bool dwarf5)
173173
{
174-
if (!bfd_check_format (abfd, bfd_object))
174+
if (!gdb_bfd_check_format (abfd, bfd_object))
175175
return false;
176176

177177
if (dwarf5)

gdb/dwarf2/read.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6752,21 +6752,14 @@ try_open_dwop_file (dwarf2_per_bfd *per_bfd, const char *file_name, int is_dwp,
67526752
if (sym_bfd == NULL)
67536753
return NULL;
67546754

6755-
{
6756-
/* The operations below are not thread-safe, use a lock to synchronize
6757-
concurrent accesses. */
6758-
static gdb::mutex mutex;
6759-
gdb::lock_guard<gdb::mutex> lock (mutex);
6760-
6761-
if (!bfd_check_format (sym_bfd.get (), bfd_object))
6762-
return NULL;
6755+
if (!gdb_bfd_check_format (sym_bfd.get (), bfd_object))
6756+
return NULL;
67636757

6764-
/* Success. Record the bfd as having been included by the objfile's bfd.
6758+
/* Success. Record the bfd as having been included by the objfile's bfd.
67656759
This is important because things like demangled_names_hash lives in the
67666760
objfile's per_bfd space and may have references to things like symbol
67676761
names that live in the DWO/DWP file's per_bfd space. PR 16426. */
6768-
gdb_bfd_record_inclusion (per_bfd->obfd, sym_bfd.get ());
6769-
}
6762+
gdb_bfd_record_inclusion (per_bfd->obfd, sym_bfd.get ());
67706763

67716764
return sym_bfd;
67726765
}

gdb/exec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ exec_file_attach (const char *filename, int from_tty)
478478
(make_unique_xstrdup (gdb_realpath_keepfile
479479
(scratch_pathname).c_str ()));
480480

481-
if (!bfd_check_format_matches (current_program_space->exec_bfd (),
481+
if (!gdb_bfd_check_format_matches (current_program_space->exec_bfd (),
482482
bfd_object, &matching))
483483
{
484484
/* Make sure to close exec_bfd, or else "run" might try to use

gdb/gdb_bfd.c

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,9 +1026,9 @@ gdb_bfd_openr_next_archived_file (bfd *archive, bfd *previous)
10261026
void
10271027
gdb_bfd_record_inclusion (bfd *includer, bfd *includee)
10281028
{
1029-
struct gdb_bfd_data *gdata;
1029+
gdb::lock_guard<gdb::recursive_mutex> guard (gdb_bfd_mutex);
10301030

1031-
gdata = (struct gdb_bfd_data *) bfd_usrdata (includer);
1031+
struct gdb_bfd_data *gdata = (struct gdb_bfd_data *) bfd_usrdata (includer);
10321032
gdata->included_bfds.push_back (gdb_bfd_ref_ptr::new_reference (includee));
10331033
}
10341034

@@ -1200,6 +1200,26 @@ gdb_bfd_canonicalize_symtab (bfd *abfd, bool should_throw)
12001200
symbol_table.size () - 1);
12011201
}
12021202

1203+
/* See gdb_bfd.h. */
1204+
1205+
bool
1206+
gdb_bfd_check_format (bfd *abfd, bfd_format format)
1207+
{
1208+
gdb::lock_guard<gdb::recursive_mutex> guard (gdb_bfd_mutex);
1209+
1210+
return bfd_check_format (abfd, format);
1211+
}
1212+
1213+
/* See gdb_bfd.h. */
1214+
1215+
bool
1216+
gdb_bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
1217+
{
1218+
gdb::lock_guard<gdb::recursive_mutex> guard (gdb_bfd_mutex);
1219+
1220+
return bfd_check_format_matches (abfd, format, matching);
1221+
}
1222+
12031223
/* Implement the 'maint info bfd' command. */
12041224

12051225
static void

gdb/gdb_bfd.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ extern long gdb_bfd_get_mtime (bfd *abfd)
268268
/* A wrapper for bfd_errmsg to produce a more helpful error message
269269
in the case of bfd_error_file_ambiguously recognized.
270270
MATCHING, if non-NULL, is the corresponding argument to
271-
bfd_check_format_matches, and will be freed. */
271+
gdb_bfd_check_format_matches, and will be freed. */
272272

273273
extern std::string gdb_bfd_errmsg (bfd_error_type error_tag, char **matching);
274274

@@ -289,4 +289,13 @@ extern void gdb_bfd_init ();
289289
extern gdb::array_view<asymbol *> gdb_bfd_canonicalize_symtab
290290
(bfd *abfd, bool should_throw = true);
291291

292+
/* A wrapper for bfd_check_format that acquires the BFD lock. */
293+
294+
extern bool gdb_bfd_check_format (bfd *abfd, bfd_format format);
295+
296+
/* A wrapper for bfd_check_format_matches that acquires the BFD lock. */
297+
298+
extern bool gdb_bfd_check_format_matches (bfd *abfd, bfd_format format,
299+
char ***matching);
300+
292301
#endif /* GDB_GDB_BFD_H */

0 commit comments

Comments
 (0)