diff options
author | Mark Kettenis <kettenis@gnu.org> | 2004-11-04 21:15:15 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@gnu.org> | 2004-11-04 21:15:15 +0000 |
commit | a81b10aef7a31ca324e3588f6c646359c3a77204 (patch) | |
tree | 0662decc22ba9c1d5ea88b71834798bea6dc2798 /gdb | |
parent | c3c766200ae4047a1d73cccc6f98ee04b02f61b2 (diff) | |
download | gdb-a81b10aef7a31ca324e3588f6c646359c3a77204.zip gdb-a81b10aef7a31ca324e3588f6c646359c3a77204.tar.gz gdb-a81b10aef7a31ca324e3588f6c646359c3a77204.tar.bz2 |
* dwarf2-frame.c (read_encoded_value): Change type of third
argument to `unsigned char *'. Add support for LEB128 encodings.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/dwarf2-frame.c | 20 |
2 files changed, 22 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b0c52ea..da910ab 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2004-11-04 Mark Kettenis <kettenis@gnu.org> + + * dwarf2-frame.c (read_encoded_value): Change type of third + argument to `unsigned char *'. Add support for LEB128 encodings. + 2004-11-04 Jim Blandy <jimb@redhat.com> * gdbtypes.c (make_qualified_type): Doc fix. Add assertion to diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c index c96b673..ba96927 100644 --- a/gdb/dwarf2-frame.c +++ b/gdb/dwarf2-frame.c @@ -1067,7 +1067,7 @@ size_of_encoded_value (unsigned char encoding) static CORE_ADDR read_encoded_value (struct comp_unit *unit, unsigned char encoding, - char *buf, unsigned int *bytes_read_ptr) + unsigned char *buf, unsigned int *bytes_read_ptr) { int ptr_len = size_of_encoded_value (DW_EH_PE_absptr); ptrdiff_t offset; @@ -1088,7 +1088,7 @@ read_encoded_value (struct comp_unit *unit, unsigned char encoding, break; case DW_EH_PE_pcrel: base = bfd_get_section_vma (unit->bfd, unit->dwarf_frame_section); - base += (buf - unit->dwarf_frame_buffer); + base += ((char *) buf - unit->dwarf_frame_buffer); break; case DW_EH_PE_datarel: base = unit->dbase; @@ -1106,7 +1106,7 @@ read_encoded_value (struct comp_unit *unit, unsigned char encoding, break; case DW_EH_PE_aligned: base = 0; - offset = buf - unit->dwarf_frame_buffer; + offset = (char *) buf - unit->dwarf_frame_buffer; if ((offset % ptr_len) != 0) { *bytes_read_ptr = ptr_len - (offset % ptr_len); @@ -1122,6 +1122,13 @@ read_encoded_value (struct comp_unit *unit, unsigned char encoding, switch (encoding & 0x0f) { + case DW_EH_PE_uleb128: + { + ULONGEST value; + unsigned char *end_buf = buf + (sizeof (value) + 1) * 8 / 7; + *bytes_read_ptr = read_uleb128 (buf, end_buf, &value) - buf; + return base + value; + } case DW_EH_PE_udata2: *bytes_read_ptr += 2; return (base + bfd_get_16 (unit->abfd, (bfd_byte *) buf)); @@ -1131,6 +1138,13 @@ read_encoded_value (struct comp_unit *unit, unsigned char encoding, case DW_EH_PE_udata8: *bytes_read_ptr += 8; return (base + bfd_get_64 (unit->abfd, (bfd_byte *) buf)); + case DW_EH_PE_sleb128: + { + LONGEST value; + char *end_buf = buf + (sizeof (value) + 1) * 8 / 7; + *bytes_read_ptr = read_sleb128 (buf, end_buf, &value) - buf; + return base + value; + } case DW_EH_PE_sdata2: *bytes_read_ptr += 2; return (base + bfd_get_signed_16 (unit->abfd, (bfd_byte *) buf)); |