On Sat, Jun 1, 2019 at 2:14 AM Indu Bhagat <indu.bha...@oracle.com> wrote: > > > > On 05/29/2019 12:15 AM, Richard Biener wrote: > > Of course. We are merely discussing of where the triggering of processing > starts: debug hooks, or something like: > > dwarf2out_early_finish() { > ... > if (ctf) > ctf_emit(); > } > > (and then in addition if the current DWARF info would be the source of CTF > info, or if it'd be whatever the compiler gives you as trees) > > The thing is, with debug hooks you'd have to invent a scheme of stacking > hooks on top of each other (because we want to generate DWARF and CTF from > the same compilation). That seems like a wasted effort when our wish is > for the hooks to go away alltogether. > > When the debug hooks go away, the functionality can be folded in. Much like > above, the ctf proposed implementation will do : > > ctf_early_global_decl (tree decl) > { > ctf_decl (decl); > > real_debug_hooks->early_global_decl (decl); > } > > These ctf_* debug hooks wrappers are as lean as shown above. > > I do understand now that if debug hooks are destined to go away, all the > implementation which wraps debug hooks (go dump hooks, vms debug hooks, > and now the proposed ctf debug hooks) will need some merging. But to generate > CTF, I think working on type or decl instead of DWARF dies to is a better > implementation because if user wants only CTF, no DWARF trees need to be > created. > > This way we keep DWARF and CTF generation independent of each other (as the > user may want either one of these or both). > > The user currently can't have both DWARF and STABS either. That things like > godump uses debug hooks is just (convenient?) abuse. > > In the end frontends will not call sth like dwarf2out_decl but maybe > gen_subroutine_die () or gen_template_die (). So how do you expect > the "wrapping" to work there? > > I understand you want CTF for "actually emitted" decls so I propose you > instead hook into the symtab code which would end up calling the > early_global_decl debug hook. But please don't add new debug hook > users. > > OK. > > Will I need to tap both the callsites of the early_global_decl () debug hook > ? : > 1. symbol_table::finalize_compilation_unit () in cgraphunit.c > 2. rest_of_decl_compilation () in passes.c > Or is the last one for something specific to godump debug hooks and C++ ?
You need to handle both, one is for variables and one for functions. > I guess the above will take care of the CTF generation bit. For emission, > something similar should be done because DWARF hooks will not be initialized > if > DWARF debuginfo is not requested by the user. So I cannot have the CTF > emission > code in the dwarf2out*finish () debug hooks as suggested earlier. True. > Curious to know how the current debug hook users like dbx debug hooks will be > taken care of in the future design ? Is it just the wrapping/stacking of debug > hooks that's problematic and not the clean instances like dbx debug hooks ? dbx format support will go away, it's unmaintained and not up to the task handling modern languages. Richard. >