aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2/section.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/dwarf2/section.c')
-rw-r--r--gdb/dwarf2/section.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gdb/dwarf2/section.c b/gdb/dwarf2/section.c
index 9714368..7766179 100644
--- a/gdb/dwarf2/section.c
+++ b/gdb/dwarf2/section.c
@@ -187,3 +187,20 @@ dwarf2_section_info::read (struct objfile *objfile)
bfd_section_name (sectp), bfd_get_filename (abfd));
}
}
+
+const char *
+dwarf2_section_info::read_string (struct objfile *objfile, LONGEST str_offset,
+ const char *form_name)
+{
+ read (objfile);
+ if (buffer == NULL)
+ error (_("%s used without %s section [in module %s]"),
+ form_name, get_name (), get_file_name ());
+ if (str_offset >= size)
+ error (_("%s pointing outside of %s section [in module %s]"),
+ form_name, get_name (), get_file_name ());
+ gdb_assert (HOST_CHAR_BIT == 8);
+ if (buffer[str_offset] == '\0')
+ return NULL;
+ return (const char *) (buffer + str_offset);
+}