Joel Rosdahl [Sun, 7 Oct 2018 19:06:08 +0000 (21:06 +0200)]
Fix bugs in debug mode logging
Need to dump log buffer as the last exit function to not lose any logs.
Also, made sure to print the final result log line even if the log mode
isn’t enabled.
Joel Rosdahl [Sun, 7 Oct 2018 18:40:55 +0000 (20:40 +0200)]
Refactor debug mode code
Knowledge of the debug mode snuck into the mdfour struct and code, which
did not feel good.
* Introduced a new “struct hash”, which is used by the hash_* functions
instead of “struct mdfour”. “struct hash” contains the mdfour state
and also debug file handles that can be set via a new
hash_enable_debug function.
* Removed “identifier” from the mdfour struct and code.
* Introduced hash.h and all documented hash_* functions.
* Introduced unify.h.
* Removed some global state from util.c.
* afbjorklund/everything:
Make configure work with older clang versions
Add option for enabling more compiler warnings
Add configure support for detecting clang
Avoid bad function cast by using temporary
Proper use of const qualifier char* strings
Removed locally shadowed global variables
Don't use undefined macros, use ifdef instead
Add noreturn to functions that don't return
Add missing extern prototypes, or make static
Don't use reserved id macros in the headers
Only compile getopt_long.c when needed
Address issues found by lgtm.com alerts
Joel Rosdahl [Tue, 2 Oct 2018 18:15:32 +0000 (20:15 +0200)]
Improve debug log filenames
The “<objectfile>.ccache-hashX” files are also input data, so I think
that calling the “human-readable” version “<objectfile>.ccache-input” a
bit unpedagogical. Changes:
Joel Rosdahl [Sat, 29 Sep 2018 19:48:41 +0000 (21:48 +0200)]
Merge remote-tracking branch 'afbjorklund/hash_debug' into pr/279
* afbjorklund/hash_debug:
Register debug_end as an exit function instead
Avoid using strcat and small realloc
Rename helper functions, as suggested in review
Save debug file streams, instead of reopening
Add section markers, to the text file
Rename hash_debug, add matching end function
Improve documentation with example file names
Output log to debug, even without a logfile
Avoid global md variable in mdfour file
Add --hash-file command, for convenience
Add functionality to debug the hashing
Add feature to also log into a memory buffer
Add config for debug option ($CCACHE_DEBUG)
Add util to return the command as a string
Mike Gulick [Tue, 24 Jul 2018 19:23:03 +0000 (15:23 -0400)]
process_preprocessed_file: Move gnu_getcwd() out of tight loop
Change process_preprocessed_file from calling getcwd() once per line
in the preprocessed source file to once at the start of the function.
The performance of getcwd() on Mac seems to be terrible compared to
Linux. On a macOS 10.13 build machine, this change improves
process_preprocessed_file runtime on a 10MB preprocessed file from 75
seconds to .75 seconds.
Joel Rosdahl [Fri, 10 Aug 2018 11:25:17 +0000 (13:25 +0200)]
Improve printing of “stats zeroed” statistics
* Refactored how formatting functions work in “ccache -s” output. They
now return a formatted string (or NULL for “don’t print statistics
line at all”) instead of printing the value.
* Added a new format_timestamp function.
* Added STATS_ZEROTIMESTAMP to the common stats_info array instead of
being a special case.
* Let the STATS_ZEROTIMESTAMP value be 0 for new caches so that the
“stats zeroed” statistics line only shows up when “ccache -z” actually
has been called.
Tomasz Miąsko [Wed, 2 May 2018 00:00:00 +0000 (00:00 +0000)]
Avoid TOCTOU issue when deciding if config is valid
Previously, a separate call to access had been used to distinguish
between I/O errors and invalid configuration file. This could lead to
spurious errors if configuration file have been created in-between call
to conf_read and access. Use errno to tell those two cases apart.
Joel Rosdahl [Mon, 23 Apr 2018 20:04:12 +0000 (22:04 +0200)]
Merge branch '3.4-maint'
* 3.4-maint:
Use double when calculating cache thresholds
Add a 32-bit build target, using multilib (-m32)
Convert float config to double, add rounding
Upgrade clang to 5.0, for the Travis docker
Make sure to export ASAN_OPTIONS properly
Add small helper to run all Travis tests
Make sure to call configure with right path
Add a travis-build container, for running locally
Look for -fdebug-prefix-map feature explicitly
Improve the Travis build matrix
Fix log printing of before/after cleanup
Remove irrelevant variable assignment in wipe_dir
win32: Fix CCACHE_COMPILERCHECK=mtime test case
This is not the actual Travis docker container, but it
should be similar enough for doing local verification:
make travis
make travis CC=clang
make travis CC=clang CFLAGS="-fsanitize=address -g" ASAN_OPTIONS="detect_leaks=0"
make travis CC=i686-w64-mingw32-gcc HOST="--host=i686-w64-mingw32" TEST="unittest/run.exe"