diff mbox

[patch+8.0] DWARF-5 Fix DW_FORM_implicit_const

Message ID 20170622203308.GA23353@host1.jankratochvil.net
State New
Headers show

Commit Message

Jan Kratochvil June 22, 2017, 8:33 p.m. UTC
Hi,

the other possibility is to patch attr_form_is_constant() and
dwarf2_get_attr_constant_value(), I do not see what is better.

It fixes for example:
	FAIL: gdb.base/constvars.exp: ptype logical

for -gdwarf-4 vs. -gdwarf-5.


Jan
gdb/ChangeLog
2017-06-22  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* dwarf2read.c (read_attribute_value) <DW_FORM_implicit_const>: Set it
	as DW_FORM_sdata.

Comments

Pedro Alves Aug. 23, 2017, 11:08 p.m. UTC | #1
Hi Jan,

On 06/22/2017 09:33 PM, Jan Kratochvil wrote:
> 
> the other possibility is to patch attr_form_is_constant() and
> dwarf2_get_attr_constant_value(), I do not see what is better.

Wouldn't that be more direct and to the point?  If I'm imagining
that version of the patch correctly, that'd seem like a
more obvious choice to me.  The proposed version looks like is
frobbing the form so that DW_FORM_sdata so that those two other
functions end up doing the right thing as side effect.  Right?
Is there some advantage to doing it the sdata way?  It kind of feels
like a hack, but maybe I'm missing something.

> 
> It fixes for example:
> 	FAIL: gdb.base/constvars.exp: ptype logical
> 
> for -gdwarf-4 vs. -gdwarf-5.
> 

Thanks,
Pedro Alves
diff mbox

Patch

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 2369d4b..77f870d 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -16775,6 +16775,7 @@  read_attribute_value (const struct die_reader_specs *reader,
 				       info_ptr);
       break;
     case DW_FORM_implicit_const:
+      attr->form = DW_FORM_sdata;
       DW_SND (attr) = implicit_const;
       break;
     case DW_FORM_GNU_addr_index: