From: dje@google.com (Doug Evans)
To: gdb-patches@sourceware.org
Cc: ccoutant@google.com, saugustine@google.com
Subject: [RFA 1/3] Initial Fission support, change reference forms to use DW_UNSND
Date: Wed, 18 Apr 2012 18:54:00 -0000 [thread overview]
Message-ID: <20120418184709.D50152461AF@ruffy.mtv.corp.google.com> (raw)
Hi.
This is the first patch in the Fission series.
It is a standalone patch, and simply moves reference attributes
from DW_ADDR to DW_UNSND.
[plus adds missing support for ref8, ref_udata to the pretty-printer]
Regression tested on amd64-linux.
Ok to commit?
2012-04-18 Doug Evans <dje@google.com>
* dwarf2read.c (partial_die_full_name): Record DW_FORM_ref_addr in
attr.u.unsnd instead of attr.u.addr.
(read_attribute_value) Ditto for cases DW_FORM_ref_addr,
DW_FORM_ref1, DW_FORM_ref2, DW_FORM_ref4, DW_FORM_reg8,
DW_FORM_ref_udata.
(dump_die_shallow): Update cases DW_FORM_ref_addr,
DW_FORM_ref1, DW_FORM_ref2, DW_FORM_ref4. Add cases DW_FORM_reg8,
DW_FORM_ref_udata.
(dwarf2_get_ref_die_offset): Use DW_UNSND for reference attributes.
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.635
diff -u -p -r1.635 dwarf2read.c
--- dwarf2read.c 18 Apr 2012 06:24:48 -0000 1.635
+++ dwarf2read.c 18 Apr 2012 15:50:47 -0000
@@ -3996,6 +3996,7 @@ partial_die_parent_scope (struct partial
/* Return the fully scoped name associated with PDI, from compilation unit
CU. The result will be allocated with malloc. */
+
static char *
partial_die_full_name (struct partial_die_info *pdi,
struct dwarf2_cu *cu)
@@ -4019,7 +4020,7 @@ partial_die_full_name (struct partial_di
/* DW_FORM_ref_addr is using section offset. */
attr.name = 0;
attr.form = DW_FORM_ref_addr;
- attr.u.addr = pdi->offset.sect_off;
+ attr.u.unsnd = pdi->offset.sect_off;
die = follow_die_ref (NULL, &attr, &ref_cu);
return xstrdup (dwarf2_full_name (NULL, die, ref_cu));
@@ -10226,10 +10227,10 @@ read_attribute_value (struct attribute *
{
case DW_FORM_ref_addr:
if (cu->header.version == 2)
- DW_ADDR (attr) = read_address (abfd, info_ptr, cu, &bytes_read);
+ DW_UNSND (attr) = read_address (abfd, info_ptr, cu, &bytes_read);
else
- DW_ADDR (attr) = read_offset (abfd, info_ptr,
- &cu->header, &bytes_read);
+ DW_UNSND (attr) = read_offset (abfd, info_ptr,
+ &cu->header, &bytes_read);
info_ptr += bytes_read;
break;
case DW_FORM_addr:
@@ -10316,23 +10317,23 @@ read_attribute_value (struct attribute *
info_ptr += bytes_read;
break;
case DW_FORM_ref1:
- DW_ADDR (attr) = (cu->header.offset.sect_off
- + read_1_byte (abfd, info_ptr));
+ DW_UNSND (attr) = (cu->header.offset.sect_off
+ + read_1_byte (abfd, info_ptr));
info_ptr += 1;
break;
case DW_FORM_ref2:
- DW_ADDR (attr) = (cu->header.offset.sect_off
- + read_2_bytes (abfd, info_ptr));
+ DW_UNSND (attr) = (cu->header.offset.sect_off
+ + read_2_bytes (abfd, info_ptr));
info_ptr += 2;
break;
case DW_FORM_ref4:
- DW_ADDR (attr) = (cu->header.offset.sect_off
- + read_4_bytes (abfd, info_ptr));
+ DW_UNSND (attr) = (cu->header.offset.sect_off
+ + read_4_bytes (abfd, info_ptr));
info_ptr += 4;
break;
case DW_FORM_ref8:
- DW_ADDR (attr) = (cu->header.offset.sect_off
- + read_8_bytes (abfd, info_ptr));
+ DW_UNSND (attr) = (cu->header.offset.sect_off
+ + read_8_bytes (abfd, info_ptr));
info_ptr += 8;
break;
case DW_FORM_ref_sig8:
@@ -10344,8 +10345,8 @@ read_attribute_value (struct attribute *
info_ptr += 8;
break;
case DW_FORM_ref_udata:
- DW_ADDR (attr) = (cu->header.offset.sect_off
- + read_unsigned_leb128 (abfd, info_ptr, &bytes_read));
+ DW_UNSND (attr) = (cu->header.offset.sect_off
+ + read_unsigned_leb128 (abfd, info_ptr, &bytes_read));
info_ptr += bytes_read;
break;
case DW_FORM_indirect:
@@ -13970,7 +13971,6 @@ dump_die_shallow (struct ui_file *f, int
switch (die->attrs[i].form)
{
- case DW_FORM_ref_addr:
case DW_FORM_addr:
fprintf_unfiltered (f, "address: ");
fputs_filtered (hex_string (DW_ADDR (&die->attrs[i])), f);
@@ -13986,11 +13986,17 @@ dump_die_shallow (struct ui_file *f, int
fprintf_unfiltered (f, "expression: size %u",
DW_BLOCK (&die->attrs[i])->size);
break;
+ case DW_FORM_ref_addr:
+ fprintf_unfiltered (f, "ref address: ");
+ fputs_filtered (hex_string (DW_UNSND (&die->attrs[i])), f);
+ break;
case DW_FORM_ref1:
case DW_FORM_ref2:
case DW_FORM_ref4:
+ case DW_FORM_ref8:
+ case DW_FORM_ref_udata:
fprintf_unfiltered (f, "constant ref: 0x%lx (adjusted)",
- (long) (DW_ADDR (&die->attrs[i])));
+ (long) (DW_UNSND (&die->attrs[i])));
break;
case DW_FORM_data1:
case DW_FORM_data2:
@@ -14129,7 +14135,7 @@ is_ref_attr (struct attribute *attr)
static sect_offset
dwarf2_get_ref_die_offset (struct attribute *attr)
{
- sect_offset retval = { DW_ADDR (attr) };
+ sect_offset retval = { DW_UNSND (attr) };
if (is_ref_attr (attr))
return retval;
next reply other threads:[~2012-04-18 18:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-18 18:54 Doug Evans [this message]
2012-04-19 0:55 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120418184709.D50152461AF@ruffy.mtv.corp.google.com \
--to=dje@google.com \
--cc=ccoutant@google.com \
--cc=gdb-patches@sourceware.org \
--cc=saugustine@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox