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


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


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