dwarf: externalize some DWARF internals for needs of CTF/BTF
This patch externalizes some internal DIE structures and their attributes
for the use of DWARF-based debug formats like CTF and BTF.
The following functions which were previously defined as static in
dwarf2out.c are now non-static, and extern prototypes for them have
been added to dwarf2out.h:
- get_AT
- AT_int
- AT_class
- AT_loc
- get_AT_ref
- get_AT_string
- get_AT_class
- AT_unsigned
- get_AT_unsigned
- get_AT_flag
- add_name_attribute
- new_die_raw
- base_type_die
- lookup_decl_die
- get_AT_file
Note how this patch doens't change the names of these functions to
avoid a massive renaming in dwarf2out.c, but in the future we probably
want these functions to sport a dw_* prefix.
Also, some type definitions have been moved from dwarf2out.c to
dwarf2out.h:
- dw_attr_node
- struct dwarf_file_data
Finally, three new accessor functions have been added to dwarf2out.c
with prototypes in dwarf2out.h:
- dw_get_die_child
- dw_get_die_sib
- dw_get_die_tag
2021-06-28 Jose E. Marchesi <jose.marchesi@oracle.com>
* dwarf2out.c (AT_class): Function is no longer static.
(AT_int): Likewise.
(AT_unsigned): Likewise.
(AT_loc): Likewise.
(get_AT): Likewise.
(get_AT_string): Likewise.
(get_AT_flag): Likewise.
(get_AT_unsigned): Likewise.
(get_AT_ref): Likewise.
(new_die_raw): Likewise.
(lookup_decl_die): Likewise.
(base_type_die): Likewise.
(add_name_attribute): Likewise.
(add_AT_int): Likewise.
(add_AT_unsigned): Likewise.
(add_AT_loc): Likewise.
(dw_get_die_tag): New function.
(dw_get_die_child): Likewise.
(dw_get_die_sib): Likewise.
(struct dwarf_file_data): Move from here to dwarf2out.h
(struct dw_attr_struct): Likewise.
* dwarf2out.h: Analogous changes.