aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2ctf.h
diff options
context:
space:
mode:
authorIndu Bhagat <indu.bhagat@oracle.com>2021-05-20 11:15:52 -0700
committerJose E. Marchesi <jose.marchesi@oracle.com>2021-06-28 18:47:20 +0200
commitb7e215a8ee81d44281d9e0a2a25eceb47b6911dd (patch)
tree121afbbec2428c85a68b6119ac8c0f25f6cd9fab /gcc/dwarf2ctf.h
parent532617d6367c29803d5909f2432b1ebfb9ee1886 (diff)
downloadgcc-b7e215a8ee81d44281d9e0a2a25eceb47b6911dd.zip
gcc-b7e215a8ee81d44281d9e0a2a25eceb47b6911dd.tar.gz
gcc-b7e215a8ee81d44281d9e0a2a25eceb47b6911dd.tar.bz2
CTF/BTF debug formats
This commit introduces support for generating CTF debugging information and BTF debugging information from GCC. 2021-06-28 Indu Bhagat <indu.bhagat@oracle.com> David Faust <david.faust@oracle.com> Jose E. Marchesi <jose.marchesi@oracle.com> Weimin Pan <weimin.pan@oracle.com> gcc/ * Makefile.in: Add ctfc.*, ctfout.c and btfout.c files to GTFILES. Add new object files. * common.opt: Add CTF and BTF debug info options. * btfout.c: New file. * ctfc.c: Likewise. * ctfc.h: Likewise. * ctfout.c: Likewise. * dwarf2ctf.c: Likewise. * dwarf2ctf.h: Likewise. * dwarf2cfi.c (dwarf2out_do_frame): Acknowledge CTF_DEBUG and BTF_DEBUG. * dwarf2out.c (dwarf2out_source_line): Likewise. (dwarf2out_finish): Skip emitting DWARF if CTF or BTF are to be generated. (debug_format_do_cu): New function. (dwarf2out_early_finish): Traverse DIEs and emit CTF/BTF for them if requested. Include dwarf2ctf.c. * final.c (dwarf2_debug_info_emitted_p): Acknowledge DWARF-based debug formats. * flag-types.h (enum debug_info_type): Add CTF_DEBUG and BTF_DEBUG. (CTF_DEBUG): New bitmask. (BTF_DEBUG): Likewise. (enum ctf_debug_info_levels): New enum. * gengtype.c (open_base_files): Handle ctfc.h. (main): Handle uint32_t type. * flags.h (btf_debuginfo_p): New definition. (dwarf_based_debuginfo_p): Likewise. * opts.c (debug_type_names): Add entries for CTF and BTF. (btf_debuginfo_p): New function. (dwarf_based_debuginfo_p): Likewise. (common_handle_option): Handle -gctfN and -gbtf options. (set_debug_level): Set CTF_DEBUG, BTF_DEBUG whenever appropriate. * toplev.c (process_options): Inform the user and ignore -gctfLEVEL if frontend is not C. include/ * ctf.h: New file. * btf.h: Likewise. libiberty/ * simple-object.c (handle_lto_debug_sections): Copy over .ctf sections.
Diffstat (limited to 'gcc/dwarf2ctf.h')
-rw-r--r--gcc/dwarf2ctf.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/gcc/dwarf2ctf.h b/gcc/dwarf2ctf.h
new file mode 100644
index 0000000..a3cf567
--- /dev/null
+++ b/gcc/dwarf2ctf.h
@@ -0,0 +1,53 @@
+/* dwarf2ctf.h - DWARF interface for CTF/BTF generation.
+ Copyright (C) 2021 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+/* This file contains declarations and prototypes to define an interface
+ between DWARF and CTF/BTF generation. */
+
+#ifndef GCC_DWARF2CTF_H
+#define GCC_DWARF2CTF_H 1
+
+#include "dwarf2out.h"
+
+/* Debug Format Interface. Used in dwarf2out.c. */
+
+extern void ctf_debug_init (void);
+extern void ctf_debug_init_postprocess (bool);
+extern bool ctf_do_die (dw_die_ref);
+extern void ctf_debug_finalize (const char *, bool);
+
+/* Wrappers for CTF/BTF to fetch information from GCC DWARF DIE. Used in
+ ctfc.c.
+
+ A CTF container does not store all debug information internally. Some of
+ the info is fetched indirectly via the DIE reference available in each CTF
+ container entry.
+
+ These functions will be used by the CTF container to give access to its
+ consumers (CTF/BTF) to various debug information available in DWARF DIE.
+ Direct access to debug information in GCC dwarf structures by the consumers
+ of CTF/BTF information is not ideal. */
+
+/* Source location information. */
+
+extern const char * ctf_get_die_loc_file (dw_die_ref);
+extern unsigned int ctf_get_die_loc_line (dw_die_ref);
+extern unsigned int ctf_get_die_loc_col (dw_die_ref);
+
+#endif /* GCC_DWARF2CTF_H */