public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Sebastian Huber <sebastian.huber@embedded-brains.de>
To: "Martin Liška" <mliska@suse.cz>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] gcov: Add __gcov_info_to_gdca()
Date: Mon, 23 Nov 2020 13:25:03 +0100	[thread overview]
Message-ID: <ab847361-0a81-1310-96a7-95b4c17629a1@embedded-brains.de> (raw)
In-Reply-To: <731f88c4-63aa-6038-9740-2f71a8dea5e5@embedded-brains.de>

On 20/11/2020 17:14, Sebastian Huber wrote:

> On 20/11/2020 16:25, Martin Liška wrote:
>
>>>> Apart from these 2 hooks, I bet you will also need gcov_position 
>>>> and gcov_seek functions,
>>>> can be seen in my sent patch.
>>> For what do I need them?
>>>
>>
>> I prefer the way with the 2 extra hooks.
>> Can you please prepare a patch where the newly added functions 
>> __gcov_info_to_gcda and __gcov_fn_info_to_gcda
>> will be used in libgcov (with the hooks equal to fopen and fwrite? 
>
> I am not really sure what I should do. Do you mean that 
> write_one_data() should be rewritten to use __gcov_info_to_gcda() with 
> hooks that use gcov_write_unsigned()?
>
> The write_one_data() also has a const struct gcov_summary *prg_p 
> pointer. What should an external user provide for this pointer? For 
> example &gi_ptr->summary?
>
> The write_one_data() has this code
>
>       if (fn_buffer && fn_buffer->fn_ix == f_ix)
>         {
>           /* Buffered data from another program.  */
>           buffered = 1;
>           gfi_ptr = &fn_buffer->info;
>           length = GCOV_TAG_FUNCTION_LENGTH;
>         }
>
> which uses a global variable
>
> /* buffer for the fn_data from another program.  */
> static struct gcov_fn_buffer *fn_buffer;
>
> For this handling we would need a new hook to do this:
>
>       if (buffered)
>         fn_buffer = free_fn_data (gi_ptr, fn_buffer, GCOV_COUNTERS);
>
> I don't know for what we need seek and position hooks.

Refactoring write_one_data() to use hooks requires that

gcov_write_counter()

gcov_write_tag_length()

gcov_write_summary()

move from gcc/gcov-io.c to libgcc/libgcov-buffer.c. They can be made 
static. I am not sure if the external symbols can be removed

/* In libgcov we need these functions to be extern, so prefix them with
    __gcov.  In libgcov they must also be hidden so that the instance in
    the executable is not also used in a DSO.  */
#define gcov_write_tag_length __gcov_write_tag_length
#define gcov_write_counter __gcov_write_counter
#define gcov_write_summary __gcov_write_summary

without breaking anything? What is the performance impact if only 
gcov_write_unsigned() is used by libgcc/libgcov-driver.c?

-- 
embedded brains GmbH
Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber@embedded-brains.de
Phone: +49-89-18 94 741 - 16
Fax:   +49-89-18 94 741 - 08
PGP: Public key available on request.

embedded brains GmbH
Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier: https://embedded-brains.de/datenschutzerklaerung/


  reply	other threads:[~2020-11-23 12:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-17  9:57 Sebastian Huber
2020-11-20  8:37 ` Martin Liška
2020-11-20  9:25   ` Sebastian Huber
2020-11-20  9:49     ` Martin Liška
2020-11-20 10:11       ` Sebastian Huber
2020-11-20 15:25         ` Martin Liška
2020-11-20 16:14           ` Sebastian Huber
2020-11-23 12:25             ` Sebastian Huber [this message]
2020-11-23 14:24               ` Martin Liška
2020-11-23 14:30 ` Martin Liška
2020-11-23 14:35   ` Sebastian Huber
2020-11-23 14:49     ` Martin Liška
2020-11-23 14:50       ` Sebastian Huber
2020-11-23 14:55         ` Martin Liška
2021-07-13 13:03 Sebastian Huber
2021-07-13 13:11 ` Sebastian Huber

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=ab847361-0a81-1310-96a7-95b4c17629a1@embedded-brains.de \
    --to=sebastian.huber@embedded-brains.de \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mliska@suse.cz \
    /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).