mirror of git://gcc.gnu.org/git/gcc.git
![]() The btf_decl_tag and btf_type_tag attributes provide a means to annotate declarations and types respectively with arbitrary user provided strings. These strings are recorded in debug information for post-compilation uses, and despite the name they are meant to be recorded in DWARF as well as BTF. New DWARF extensions DW_TAG_GNU_annotation and DW_AT_GNU_annotation are used to represent these user annotations in DWARF. This patch introduces the new DWARF extension DIE and attribute, and generates them as necessary to represent user annotations from btf_decl_tag and btf_type_tag. The format of the new DIE is as follows: DW_TAG_GNU_annotation DW_AT_name: "btf_decl_tag" or "btf_type_tag" DW_AT_const_value: <arbitrary user-supplied string> DW_AT_GNU_annotation: <reference to another TAG_GNU_annotation DIE> DW_AT_GNU_annotation is a new attribute extension used to refer to these new annotation DIEs. If non-null in any given declaration or type DIE, it is a reference to a DW_TAG_GNU_annotation DIE holding an annotation for that declaration or type. In addition, the DW_TAG_GNU_annotation DIEs may also have a non-null DW_AT_GNU_annotation, referring to another annotation DIE. This allows chains of annotation DIEs to be formed, such as in the case where a single declaration has multiple instances of btf_decl_tag with different string annotations. gcc/ * dwarf2out.cc (struct annotation_node, struct annotation_node_hasher) (btf_tag_htab): New ancillary structures and hash table. (annotation_node_hasher::hash, annotation_node_hasher::equal): New. (hash_btf_tag, gen_btf_tag_dies, maybe_gen_btf_type_tag_dies) (maybe_gen_btf_decl_tag_dies): New functions. (modified_type_die): Add new argument to pass type attributes. Handle btf_type_tag, and update recursive calls. (base_type_for_mode): Add new arg for modified_type_die call. (add_type_attribute): Likewise. (gen_array_type_die): Call maybe_gen_btf_type_tag_dies for the type. (gen_formal_parameter_die): Call maybe_gen_btf_decl_tag_dies for the parameter. (override_type_for_decl_p): Add new arg for modified_type_die call. (force_type_die): Likewise. (gen_tagged_type_die): Call maybe_gen_btf_type_tag_dies for the type. (gen_decl_die): Call maybe_gen_btf_decl_tag_dies for the decl. (dwarf2out_finish): Empty btf_tag_htab. (dwarf2out_cc_finalize): Delete btf_tag_htab hash table. include/ * dwarf2.def (DW_TAG_GNU_annotation): New DWARF extension. (DW_AT_GNU_annotation): Likewise. gcc/testsuite/ * gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-1.c: New test. * gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-2.c: New test. * gcc.dg/debug/dwarf2/dwarf-btf-decl-tag-3.c: New test. * gcc.dg/debug/dwarf2/dwarf-btf-type-tag-1.c: New test. * gcc.dg/debug/dwarf2/dwarf-btf-type-tag-2.c: New test. * gcc.dg/debug/dwarf2/dwarf-btf-type-tag-3.c: New test. * gcc.dg/debug/dwarf2/dwarf-btf-type-tag-4.c: New test. * gcc.dg/debug/dwarf2/dwarf-btf-type-tag-5.c: New test. * gcc.dg/debug/dwarf2/dwarf-btf-type-tag-6.c: New test. * gcc.dg/debug/dwarf2/dwarf-btf-type-tag-7.c: New test. * gcc.dg/debug/dwarf2/dwarf-btf-type-tag-8.c: New test. * gcc.dg/debug/dwarf2/dwarf-btf-type-tag-9.c: New test. * gcc.dg/debug/dwarf2/dwarf-btf-type-tag-10.c: New test. |
||
---|---|---|
.forgejo | ||
.github | ||
INSTALL | ||
c++tools | ||
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcody | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgcobol | ||
libgfortran | ||
libgm2 | ||
libgo | ||
libgomp | ||
libgrust | ||
libiberty | ||
libitm | ||
libobjc | ||
libphobos | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
libvtv | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
.b4-config | ||
.dir-locals.el | ||
.editorconfig | ||
.gitattributes | ||
.gitignore | ||
ABOUT-NLS | ||
COPYING | ||
COPYING.LIB | ||
COPYING.RUNTIME | ||
COPYING3 | ||
COPYING3.LIB | ||
ChangeLog | ||
ChangeLog.jit | ||
ChangeLog.tree-ssa | ||
MAINTAINERS | ||
Makefile.def | ||
Makefile.in | ||
Makefile.tpl | ||
README | ||
SECURITY.txt | ||
ar-lib | ||
compile | ||
config-ml.in | ||
config.guess | ||
config.rpath | ||
config.sub | ||
configure | ||
configure.ac | ||
depcomp | ||
install-sh | ||
libtool-ldflags | ||
libtool.m4 | ||
ltgcc.m4 | ||
ltmain.sh | ||
ltoptions.m4 | ||
ltsugar.m4 | ||
ltversion.m4 | ||
lt~obsolete.m4 | ||
missing | ||
mkdep | ||
mkinstalldirs | ||
move-if-change | ||
multilib.am | ||
symlink-tree | ||
test-driver | ||
ylwrap |
README
This directory contains the GNU Compiler Collection (GCC). The GNU Compiler Collection is free software. See the files whose names start with COPYING for copying permission. The manuals, and some of the runtime libraries, are under different terms; see the individual source files for details. The directory INSTALL contains copies of the installation information as HTML and plain text. The source of this information is gcc/doc/install.texi. The installation information includes details of what is included in the GCC sources and what files GCC installs. See the file gcc/doc/gcc.texi (together with other files that it includes) for usage and porting information. An online readable version of the manual is in the files gcc/doc/gcc.info*. See http://gcc.gnu.org/bugs/ for how to report bugs usefully. Copyright years on GCC source files may be listed using range notation, e.g., 1987-2012, indicating that every year in the range, inclusive, is a copyrightable year that could otherwise be listed individually.