working directory in the debug info set incorrectly. This option is off by
default as the incorrect setting of this debug info rarely causes problems.
If you strike problems with GDB not using the correct directory then enable
- this option.
+ this option. The option *only* applies when generating debug info (-g).
*ignore_headers_in_manifest* (*CCACHE_IGNOREHEADERS*)::
/* Size of headers to ignore list */
static size_t ignore_headers_len;
+/* is gcc being asked to output debug info? */
+static bool generating_debuginfo;
+
/* is gcc being asked to output dependencies? */
static bool generating_dependencies;
free(p);
/* Possibly hash the current working directory. */
- if (conf->hash_dir) {
+ if (generating_debuginfo && conf->hash_dir) {
char *cwd = gnu_getcwd();
if (debug_prefix_map) {
char *map = debug_prefix_map;
/* Debugging is handled specially, so that we know if we can strip line
* number info. */
if (str_startswith(argv[i], "-g")) {
+ generating_debuginfo = true;
args_add(stripped_args, argv[i]);
if (conf->unify && !str_eq(argv[i], "-g0")) {
cc_log("%s used; disabling unify mode", argv[i]);
if (included_files) {
hashtable_destroy(included_files, 1); included_files = NULL;
}
+ generating_debuginfo = false;
generating_dependencies = false;
generating_coverage = false;
profile_arcs = false;
checkstat 'files in cache' 4
testname="CCACHE_HASHDIR"
- CCACHE_HASHDIR=1 $CCACHE_COMPILE -c test1.c -O -O
+ CCACHE_HASHDIR=1 $CCACHE_COMPILE -c test1.c -g -O -O
checkstat 'cache hit (preprocessed)' 5
checkstat 'cache miss' 5
- compare_object reference_test1.o test1.o
- CCACHE_HASHDIR=1 $CCACHE_COMPILE -c test1.c -O -O
+ CCACHE_HASHDIR=1 $CCACHE_COMPILE -c test1.c -g -O -O
checkstat 'cache hit (preprocessed)' 6
checkstat 'cache miss' 5
checkstat 'files in cache' 5
- compare_object reference_test1.o test1.o
testname="comments"
echo '/* a silly comment */' > test1-comment.c