public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: Craig Ringer <craig@2ndquadrant.com>
To: systemtap@sourceware.org
Subject: Emit preprocessor line annotations during tapset translation
Date: Fri, 17 Jul 2020 14:10:49 +0800	[thread overview]
Message-ID: <CAMsr+YG=x5GiM+O9S7K6osbL+sLfg1tHaGUK5rVv+Ha3SNZZcQ@mail.gmail.com> (raw)

Hi all

I'm thinking of patching the systemtap translator to inject preprocessor
annotations that add the original file and line numbers for compiler error
reporting. Like those used by gcc to report header file and line locations
during compilation of .c files.

This uses https://gcc.gnu.org/onlinedocs/cpp/Line-Control.html .

Would that be of interest to others here?

I've taken a look at parse.cxx . As far as I can see, objects like "struct
macrodecl" have their own "const token* tok" array of "struct token", each
of which has a "source_loc location" member with "file" and "line" members.

I'm not sure how best to go about translating that in the output so that
the directives appear in the most meaningful places though. Ideas?

-- 
 Craig Ringer                   http://www.2ndQuadrant.com/
 2ndQuadrant - PostgreSQL Solutions for the Enterprise

                 reply	other threads:[~2020-07-17  6:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='CAMsr+YG=x5GiM+O9S7K6osbL+sLfg1tHaGUK5rVv+Ha3SNZZcQ@mail.gmail.com' \
    --to=craig@2ndquadrant.com \
    --cc=systemtap@sourceware.org \
    /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).