public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Martin Liška" <mliska@suse.cz>
To: Sebastian Huber <sebastian.huber@embedded-brains.de>,
	gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] gcov-tool: Allow merging of empty profile lists
Date: Thu, 31 Mar 2022 08:58:27 +0200	[thread overview]
Message-ID: <3d4f4f22-6c4c-1a32-a994-d9c2e8417121@suse.cz> (raw)
In-Reply-To: <12e8e121-2c66-0b15-ea65-4c35cf6a1b5e@embedded-brains.de>

On 3/30/22 16:48, Sebastian Huber wrote:
> 
> 
> On 30/03/2022 15:30, Sebastian Huber wrote:
>> On 30/03/2022 13:56, Martin Liška wrote:
>>>> Example:
>>>>
>>>> base64 -d log.txt | gcov-tool merge-stream
>>>>
>>>> The gcov-tool uses a new tag which contains the filename of the associated gcov info file:
>>>>
>>>> gcov-dump b-xilinx_zynq_a9_qemu/init.gcda
>>>> b-xilinx_zynq_a9_qemu/init.gcda:data:magic `gcda':version `B20 '
>>>> b-xilinx_zynq_a9_qemu/init.gcda:stamp 3496756572
>>>> b-xilinx_zynq_a9_qemu/init.gcda:checksum 137326246
>>>> b-xilinx_zynq_a9_qemu/init.gcda:  a5000000:  62:FILENAME `/home/EB/sebastian_h/src/lwip/b-xilinx_zynq_a9_qemu/init.gcda'
>>>> b-xilinx_zynq_a9_qemu/init.gcda:  a1000000:   8:OBJECT_SUMMARY runs=0, sum_max=0
>>>> b-xilinx_zynq_a9_qemu/init.gcda:  01000000:  12:FUNCTION ident=1016818396, lineno_checksum=0xd31791e7, cfg_checksum=0x4529789a
>>>> b-xilinx_zynq_a9_qemu/init.gcda:    01a10000: 232:COUNTERS arcs 29 counts
>>>>
>>>> Should I generate this filename tag to all configurations or just in case inhibit_libc is defined?
>>>
>>> I would emit it unconditionally. Btw. why do you need the tag?
>>
>> The tag was the easiest way to add the filename to the gcov information.
>>
>> We need some gcov defined way to get the filename associated with a gcov information, so that the gcov-tool can generate the gcov files from the gcov information itself. In a hosted environment, it is not necessary to include the filename in the gcov information, since the instrumented executable already creates the gcov files. In a freestanding environment, the gcov information is not automatically stored to files since no file system may be available. Here, we can dump the gcov information through __gcov_info_to_gcda(). This dump is basically a concatenation of several gcov files.
>>
>> An alternative to a tag inside the gcov data would be a header which is dumped before the gcov data and understood by the gcov-tool:
>>
>> header : int32:filename-magic int32:version string
>>
>> #define GCOV_FILENAME_MAGIC ((gcov_unsigned_t)0x6763666e) /* "gcfn" */
> 
> Thanks for asking the question. The alternative with the header is much less intrusive. I will work on this approach now.

Agreed.

> 
> Another question, I would like to add an option to gcov-tool to transform the filenames using regular expressions (for example, remove or add a prefix). Can I use the C++ <regex> for this?

Sure, use it!

Thanks,
Martin

      reply	other threads:[~2022-03-31  6:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-23  9:34 Sebastian Huber
2022-03-23 12:19 ` Martin Liška
2022-03-23 14:50   ` Sebastian Huber
2022-03-24 10:29     ` Martin Liška
2022-03-24 10:51       ` Sebastian Huber
2022-03-24 12:03         ` Martin Liška
2022-03-28 16:23           ` Sebastian Huber
2022-03-30 11:56             ` Martin Liška
2022-03-30 13:30               ` Sebastian Huber
2022-03-30 14:48                 ` Sebastian Huber
2022-03-31  6:58                   ` Martin Liška [this message]

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=3d4f4f22-6c4c-1a32-a994-d9c2e8417121@suse.cz \
    --to=mliska@suse.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=sebastian.huber@embedded-brains.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).