public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Indu Bhagat <indu.bhagat@oracle.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: Jeff Law <law@redhat.com>, Indu Bhagat <ibhagatgnu@gmail.com>,
	       GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH,RFC,V3 0/5] Support for CTF in GCC
Date: Thu, 04 Jul 2019 22:44:00 -0000	[thread overview]
Message-ID: <755cd109-f02b-3ebd-762f-71ae570bf21a@oracle.com> (raw)
In-Reply-To: <CAFiYyc3EHPtGGrYEqPManhbkRmcETb9jV5wPUsMRVBitJOpz2g@mail.gmail.com>

On 07/04/2019 03:43 AM, Richard Biener wrote:
> On Thu, Jul 4, 2019 at 2:36 AM Indu Bhagat<indu.bhagat@oracle.com>  wrote:
>> [...]
>> RE subset of C : It is true that CTF format currently does leave out a very
>> small subset of C like FIXED_POINT as you noted ( CTF does have representation
>> for COMPLEX_TYPE, if my code paths culminate to gcc_unreachable () for that, I
>> should fix them ).  The end goal is to make it support all of C, and not just a
>> subset.
> What about other languages?  GCC supports C++, Ada, Objective-C, Go, D,
> Fortran, Modula-2, BRIG (this list is not necessarily complete and may change
> in the future).

The format supports C only at this time. Other languages are not on the radar
yet. However, we have no intrinsic objection to them. Although, languages
that already have fully-fledged type introspection and interpreted/
managed languages are probably out of scope, since they already have
what CTF provides.

>
>>
>>> Given it appears to generate only debug info for symbols and no locations
>>> or whatnot it should be sufficient to introspect the compilation to generate
>>> the CTF info on the side and then merge it in at link-time.  Which makes
>>> me wonder if this shouldn't be a plugin for now until it is more complete
>>> and can be evaluated better (comments in the patches indicate even the
>>> on-disk format is in flux?).  Adding plugin hook invocations to the three
>>> places the CTF info generation hooks off should be easy.
>> Yes, some bits of the on-disk format are being adapted to make it easier to
>> adopt the CTF format across the board. E.g., we recently added CU name in the
>> CTF header. As another example, we added CTF_K_SLICE type because there existed
>> no way in CTF to represent enum bitfields. For the most part though, CTF format
>> has stayed as is.
> I hope the format is versioned at least.

Yes, the format is versioned. The current version is CTF_VERSION_3.  All these
format changes I talked about above are a part of CTF_VERSION_3.

libctf handles backward compatibility for users of CTF in the toolchain; all
transparently to the user. This means that, in future, when CTF version needs
to be bumped, libctf will either support older version and/or transparently
upgrade to the new version for further consumers.

It also means that the compiler does not always need to change merely because
the format has changed: (depending on the change) the linker can transparently
adjust, as will all consumers if they try to read unlinked object files.

>
>>> That said, the patch series isn't ready for integration since it will
>>> crash left and right -- did you bootstrap and run the testsuite
>>> with -gt?
>>>
>>>
>> Bootstrap and Testsuite : Yes, I have.  On x86_64/linux, sparc64/linux,
>>                             aarch64/linux.
>> Run testsuite with -gt : Not yet. Believe me, it's on my plate. And I already
>>                            regret not having done it sooner :)
>> Bootstrap with -gt : Not yet. I should try soon.
>>
>> (I have compiled libdtrace-ctf with -gt and parsed the .ctf sections with the
>> patch set.)
>>
>> About the patch being not ready for integration : Yes, you're right.
>> That's why I chose to retain 'RFC' for this patch series as well. I am working
>> on issues, testing the compiler, and closing on the open ends in the
>> implementation.
>>
>> I will refresh the patch series when I have made a meaningful stride ahead. Any
>> further suggestions on functional/performance testing will be helpful too.
> What's the functional use of CTF?  Print nice backtraces (without showing
> function argument values)?
>
CTF, at this time, is type information for entities at global or file scope.
This can be used by online debuggers, program tracers (dynamic tracing); More
generally, it provides type introspection for C programs, with an optional
library API to allow them to get at their own types quite more easily than
DWARF. So, the umbrella usecases are - all C programs that want to introspect
their own types quickly; and applications that want to introspect other
programs's types quickly.

(Even with the exception of its embedded string table, it is already small
  enough to  be kept around in stripped binaries so that it can be relied upon
  to be present.)

We are also extending the format so it is useful for other on-line debugging
tools, such as backtracers.

Indu

  reply	other threads:[~2019-07-04 22:21 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-27  6:37 Indu Bhagat
2019-06-27  6:37 ` [PATCH,RFC,V3 3/5] Setup for CTF generation and emission Indu Bhagat
2019-06-27  6:37 ` [PATCH,RFC,V3 5/5] Update CTF testsuite Indu Bhagat
2019-06-27  6:37 ` [PATCH,RFC,V3 1/5] Add new function lang_GNU_GIMPLE Indu Bhagat
2019-06-27  6:37 ` [PATCH,RFC,V3 4/5] CTF generation for a single compilation unit Indu Bhagat
2019-06-27  6:37 ` [PATCH,RFC,V3 2/5] Add CTF command line options : -gtLEVEL Indu Bhagat
2019-07-02 17:43 ` [PATCH,RFC,V3 0/5] Support for CTF in GCC Indu Bhagat
2019-07-03  3:18   ` Jeff Law
2019-07-03 12:39     ` Richard Biener
2019-07-04  1:49       ` Indu Bhagat
2019-07-04 10:47         ` Richard Biener
2019-07-04 22:44           ` Indu Bhagat [this message]
2019-07-05 11:25             ` Richard Biener
2019-07-05 18:28               ` Nix
2019-07-05 19:37                 ` Jakub Jelinek
2019-07-08 14:16                   ` Nix
2019-07-09 23:25                 ` Mike Stump
2019-07-11 12:25                   ` Nix
2019-07-09 23:46                 ` Segher Boessenkool
2019-07-10  0:50                   ` Jeff Law
2019-07-11 12:59                   ` Nix
2019-07-11 16:54                     ` Segher Boessenkool
2019-07-09 17:32           ` Indu Bhagat
2019-07-04  0:36     ` Indu Bhagat

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=755cd109-f02b-3ebd-762f-71ae570bf21a@oracle.com \
    --to=indu.bhagat@oracle.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=ibhagatgnu@gmail.com \
    --cc=law@redhat.com \
    --cc=richard.guenther@gmail.com \
    /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).