Re: [PATCH V5] CTF: multi-CU and archive support

Lancelot SIX via Gdb-patches
2021-06-11T23:07:47Z

> Hi,
>
> You can find the latest gcc patch series for CTF support, which is currently
> under review, here:
>
> http://gcc.1065356.n8.nabble.com/PATCH-V9-0-7-Support-for-the-CTF-and-BTF-debug-formats-td1897109.html
>
> Also please make sure to use a binutils version with CTF support.
>

Hi,

Thanks for the pointer.

Now that I have a ctf-aware gcc, I can give a first try to the patch.

It looks like the flag to enable CTF generation (at least in this
version of the GCC patch set) is '-gctf', not '-gt'.

The '-gt' flag is currently used in the tests to detect if the
compiler supports CTF (in gdb/testsuite/lib/gdb.exp). In the current
situation, tests are skipped with GCC master + CTF. We might want to
wait for GCC to settle on the flag, and update tests codebase as well as
this patch.

>
> I believe  the psymtab_discarder's dtor should take care of discarding all
> built partial
> symbol tables. So I'm not sure if this is a CTF specific issue.
>

It is taken care of by psymtab_storage::~psymtab_storage which is
eventually triggered by the dtor of objfile. I did not dig enough
before sending the email. Sorry for that.

> One way to avoid dealing with either the storage or dtor issue is to
> declare:
>
>         struct ctf_context context;
>
> in struct ctf_psymtab.

Yes, this would work. However, considering what I missed with the
memory management of the psymtab and given that ctf_context is a POD
type, everything should properly come down with the dtor of objfile. So
after reconsidering I believe your proposition should works.

Lancelot.