Add dwz.c and dwz_file::read_string

This changes read_indirect_string_from_dwz to be a method on the
dwz_file, and adds a new dwarf2/dwz.c file.

gdb/ChangeLog
2020-03-26  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.c (read_attribute_value): Update.
	(read_indirect_string_from_dwz): Move to dwz.c; change into
	method.
	(dwarf_decode_macro_bytes): Update.
	* dwarf2/dwz.h (struct dwz_file) <read_string>: Declare method.
	* dwarf2/dwz.c: New file.
	* Makefile.in (COMMON_SFILES): Add dwz.c.
This commit is contained in:
Tom Tromey
2020-03-26 09:28:08 -06:00
parent 9fda78b611
commit 0314b3901c
5 changed files with 60 additions and 32 deletions

View File

@@ -53,6 +53,13 @@ struct dwz_file
/* If we loaded the index from an external file, this contains the
resources associated to the open file, memory mapping, etc. */
std::unique_ptr<index_cache_resource> index_cache_res;
/* Read a string at offset STR_OFFSET in the .debug_str section from
this dwz file. Throw an error if the offset is too large. If
the string consists of a single NUL byte, return NULL; otherwise
return a pointer to the string. */
const char *read_string (struct objfile *objfile, LONGEST str_offset);
};
#endif /* GDB_DWARF2_DWZ_H */