diff options
author | davidxl <davidxl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-04-29 00:19:35 +0000 |
---|---|---|
committer | davidxl <davidxl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-04-29 00:19:35 +0000 |
commit | 06306fd38457a4c44c68350d77c693575a8664d7 (patch) | |
tree | d953d6304eb53816e1ea571fc8d365f55655d39a /gcc/gcov.c | |
parent | 92cb1544b6bbd3e5f500b14430b6452329cff716 (diff) | |
download | gcc-06306fd38457a4c44c68350d77c693575a8664d7.tar.gz |
split checksum into cfg checksum and line checksum
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@173147 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gcov.c')
-rw-r--r-- | gcc/gcov.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/gcc/gcov.c b/gcc/gcov.c index bb2791324a3..27ae036740a 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -54,6 +54,13 @@ along with Gcov; see the file COPYING3. If not see some places we make use of the knowledge of how profile.c works to select particular algorithms here. */ +/* The code validates that the profile information read in corresponds + to the code currently being compiled. Rather than checking for + identical files, the code below computes a checksum on the CFG + (based on the order of basic blocks and the arcs in the CFG). If + the CFG checksum in the gcda file match the CFG checksum for the + code currently being compiled, the profile data will be used. */ + /* This is the size of the buffer used to read in source file lines. */ #define STRING_SIZE 200 @@ -161,7 +168,8 @@ typedef struct function_info /* Name of function. */ char *name; unsigned ident; - unsigned checksum; + unsigned lineno_checksum; + unsigned cfg_checksum; /* Array of basic blocks. */ block_t *blocks; @@ -807,12 +815,14 @@ read_graph_file (void) if (tag == GCOV_TAG_FUNCTION) { char *function_name; - unsigned ident, checksum, lineno; + unsigned ident, lineno; + unsigned lineno_checksum, cfg_checksum; source_t *src; function_t *probe, *prev; ident = gcov_read_unsigned (); - checksum = gcov_read_unsigned (); + lineno_checksum = gcov_read_unsigned (); + cfg_checksum = gcov_read_unsigned (); function_name = xstrdup (gcov_read_string ()); src = find_source (gcov_read_string ()); lineno = gcov_read_unsigned (); @@ -820,7 +830,8 @@ read_graph_file (void) fn = XCNEW (function_t); fn->name = function_name; fn->ident = ident; - fn->checksum = checksum; + fn->lineno_checksum = lineno_checksum; + fn->cfg_checksum = cfg_checksum; fn->src = src; fn->line = lineno; @@ -1107,7 +1118,8 @@ read_count_file (void) if (!fn) ; - else if (gcov_read_unsigned () != fn->checksum) + else if (gcov_read_unsigned () != fn->lineno_checksum + || gcov_read_unsigned () != fn->cfg_checksum) { mismatch:; fnotice (stderr, "%s:profile mismatch for '%s'\n", |