From 9938d15a01031e0aded4159adaa77d5b2b2319f6 Mon Sep 17 00:00:00 2001
From: Tom Tromey <tom@tromey.com>
Date: Sat, 6 Mar 2021 09:26:39 -0700
Subject: Move dwarf2_get_dwz_file to dwarf2/dwz.h

This moves dwarf2_get_dwz_file and some helper code to dwarf2/dwz.h.
The main benefit of this is just shrinking dwarf2/read.c a little bit.

gdb/ChangeLog
2021-03-06  Tom Tromey  <tom@tromey.com>

	* dwarf2/sect-names.h (dwarf2_elf_names): Declare.
	* dwarf2/read.h (dwarf2_get_dwz_file): Move to dwz.h.
	* dwarf2/read.c (dwarf2_elf_names): No longer static.
	(locate_dwz_sections, dwz_search_other_debugdirs)
	(dwarf2_get_dwz_file): Move to dwz.c.
	* dwarf2/dwz.h (dwarf2_get_dwz_file): Move declaration from
	read.h.
	* dwarf2/dwz.c (locate_dwz_sections, dwz_search_other_debugdirs)
	(dwarf2_get_dwz_file): Move from read.c.
---
 gdb/dwarf2/dwz.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

(limited to 'gdb/dwarf2/dwz.h')

diff --git a/gdb/dwarf2/dwz.h b/gdb/dwarf2/dwz.h
index c50aab8..634afbb 100644
--- a/gdb/dwarf2/dwz.h
+++ b/gdb/dwarf2/dwz.h
@@ -24,6 +24,8 @@
 #include "dwarf2/index-cache.h"
 #include "dwarf2/section.h"
 
+struct dwarf2_per_bfd;
+
 /* This represents a '.dwz' file.  */
 
 struct dwz_file
@@ -62,4 +64,13 @@ struct dwz_file
   const char *read_string (struct objfile *objfile, LONGEST str_offset);
 };
 
+/* Open the separate '.dwz' debug file, if needed.  If there is no
+   .gnu_debugaltlink section in the file, then the result depends on
+   REQUIRE: if REQUIRE is true, then error; if REQUIRE is false,
+   return NULL.  Always error if there is such a section but the file
+   cannot be found.  */
+
+extern dwz_file *dwarf2_get_dwz_file (dwarf2_per_bfd *per_bfd,
+				      bool require = false);
+
 #endif /* GDB_DWARF2_DWZ_H */
-- 
cgit v1.1