diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-10-31 18:23:44 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-10-31 18:23:44 +0000 |
commit | a8ccb8fe8cb11a12d88cd9aae511a8e8855177cc (patch) | |
tree | 2741256bc6de300872c7ee847a1949ce2cd66729 /gcc/coverage.c | |
parent | c38d39c99c3c76f028b729dcd6defb383f896b2b (diff) | |
download | gcc-a8ccb8fe8cb11a12d88cd9aae511a8e8855177cc.tar.gz |
PR profile/20815
* coverage.c (coverage_checksum_string): Fix code to stip random seeds
from symbol names while computing checkup.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@106283 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/coverage.c')
-rw-r--r-- | gcc/coverage.c | 64 |
1 files changed, 35 insertions, 29 deletions
diff --git a/gcc/coverage.c b/gcc/coverage.c index a558e869add..e3cd9abc55d 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -445,36 +445,42 @@ coverage_checksum_string (unsigned chksum, const char *string) as the checksums are used only for sanity checking. */ for (i = 0; string[i]; i++) { + int offset = 0; + if (!strncmp (string + i, "_GLOBAL__N_", 11)) + offset = 11; if (!strncmp (string + i, "_GLOBAL__", 9)) - for (i = i + 9; string[i]; i++) - if (string[i]=='_') - { - int y; - unsigned seed; - int scan; - - for (y = 1; y < 9; y++) - if (!(string[i + y] >= '0' && string[i + y] <= '9') - && !(string[i + y] >= 'A' && string[i + y] <= 'F')) - break; - if (y != 9 || string[i + 9] != '_') - continue; - for (y = 10; y < 18; y++) - if (!(string[i + y] >= '0' && string[i + y] <= '9') - && !(string[i + y] >= 'A' && string[i + y] <= 'F')) - break; - if (y != 18) - continue; - scan = sscanf (string + i + 10, "%X", &seed); - gcc_assert (scan); - if (seed != crc32_string (0, flag_random_seed)) - continue; - string = dup = xstrdup (string); - for (y = 10; y < 18; y++) - dup[i + y] = '0'; - break; - } - break; + offset = 9; + + /* C++ namespaces do have scheme: + _GLOBAL__N_<filename>_<wrongmagicnumber>_<magicnumber>functionname + since filename might contain extra underscores there seems + to be no better chance then walk all possible offsets looking + for magicnuber. */ + if (offset) + for (;string[offset]; offset++) + for (i = i + offset; string[i]; i++) + if (string[i]=='_') + { + int y; + + for (y = 1; y < 9; y++) + if (!(string[i + y] >= '0' && string[i + y] <= '9') + && !(string[i + y] >= 'A' && string[i + y] <= 'F')) + break; + if (y != 9 || string[i + 9] != '_') + continue; + for (y = 10; y < 18; y++) + if (!(string[i + y] >= '0' && string[i + y] <= '9') + && !(string[i + y] >= 'A' && string[i + y] <= 'F')) + break; + if (y != 18) + continue; + if (!dup) + string = dup = xstrdup (string); + for (y = 10; y < 18; y++) + dup[i + y] = '0'; + } + break; } chksum = crc32_string (chksum, string); |