From: Jim Blandy <jimb@codesourcery.com>
To: Vladimir Prus <vladimir@codesourcery.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: Support constants for DW_AT_data_member_location
Date: Mon, 17 Dec 2007 19:30:00 -0000 [thread overview]
Message-ID: <m3r6hljh78.fsf@codesourcery.com> (raw)
In-Reply-To: <m37iji5rhc.fsf@codesourcery.com> (Jim Blandy's message of "Thu, 13 Dec 2007 11:23:11 -0800")
I've committed the following.
gdb/ChangeLog:
2007-12-17 Jim Blandy <jimb@codesourcery.com>
* dwarf2read.c (dwarf2_add_field): Correctly scale all byte
offsets obtained from DW_AT_data_member_location before recording
them in FIELD_BITPOS (*fp).
* dwarf2read.c (attr_form_is_section_offset): Doc fixes.
diff -r ac45448af75b -r 946effe2c5c8 gdb/dwarf2read.c
--- a/gdb/dwarf2read.c Mon Dec 17 10:34:43 2007 -0800
+++ b/gdb/dwarf2read.c Mon Dec 17 10:39:13 2007 -0800
@@ -3478,16 +3478,19 @@ dwarf2_add_field (struct field_info *fip
attr = dwarf2_attr (die, DW_AT_data_member_location, cu);
if (attr)
{
+ int byte_offset;
+
if (attr_form_is_section_offset (attr))
{
dwarf2_complex_location_expr_complaint ();
- FIELD_BITPOS (*fp) = 0;
+ byte_offset = 0;
}
else if (attr_form_is_constant (attr))
- FIELD_BITPOS (*fp) = dwarf2_get_attr_constant_value (attr, 0);
+ byte_offset = dwarf2_get_attr_constant_value (attr, 0);
else
- FIELD_BITPOS (*fp) =
- decode_locdesc (DW_BLOCK (attr), cu) * bits_per_byte;
+ byte_offset = decode_locdesc (DW_BLOCK (attr), cu);
+
+ FIELD_BITPOS (*fp) = byte_offset * bits_per_byte;
}
else
FIELD_BITPOS (*fp) = 0;
@@ -9734,9 +9737,14 @@ attr_form_is_block (struct attribute *at
|| attr->form == DW_FORM_block);
}
-/* Return non-zero if ATTR's value is a section offset (classes
- lineptr, loclistptr, macptr or rangelistptr). In this case,
- you may use DW_UNSND (attr) to retrieve the offset. */
+/* Return non-zero if ATTR's value is a section offset --- classes
+ lineptr, loclistptr, macptr or rangelistptr --- or zero, otherwise.
+ You may use DW_UNSND (attr) to retrieve such offsets.
+
+ Section 7.5.4, "Attribute Encodings", explains that no attribute
+ may have a value that belongs to more than one of these classes; it
+ would be ambiguous if we did, because we use the same forms for all
+ of them. */
static int
attr_form_is_section_offset (struct attribute *attr)
{
prev parent reply other threads:[~2007-12-17 18:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-29 9:54 Vladimir Prus
2007-11-29 19:39 ` Jim Blandy
2007-11-29 20:18 ` Vladimir Prus
2007-12-01 1:48 ` Jim Blandy
2007-12-13 17:57 ` Vladimir Prus
2007-12-13 19:29 ` Jim Blandy
2007-12-17 19:30 ` Jim Blandy [this message]
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=m3r6hljh78.fsf@codesourcery.com \
--to=jimb@codesourcery.com \
--cc=gdb-patches@sources.redhat.com \
--cc=vladimir@codesourcery.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