[patch] Add dwarf3 frame CIE support
Paul Brook
paul@codesourcery.com
Tue May 11 18:34:00 GMT 2004
The patch below adds support for dwarf3 format CIE frame records.
Changes should be self-explanatory, and backwards compatible.
Ok?
Paul
2004-05-11 Paul Brook <paul@codesourcery.com>
* gdb/dwarf2-frame.c (decode_frame_entry_1): Decode ver3 CIE records.
Index: gdb/dwarf2-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2-frame.c,v
retrieving revision 1.34
diff -u -p -r1.34 dwarf2-frame.c
--- gdb/dwarf2-frame.c 1 May 2004 10:55:19 -0000 1.34
+++ gdb/dwarf2-frame.c 11 May 2004 18:31:54 -0000
@@ -1268,6 +1268,8 @@ decode_frame_entry_1 (struct comp_unit *
/* This is a CIE. */
struct dwarf2_cie *cie;
char *augmentation;
+ unsigned int cie_version;
+
/* Record the offset into the .debug_frame section of this CIE. */
cie_pointer = start - unit->dwarf_frame_buffer;
@@ -1288,7 +1290,9 @@ decode_frame_entry_1 (struct comp_unit *
cie->encoding = encoding_for_size (unit->addr_size);
/* Check version number. */
- if (read_1_byte (unit->abfd, buf) != DW_CIE_VERSION)
+ cie_version = read_1_byte (unit->abfd, buf);
+ if (cie_version != 1
+ && cie_version != 3)
return NULL;
buf += 1;
@@ -1314,8 +1318,15 @@ decode_frame_entry_1 (struct comp_unit *
read_signed_leb128 (unit->abfd, buf, &bytes_read);
buf += bytes_read;
- cie->return_address_register = read_1_byte (unit->abfd, buf);
- buf += 1;
+ if (cie->version == 1)
+ {
+ cie->return_address_register = read_1_byte (unit->abfd, buf);
+ bytes_read = 1;
+ }
+ else
+ cie->return_address_register = read_unsigned_leb128 (unit->abfd,
+ &bytes_read);
+ buf += bytes_read;
cie->saw_z_augmentation = (*augmentation == 'z');
if (cie->saw_z_augmentation)
More information about the Gdb-patches
mailing list