binutils-gdb/gdb/dwarf2/public.h
Tom Tromey 31de881f8f Always use dwarf2_initialize_objfile
Internally we noticed that some tests would fail like so on Windows:

warning: Section .debug_aranges in [...] has duplicate debug_info_offset 0x0, ignoring .debug_aranges.

Debugging showed that, in fact, a second CU was being created at this
offset.  We tracked this down to the fact that, while the ELF reader
is careful to re-use the per-BFD data, other readers are not, and
could re-read the DWARF data multiple times.

However, since the change to allow an objfile to have multiple "quick
symbol" implementations, there's no reason for this approach -- it's
safe and easy for all symbol readers to reuse the per-BFD data when
reading DWARF.

This patch implements this idea, simplifying dwarf2_build_psymtabs and
making it private, and then switching to dwarf2_initialize_objfile as
the sole way to start the DWARF reader.

Note that, while I think the call to dwarf2_build_frame_info in
machoread.c is also obsolete, I haven't attempted to remove it here.
2022-04-21 12:18:25 -06:00

44 lines
1.4 KiB
C

/* Public API for gdb DWARF reader
Copyright (C) 2021-2022 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef DWARF2_PUBLIC_H
#define DWARF2_PUBLIC_H
extern int dwarf2_has_info (struct objfile *,
const struct dwarf2_debug_sections *,
bool = false);
/* A DWARF names index variant. */
enum class dw_index_kind
{
/* GDB's own .gdb_index format. */
GDB_INDEX,
/* DWARF5 .debug_names. */
DEBUG_NAMES,
};
/* Initialize for reading DWARF for OBJFILE, and push the appropriate
entry on the objfile's "qf" list. */
extern void dwarf2_initialize_objfile (struct objfile *objfile);
extern void dwarf2_build_frame_info (struct objfile *);
#endif /* DWARF2_PUBLIC_H */