diff options
Diffstat (limited to 'gdb/dwarf2/dwz.c')
-rw-r--r-- | gdb/dwarf2/dwz.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/gdb/dwarf2/dwz.c b/gdb/dwarf2/dwz.c index 5c855f4..f53a5b6 100644 --- a/gdb/dwarf2/dwz.c +++ b/gdb/dwarf2/dwz.c @@ -188,6 +188,8 @@ dwarf2_read_dwz_file (dwarf2_per_objfile *per_objfile) only be run in the main thread. */ gdb_assert (is_main_thread ()); + /* This should only be called once. */ + gdb_assert (!per_bfd->dwz_file.has_value ()); /* Set this early, so that on error it remains NULL. */ per_bfd->dwz_file.emplace (nullptr); @@ -281,14 +283,9 @@ dwarf2_read_dwz_file (dwarf2_per_objfile *per_objfile) struct dwz_file * dwarf2_get_dwz_file (dwarf2_per_bfd *per_bfd, bool require) { - gdb_assert (!require || per_bfd->dwz_file.has_value ()); - - dwz_file *result = nullptr; - if (per_bfd->dwz_file.has_value ()) - { - result = per_bfd->dwz_file->get (); - if (require && result == nullptr) - error (_("could not read '.gnu_debugaltlink' section")); - } + gdb_assert (per_bfd->dwz_file.has_value ()); + dwz_file *result = per_bfd->dwz_file->get (); + if (require && result == nullptr) + error (_("could not read '.gnu_debugaltlink' section")); return result; } |