aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2021-08-03 11:31:14 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2021-08-04 15:26:36 -0400
commit06b80590fbe63875e8e7a6c97622675b8ac099bc (patch)
treee4dc4693533e4189e1aa052a140a757ce3eab970
parentf6c4a82abddd59a33ca38813a5721fac99b08f34 (diff)
downloadbinutils-06b80590fbe63875e8e7a6c97622675b8ac099bc.zip
binutils-06b80590fbe63875e8e7a6c97622675b8ac099bc.tar.gz
binutils-06b80590fbe63875e8e7a6c97622675b8ac099bc.tar.bz2
gdb/testsuite: fix gdb.base/info-macros.exp with clang
The test gdb.base/info-macros.exp says that it doesn't pass the "debug" option to prepare_for_testing because that would cause -g to appear after -g3 on the command line, and that would cause some gcc versions to not include macro info. I don't know what gcc versions this refers to. I tested with gcc 4.8, and that works fine with -g after -g3. The current state is problematic when testing with CC_FOR_TARGET=clang, because then only -fdebug-macro is included. No -g switch if included, meaning we get a binary without any debug info, and the test fails. One way to fix it would be to add "debug" to the options when the compiler is clang. However, the solution I chose was to specify "debug" in any case, even for gcc. Other macro tests such as gdb.base/macscp.exp do perfectly fine with it. Also, this lets the test use the debug flag specified by the board file. For example, we can test with GCC and DWARF 5, with: $ make check RUNTESTFLAGS="--target_board unix/gdb:debug_flags=-gdwarf-5" TESTS="gdb.base/info-macros.exp" With the hard-coded -g3, this wouldn't actually test with DWARF 5. Change-Id: I33fa92ee545007d3ae9c52c4bb2d5be6b5b698f1
-rw-r--r--gdb/testsuite/gdb.base/info-macros.exp8
1 files changed, 4 insertions, 4 deletions
diff --git a/gdb/testsuite/gdb.base/info-macros.exp b/gdb/testsuite/gdb.base/info-macros.exp
index 538279f..f1d912a 100644
--- a/gdb/testsuite/gdb.base/info-macros.exp
+++ b/gdb/testsuite/gdb.base/info-macros.exp
@@ -21,13 +21,13 @@ if [using_fission] {
return -1
}
+set options {debug}
+
get_compiler_info
if { [test_compiler_info gcc*] } {
- # Don't use "debug" here. Otherwise "-g" would be appended to the gcc
- # command line, possibly overriding "-g3" (depending on gcc version).
- set options "additional_flags=-g3"
+ lappend options "additional_flags=-g3"
} elseif { [test_compiler_info clang*] } {
- set options "additional_flags=-fdebug-macro"
+ lappend options "additional_flags=-fdebug-macro"
} else {
untested "no compiler info"
return -1