Ping. Can someone please review these patches ? We would like to get the support for CTF integrated soon. Thanks Indu
On Wed, Jun 26, 2019 at 11:38 PM Indu Bhagat <indu.bha...@oracle.com> wrote: > > Hello, > > This patch series adds support for CTF generation in GCC. > > [Changes from V2] > - Patch 1, 2, and 3 have minor edits if any. > - Patch 4 is a new addition. > - Patch 5 is a new addition. > > Summary of the GCC RFC V3 patch set : > Patch 1, 2, and 3 do the preparatory work of adding the CTF command line > options > and setting up the framework for CTF generation and emission. More details on > these patches can be seen in the previous posting > https://gcc.gnu.org/ml/gcc-patches/2019-06/msg00718.html > > With Patch 4 in the current set, the compiler can generate a .ctf section for > a > single compilation unit if -gt (when unspecified, LEVEL defaults to 2) or -gt2 > is specified. Recall that -gt2 produces type information for entities > (functions, variables etc.) at file-scope or global-scope. > > For each translation unit, a CTF container (ctf_container_t) is used to > keep the generated CTF. Two hash_map structures are kept to hold the > generated > CTF for type and variables. CTF does need pre-processing before emission into > a section; there are code comments in ctfout.c to help understand this. > > There are a couple of TBDs and FIXMEs in Patch 4 which will be resolved as I > progress further; Inputs on some of which will be very helpful : > > - ctf_dtdef_hash : The compiler uses a hashing scheme to keep track of whether > CTF has been generated for a type of decl. For a type, the hashing scheme > uses TYPE_UID, but for a decl it uses htab_hash_pointer (decl). Is there a > better way to do this ? (See hash_dtd_tree_decl in ctfout.c) > > - delete_ctf_container routine in ctfout.c : I have used the GTY (()) tags in > the CTF container structs. Does this ensure that if I set the CTF container > global variable (ctfc) to NULL, the garbage collection machinery will take > care of cleaning up the the internals of the container (including hash_map). > Haven't been able to get a definitive answer looking at the code in > hash-map.h and the generated code in gtype-desc.c. > > Testing : > - Bootstrapped and regression tested on x86_64/linux and aarch64/linux. > Also bootstrapped on SPARC64/linux with some testing. > - Parsed .ctf sections of libdtrace-ctf files via a CTF dumping utility on > x86_64/linux. This simply ensures that the CTF sections are well-formed. > - Interaction with an internally available GDB looks promising. Basic whatis > and ptype tests work. GDB patches to uptake CTF debug info are in the works > and will be upstreamed soon. > > In the subsequent patches, I intend to close some open ends in the current > patch and add LTO support. > > Thanks, > > Indu Bhagat (5): > Add new function lang_GNU_GIMPLE > Add CTF command line options : -gtLEVEL > Setup for CTF generation and emission > CTF generation for a single compilation unit > Update CTF testsuite > > gcc/ChangeLog | 91 + > gcc/Makefile.in | 5 + > gcc/cgraphunit.c | 12 +- > gcc/common.opt | 9 + > gcc/ctfcreate.c | 526 ++++++ > gcc/ctfout.c | 1739 > ++++++++++++++++++++ > gcc/ctfout.h | 359 ++++ > gcc/ctfutils.c | 198 +++ > gcc/doc/invoke.texi | 16 + > gcc/flag-types.h | 13 + > gcc/gengtype.c | 4 +- > gcc/langhooks.c | 9 + > gcc/langhooks.h | 1 + > gcc/opts.c | 26 + > gcc/passes.c | 7 +- > gcc/testsuite/ChangeLog | 35 + > gcc/testsuite/gcc.dg/debug/ctf/ctf-1.c | 6 + > gcc/testsuite/gcc.dg/debug/ctf/ctf-2.c | 10 + > .../gcc.dg/debug/ctf/ctf-anonymous-struct-1.c | 23 + > .../gcc.dg/debug/ctf/ctf-anonymous-union-1.c | 26 + > gcc/testsuite/gcc.dg/debug/ctf/ctf-array-1.c | 31 + > gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-1.c | 30 + > gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-2.c | 39 + > gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-1.c | 44 + > gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-2.c | 30 + > gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-3.c | 41 + > gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-1.c | 21 + > gcc/testsuite/gcc.dg/debug/ctf/ctf-float-1.c | 16 + > gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-1.c | 36 + > gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-2.c | 16 + > .../gcc.dg/debug/ctf/ctf-function-pointers-1.c | 24 + > gcc/testsuite/gcc.dg/debug/ctf/ctf-functions-1.c | 34 + > gcc/testsuite/gcc.dg/debug/ctf/ctf-int-1.c | 17 + > gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-1.c | 26 + > gcc/testsuite/gcc.dg/debug/ctf/ctf-preamble-1.c | 11 + > gcc/testsuite/gcc.dg/debug/ctf/ctf-str-table-1.c | 26 + > gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-1.c | 25 + > gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-2.c | 30 + > .../gcc.dg/debug/ctf/ctf-struct-array-1.c | 36 + > gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-1.c | 23 + > .../gcc.dg/debug/ctf/ctf-typedef-struct-1.c | 12 + > gcc/testsuite/gcc.dg/debug/ctf/ctf-union-1.c | 14 + > gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-1.c | 25 + > gcc/testsuite/gcc.dg/debug/ctf/ctf.exp | 41 + > gcc/testsuite/gcc.dg/debug/dwarf2-ctf-1.c | 7 + > gcc/toplev.c | 18 + > include/ChangeLog | 8 + > include/ctf.h | 487 ++++++ > 48 files changed, 4277 insertions(+), 6 deletions(-) > create mode 100644 gcc/ctfcreate.c > create mode 100644 gcc/ctfout.c > create mode 100644 gcc/ctfout.h > create mode 100644 gcc/ctfutils.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-1.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-2.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-struct-1.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-anonymous-union-1.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-array-1.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-1.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-bitfields-2.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-1.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-2.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-cvr-quals-3.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-enum-1.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-float-1.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-1.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-forward-2.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-function-pointers-1.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-functions-1.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-int-1.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-pointers-1.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-preamble-1.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-str-table-1.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-1.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-2.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-struct-array-1.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-1.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-typedef-struct-1.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-union-1.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf-variables-1.c > create mode 100644 gcc/testsuite/gcc.dg/debug/ctf/ctf.exp > create mode 100644 gcc/testsuite/gcc.dg/debug/dwarf2-ctf-1.c > create mode 100644 include/ctf.h > > -- > 1.8.3.1 >