+2020-03-26 Tom Tromey <tom@tromey.com>
+
+ * dwarf2/read.h (struct dwarf2_per_objfile) <read_line_string>:
+ Declare method.
+ * dwarf2/read.c (read_attribute_value): Update.
+ (dwarf2_per_objfile::read_line_string): Rename from
+ read_indirect_line_string.
+ (read_formatted_entries): Update.
+
2020-03-26 Tom Tromey <tom@tromey.com>
* dwarf2/macro.c (dwarf_decode_macro_bytes): Use objfile local
(struct dwarf2_per_objfile *dwarf2_per_objfile, bfd *, const gdb_byte *,
const struct comp_unit_head *, unsigned int *);
-static const char *read_indirect_line_string
- (struct dwarf2_per_objfile *dwarf2_per_objfile, bfd *, const gdb_byte *,
- const struct comp_unit_head *, unsigned int *);
-
static const char *read_indirect_string_at_offset
(struct dwarf2_per_objfile *dwarf2_per_objfile, LONGEST str_offset);
case DW_FORM_line_strp:
if (!cu->per_cu->is_dwz)
{
- DW_STRING (attr) = read_indirect_line_string (dwarf2_per_objfile,
- abfd, info_ptr,
- cu_header, &bytes_read);
+ DW_STRING (attr)
+ = dwarf2_per_objfile->read_line_string (info_ptr, cu_header,
+ &bytes_read);
DW_STRING_IS_CANONICAL (attr) = 0;
info_ptr += bytes_read;
break;
return read_indirect_string_at_offset (dwarf2_per_objfile, str_offset);
}
-/* Return pointer to string at .debug_line_str offset as read from BUF.
- BUF is assumed to be in a compilation unit described by CU_HEADER.
- Return *BYTES_READ_PTR count of bytes read from BUF. */
+/* See read.h. */
-static const char *
-read_indirect_line_string (struct dwarf2_per_objfile *dwarf2_per_objfile,
- bfd *abfd, const gdb_byte *buf,
+const char *
+dwarf2_per_objfile::read_line_string (const gdb_byte *buf,
const struct comp_unit_head *cu_header,
unsigned int *bytes_read_ptr)
{
+ bfd *abfd = objfile->obfd;
LONGEST str_offset = cu_header->read_offset (abfd, buf, bytes_read_ptr);
- return dwarf2_per_objfile->line_str.read_string (dwarf2_per_objfile->objfile,
- str_offset,
- "DW_FORM_line_strp");
+ return line_str.read_string (objfile, str_offset, "DW_FORM_line_strp");
}
/* Given index ADDR_INDEX in .debug_addr, fetch the value.
break;
case DW_FORM_line_strp:
- string.emplace (read_indirect_line_string (dwarf2_per_objfile,
- abfd, buf,
- cu_header,
- &bytes_read));
+ string.emplace
+ (dwarf2_per_objfile->read_line_string (buf,
+ cu_header,
+ &bytes_read));
buf += bytes_read;
break;
/* Free all cached compilation units. */
void free_cached_comp_units ();
+
+ /* Return pointer to string at .debug_line_str offset as read from BUF.
+ BUF is assumed to be in a compilation unit described by CU_HEADER.
+ Return *BYTES_READ_PTR count of bytes read from BUF. */
+ const char *read_line_string (const gdb_byte *buf,
+ const struct comp_unit_head *cu_header,
+ unsigned int *bytes_read_ptr);
+
private:
/* This function is mapped across the sections and remembers the
offset and size of each of the debugging sections we are