8c4c91e
--- a/gdb/testsuite/gdb.base/macscp.exp
8c4c91e
+++ b/gdb/testsuite/gdb.base/macscp.exp
8c4c91e
@@ -33,6 +33,14 @@ if [test_compiler_info gcc*] {
8c4c91e
     lappend options additional_flags=-g3
8c4c91e
 }
8c4c91e
 
8c4c91e
+# Workaround ccache making lineno non-zero for command-line definitions.
8c4c91e
+if {[find_gcc] == "gcc" && [file executable "/usr/bin/gcc"]} {
8c4c91e
+    set result [catch "exec which gcc" output]
Jan Kratochvil 9e9d7b2
+    if {$result == 0 && [string first "/ccache/" $output] > -1} {
Jan Kratochvil 9e9d7b2
+	lappend options "compiler=/usr/bin/gcc"
8c4c91e
+    }
8c4c91e
+}
8c4c91e
+
8c4c91e
 # Generate the intermediate object file.  This is required by Darwin to
8c4c91e
 # have access to the .debug_macinfo section.
8c4c91e
 if  {[gdb_compile "${srcdir}/${subdir}/macscp1.c" "${objfile}" \