This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Google/4_8] Support for embedding build info into gcda files


On Fri, May 23, 2014 at 2:28 PM, Xinliang David Li <davidxl@google.com> wrote:
>       for (i = 0; i < num_strings; i++)
> +        {
> +          if (strcmp (build_info_strings[i], gi_ptr->build_info[i]))
>
> Add also check of gi_ptr->build_info:
>
>    if (!gi_ptr->build_info || strcmp (.... )

Added the check earlier, just above this walk over strings. If we
reached here the stamps were the same so if we had see a build info
tag then we should have a non-null build_info.

>
>
> +            {
> +              gcov_error ("profiling:%s:Mismatched build info string "
>
>
> +      else if (tag == GCOV_TAG_BUILD_INFO)
> +        {
>
> Add comment about not consumed by compiler, skipping the data ...

Ok.

>
> +          gcov_unsigned_t num_strings;
> +          char **build_info_strings = gcov_read_build_info (length,
> +                                                            &num_strings);
>
>
> @@ -2307,6 +2435,9 @@ coverage_obj_init (void)
>    if (cgraph_dump_file)
>      fprintf (cgraph_dump_file, "Using data file %s\n", da_file_name);
>
> +  if (flag_profile_generate_buildinfo)
> +    read_buildinfo ();
>
>
> Why building it in init, not finalize routine as the rest of the gcov info?

Not sure what the issue is? We are just reading in the file here.

Teresa

>
>
> David
>
> On Fri, May 23, 2014 at 1:59 PM, Teresa Johnson <tejohnson@google.com> wrote:
>> Done. Passes manual testing, rerunning regression testing. New patch attached.
>>
>> Thanks,
>> Teresa
>>
>> On Fri, May 23, 2014 at 11:35 AM, Xinliang David Li <davidxl@google.com> wrote:
>>> The change makes gcov_info a variable length array, which is not ideal.
>>>
>>> Better just add one more field (instead of two):
>>>
>>> struct gcov_info {
>>>    ...
>>>   char ** build_info;
>>> };
>>>
>>> For regular case, it is null, for case where the build info is
>>> available, make it point to a string array (with an null end marker
>>> string).
>>>
>>> David
>>>
>>>
>>>
>>>
>>>
>>> On Fri, May 23, 2014 at 11:08 AM, Teresa Johnson <tejohnson@google.com> wrote:
>>>> Support for embedding arbitrary build information from the profile-generate
>>>> compile into the gcda file in a new BUILD_INFO record. Lines from a file
>>>> passed to the -fprofile-generate compile via a new
>>>> -fprofile-generate-buildinfo=filename option are embedded as strings
>>>> in the gcov_info struct and emitted as-is to a new GCOV_TAG_BUILD_INFO
>>>> record. They are ignored on profile-use compiles, but emitted by gcov-dump.
>>>> This is useful for recording information about, for example, source revision
>>>> info that can be helpful for diagnosing profile mis-matches.
>>>>
>>>> For example:
>>>>
>>>> $ cat buildinfo.txt
>>>> Build timestamp xxxx
>>>> Build source revision r12345
>>>> Other random build data
>>>>
>>>> $ g++ foo.cc -fprofile-generate -fprofile-generate-buildinfo=buildinfo.txt
>>>>
>>>> $ a.out
>>>> $ gcov-dump foo.gcda
>>>> foo.gcda:data:magic `gcda':version `408*'
>>>> foo.gcda:stamp 708902860
>>>> foo.gcda: a3000000:  22:PROGRAM_SUMMARY checksum=0x86a3bc55
>>>> foo.gcda:               counts=1, runs=1, sum_all=1, run_max=1, sum_max=1
>>>> foo.gcda:               counter histogram:
>>>> foo.gcda:               1: num counts=1, min counter=1, cum_counter=1
>>>> foo.gcda: a7000000:  24:BUILD INFO num_strings=3
>>>> foo.gcda:               Build timestamp xxxx
>>>> foo.gcda:               Build source revision r12345
>>>> foo.gcda:               Other random build data
>>>> foo.gcda: 01000000:   3:FUNCTION ident=1, lineno_checksum=0x17c79156,
>>>> cfg_checksum=0xdb5de9e8
>>>> foo.gcda:  01a10000:   2:COUNTERS arcs 1 counts
>>>>
>>>> Tested manually, passes regression tests. Ok for Google/4_8?
>>>>
>>>> Thanks,
>>>> Teresa
>>>>
>>>> --
>>>> Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413
>>
>>
>>
>> --
>> Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413



-- 
Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]