aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2/leb.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/dwarf2/leb.c')
-rw-r--r--gdb/dwarf2/leb.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gdb/dwarf2/leb.c b/gdb/dwarf2/leb.c
index ef7314e..02faaa9 100644
--- a/gdb/dwarf2/leb.c
+++ b/gdb/dwarf2/leb.c
@@ -110,3 +110,27 @@ read_initial_length (bfd *abfd, const gdb_byte *buf, unsigned int *bytes_read,
return length;
}
+
+/* See leb.h. */
+
+LONGEST
+read_offset (bfd *abfd, const gdb_byte *buf, unsigned int offset_size)
+{
+ LONGEST retval = 0;
+
+ switch (offset_size)
+ {
+ case 4:
+ retval = bfd_get_32 (abfd, buf);
+ break;
+ case 8:
+ retval = bfd_get_64 (abfd, buf);
+ break;
+ default:
+ internal_error (__FILE__, __LINE__,
+ _("read_offset_1: bad switch [in module %s]"),
+ bfd_get_filename (abfd));
+ }
+
+ return retval;
+}