diff options
author | Tom Tromey <tom@tromey.com> | 2020-09-29 18:49:08 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2020-09-29 20:29:06 -0600 |
commit | 1bc397c561f55c1cf67a5e02f5c9305a54155a2e (patch) | |
tree | ac62792e3d25ef7c9429aebd4168d1dcc3aa72e0 /gdb/dwarf2/attribute.h | |
parent | 630ed6b975d2d2f950523dd2ad9ac77614f5222c (diff) | |
download | gdb-1bc397c561f55c1cf67a5e02f5c9305a54155a2e.zip gdb-1bc397c561f55c1cf67a5e02f5c9305a54155a2e.tar.gz gdb-1bc397c561f55c1cf67a5e02f5c9305a54155a2e.tar.bz2 |
Remove DW_SND
This removes DW_SND in favor of accessors on struct attribute.
These accessors check that the form is appropriate.
gdb/ChangeLog
2020-09-29 Tom Tromey <tom@tromey.com>
* dwarf2/read.c (get_alignment, read_array_order)
(read_attribute_value, dwarf2_const_value_attr)
(dump_die_shallow, dwarf2_fetch_constant_bytes): Update.
* dwarf2/attribute.h (struct attribute) <as_signed, set_signed>:
New methods.
(DW_SND): Remove.
Diffstat (limited to 'gdb/dwarf2/attribute.h')
-rw-r--r-- | gdb/dwarf2/attribute.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/gdb/dwarf2/attribute.h b/gdb/dwarf2/attribute.h index 800ea8d..9178276 100644 --- a/gdb/dwarf2/attribute.h +++ b/gdb/dwarf2/attribute.h @@ -65,6 +65,14 @@ struct attribute return u.signature; } + /* Return the signed value. The attribute must have the appropriate + form. */ + LONGEST as_signed () const + { + gdb_assert (form == DW_FORM_sdata || form == DW_FORM_implicit_const); + return u.snd; + } + /* 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. @@ -175,6 +183,13 @@ struct attribute u.signature = signature; } + /* Set this attribute to a signed integer. */ + void set_signed (LONGEST snd) + { + gdb_assert (form == DW_FORM_sdata || form == DW_FORM_implicit_const); + u.snd = snd; + } + ENUM_BITFIELD(dwarf_attribute) name : 16; ENUM_BITFIELD(dwarf_form) form : 15; @@ -205,7 +220,6 @@ private: /* Get at parts of an attribute structure. */ #define DW_UNSND(attr) ((attr)->u.unsnd) -#define DW_SND(attr) ((attr)->u.snd) #define DW_ADDR(attr) ((attr)->u.addr) #endif /* GDB_DWARF2_ATTRIBUTE_H */ |