From fbff7494870dcb978e0b6e2aa6519e6859442fe3 Mon Sep 17 00:00:00 2001 From: mark Date: Wed, 8 Jul 2009 18:07:47 +0000 Subject: [PATCH] 2009-07-08 Mark Wielaard 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149377 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/dwarf2out.c | 35 ++++++++++++++++++++++------------- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 47f8920dfe7..c78577a456e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2009-07-08 Mark Wielaard + + 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 PR target/38900 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 01b534c1694..2e30a0c6702 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); -- 2.11.4.GIT