public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Indu Bhagat <indu.bhagat@oracle.com>
To: Richard Biener <rguenther@suse.de>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH V7 4/7] CTF/BTF debug formats
Date: Thu, 29 Apr 2021 15:08:51 -0700	[thread overview]
Message-ID: <046f7827-6b92-ddea-c189-91682d5092ef@oracle.com> (raw)
In-Reply-To: <d8898bc6-b217-b29b-023d-77f5e6048bf0@oracle.com>

On 4/29/21 1:02 PM, Indu Bhagat wrote:
> 
>>> +{
>>> +  dw_die_ref c;
>>> +
>>> +  if (!ctf_do_die (die))
>>> +    return;
>>> +
>>> +  FOR_EACH_CHILD (die, c, ctf_do_die (c));
>>> +}
>>> +
>>>   /* Perform any cleanups needed after the early debug generation pass
>>>      has run.  */
>>> @@ -32471,6 +32491,16 @@ dwarf2out_early_finish (const char *filename)
>>>         print_die (comp_unit_die (), dump_file);
>>>       }
>>> +  /* Generate CTF debug info.  */
>>> +  if ((ctf_debug_info_level > CTFINFO_LEVEL_NONE
>>> +       || btf_debug_info_level > BTFINFO_LEVEL_NONE) && lang_GNU_C ())
>>> +    {
>>> +      ctf_debug_init ();
>>> +      debug_format_do_cu (comp_unit_die ());
>>> +      for (limbo_die_node *node = limbo_die_list; node; node = 
>>> node->next)
>>> +    debug_format_do_cu (node->die);
>>> +    }
>>> +
>>
>> Since you have support to copy .ctf sections for LTO you have to write
>> those here.  And you have to care for fat LTO objects which for dwarf
>> results in two sets of .debug_info - I suppose for CTF you can share
>> the section for the fat and the LTO part though?  So why are you
>> writing the CFT debug in dwarf2out_finish now?
> 
> The change to writing CTF/BTF debug information in dwarf2out_finish 
> instead of dwarf2out_early_finish, at this time, was driven by the needs 
> of BTF. A BTF section has entries of kind BTF_KIND_DATASEC which 
> essentially give information about which section a variable is in (.bss, 
> .rodata, .text). This information is available later on in the 
> compilation process and hence, BTF needed a longer lifetime of the CTF 
> container to update the information in the CTF container. In general, 
> keeping any future needs that may come up, it seemed like a better 
> design point to defer the ctf_debug_finalize to dwarf2out_finish 
> (assuming we work out it out with LTO).

Umm..what I wrote wrt BTF was incorrect. The larger lifetime of CTF 
container is currently needed specifically for the BPF CO-RE 
relocations. They will be generated in the BPF backend, but only at 
'expand' time, which is much later than when dwarf2out_early_finish 
happens. Strictly speaking, for BTF only (without BPF CO-RE support, 
which will go in .BTF.ext) it is not necessary.

> 
> Can you elaborate on what it means to say "we have two sets of 
> .debug_info for fat LTO objects" ?
> 
> I am also lost a bit by the comment on "share the section for the fat 
> and LTO part though". If it helps, from what I can reason, I can add 
> that I do not see how in LTO mode, the CTF of a compilation unit will 
> shift at all between the compile phase and the LTO phase. This should be 
> true for CTF V3 atleast. But for V4, this may not be true...
> 
> For a moment, for the sake of this question, if we establish that 
> CTF/BTF generation always feeds off DWARF DIEs (so there is no need to 
> access type/decl tree nodes), what will it take to keep LTO support 
> while keeping ctf_debug_finalize in dwarf2out_finish ?


  reply	other threads:[~2021-04-29 22:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-29 12:10 Richard Biener
2021-04-29 20:02 ` Indu Bhagat
2021-04-29 22:08   ` Indu Bhagat [this message]
2021-04-30  6:17   ` Richard Biener
2021-04-30 16:11     ` Jose E. Marchesi
2021-04-30 18:53       ` David Faust
2021-05-03  9:01         ` Richard Biener
2021-05-07 17:50     ` Indu Bhagat
  -- strict thread matches above, loose matches on Subject: below --
2021-04-19 16:47 [PATCH V7 0/7] Support for the CTF and BTF " Jose E. Marchesi
2021-04-19 16:47 ` [PATCH V7 4/7] CTF/BTF " Jose E. Marchesi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=046f7827-6b92-ddea-c189-91682d5092ef@oracle.com \
    --to=indu.bhagat@oracle.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rguenther@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).