This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [patch] Add dwarf3 frame CIE support
- From: Paul Brook <paul at codesourcery dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Wed, 12 May 2004 00:26:24 +0100
- Subject: Re: [patch] Add dwarf3 frame CIE support
- Organization: CodeSourcery
- References: <200405111934.49742.paul@codesourcery.com>
On Tuesday 11 May 2004 19:34, Paul Brook wrote:
> 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.
Whoops, wrong version of the patch. This one actually works.
Paul
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 23:17:48 -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, buf,
+ &bytes_read);
+ buf += bytes_read;
cie->saw_z_augmentation = (*augmentation == 'z');
if (cie->saw_z_augmentation)