aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2009-07-08 18:07:47 +0000
committerMark Wielaard <mark@gcc.gnu.org>2009-07-08 18:07:47 +0000
commit3d78d293d49ccc8245ffe43ac9b17e172ee1873d (patch)
tree01104f4e6c33221391ecb469d8281e5275c76006 /gcc
parentac2e563fcfce40295dc962d8e98796b794726b0f (diff)
downloadgcc-3d78d293d49ccc8245ffe43ac9b17e172ee1873d.zip
gcc-3d78d293d49ccc8245ffe43ac9b17e172ee1873d.tar.gz
gcc-3d78d293d49ccc8245ffe43ac9b17e172ee1873d.tar.bz2
re PR debug/40659 (A simple struct member offset doesn't need a full dwarf location expression)
2009-07-08 Mark Wielaard <mjw@redhat.com> PR debug/40659 * dwarf2out.c (add_data_member_location_attribute): When we have only a constant offset don't emit a new location description using DW_OP_plus_uconst, but just add the constant with add_AT_int, when dwarf_version > 2. From-SVN: r149377
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/dwarf2out.c35
2 files changed, 30 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 47f8920..c78577a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2009-07-08 Mark Wielaard <mjw@redhat.com>
+
+ PR debug/40659
+ * dwarf2out.c (add_data_member_location_attribute): When we have
+ only a constant offset don't emit a new location description using
+ DW_OP_plus_uconst, but just add the constant with add_AT_int, when
+ dwarf_version > 2.
+
2009-07-08 Richard Henderson <rth@redhat.com>
PR target/38900
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 01b534c..2e30a0c 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -11475,22 +11475,31 @@ add_data_member_location_attribute (dw_die_ref die, tree decl)
if (! loc_descr)
{
- enum dwarf_location_atom op;
-
- /* The DWARF2 standard says that we should assume that the structure
- address is already on the stack, so we can specify a structure field
- address by using DW_OP_plus_uconst. */
-
+ if (dwarf_version > 2)
+ {
+ /* Don't need to output a location expression, just the constant. */
+ add_AT_int (die, DW_AT_data_member_location, offset);
+ return;
+ }
+ else
+ {
+ enum dwarf_location_atom op;
+
+ /* The DWARF2 standard says that we should assume that the structure
+ address is already on the stack, so we can specify a structure
+ field address by using DW_OP_plus_uconst. */
+
#ifdef MIPS_DEBUGGING_INFO
- /* ??? The SGI dwarf reader does not handle the DW_OP_plus_uconst
- operator correctly. It works only if we leave the offset on the
- stack. */
- op = DW_OP_constu;
+ /* ??? The SGI dwarf reader does not handle the DW_OP_plus_uconst
+ operator correctly. It works only if we leave the offset on the
+ stack. */
+ op = DW_OP_constu;
#else
- op = DW_OP_plus_uconst;
+ op = DW_OP_plus_uconst;
#endif
-
- loc_descr = new_loc_descr (op, offset, 0);
+
+ loc_descr = new_loc_descr (op, offset, 0);
+ }
}
add_AT_loc (die, DW_AT_data_member_location, loc_descr);