[pkg-d-commits] [ldc] 32/211: Enable gdb tests in dmd-testsuite (#1784)
Matthias Klumpp
mak at moszumanska.debian.org
Sun Apr 23 22:36:07 UTC 2017
This is an automated email from the git hooks/post-receive script.
mak pushed a commit to annotated tag v1.1.0
in repository ldc.
commit 5bcfb49b1b69bfb0c84985092c3a5170717a5712
Author: Rainer Schuetze <r.sagitario at gmx.de>
Date: Tue Sep 27 01:26:15 2016 +0200
Enable gdb tests in dmd-testsuite (#1784)
Introduce a hidden `-dwarf-version=<uint>` switch to support old gdb versions
used by Travis. Older versions only supporting DWARF-2 and/or not supporting
TLS correctly are detected in dmd-testsuite's CMakefile.
---
.travis.yml | 1 +
circle.yml | 1 +
ddmd/globals.d | 1 +
ddmd/globals.h | 1 +
driver/cl_options.cpp | 5 +++++
gen/dibuilder.cpp | 3 +++
tests/d2/CMakeLists.txt | 37 ++++++++++++++++++++++++++++++-------
tests/d2/dmd-testsuite | 2 +-
8 files changed, 43 insertions(+), 8 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index b763fc9..7d8d3af 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -64,6 +64,7 @@ install:
- eval "${DC} --version"
- pip install --user lit
- python -c "import lit; lit.main();" --version | head -n 1
+ - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then gdb --version; fi
script:
- cmake --version
diff --git a/circle.yml b/circle.yml
index 636a4c4..684219c 100644
--- a/circle.yml
+++ b/circle.yml
@@ -34,6 +34,7 @@ dependencies:
- ldc2 -version
- cmake --version
- python -c "import lit; lit.main();" --version | head -n 1
+ - gdb --version
checkout:
post:
diff --git a/ddmd/globals.d b/ddmd/globals.d
index 7ac7f3d..6592c21 100644
--- a/ddmd/globals.d
+++ b/ddmd/globals.d
@@ -217,6 +217,7 @@ struct Param
// Codegen cl options
bool disableRedZone;
+ uint dwarfVersion;
uint hashThreshold; // MD5 hash symbols larger than this threshold (0 = no hashing)
}
diff --git a/ddmd/globals.h b/ddmd/globals.h
index 64ce2da..7352a3c 100644
--- a/ddmd/globals.h
+++ b/ddmd/globals.h
@@ -215,6 +215,7 @@ struct Param
// Codegen cl options
bool disableRedZone;
+ uint32_t dwarfVersion;
uint32_t hashThreshold; // MD5 hash symbols larger than this threshold (0 = no hashing)
#endif
diff --git a/driver/cl_options.cpp b/driver/cl_options.cpp
index 824e63e..f032708 100644
--- a/driver/cl_options.cpp
+++ b/driver/cl_options.cpp
@@ -119,6 +119,11 @@ static cl::opt<ubyte, true>
clEnumValEnd),
cl::location(global.params.symdebug), cl::init(0));
+static cl::opt<unsigned, true>
+ dwarfVersion("dwarf-version", cl::desc("Dwarf version"),
+ cl::location(global.params.dwarfVersion), cl::init(0),
+ cl::Hidden);
+
cl::opt<bool> noAsm("noasm", cl::desc("Disallow use of inline assembler"));
// Output file options
diff --git a/gen/dibuilder.cpp b/gen/dibuilder.cpp
index 38aa5cb..22f5fe3 100644
--- a/gen/dibuilder.cpp
+++ b/gen/dibuilder.cpp
@@ -700,6 +700,9 @@ void ldc::DIBuilder::EmitCompileUnit(Module *m) {
#if LDC_LLVM_VER >= 308
if (global.params.targetTriple->isWindowsMSVCEnvironment())
IR->module.addModuleFlag(llvm::Module::Warning, "CodeView", 1);
+ else if (global.params.dwarfVersion > 0)
+ IR->module.addModuleFlag(llvm::Module::Warning, "Dwarf Version",
+ global.params.dwarfVersion);
#endif
// Metadata without a correct version will be stripped by UpgradeDebugInfo.
IR->module.addModuleFlag(llvm::Module::Warning, "Debug Info Version",
diff --git a/tests/d2/CMakeLists.txt b/tests/d2/CMakeLists.txt
index 6d1082b..cf64789 100644
--- a/tests/d2/CMakeLists.txt
+++ b/tests/d2/CMakeLists.txt
@@ -6,30 +6,53 @@ elseif(${ptr_size} MATCHES "^8$")
set(host_model 64)
endif()
-function(add_testsuite config_name dflags model)
+set(gdb_dflags "")
+if((${CMAKE_SYSTEM_NAME} MATCHES "Linux") AND (${LDC_LLVM_VER} GREATER 307))
+ execute_process(COMMAND gdb --version
+ COMMAND head -n 1
+ OUTPUT_VARIABLE GDB_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REGEX REPLACE "[^0-9]*([0-9]+[0-9.]*).*" "\\1" GDB_VERSION "${GDB_VERSION}")
+ message(STATUS "GDB ${GDB_VERSION} detected")
+ if(GDB_VERSION VERSION_LESS "7.6.1")
+ set(gdb_flags "NOTLS")
+ else()
+ set(gdb_flags "ON")
+ endif()
+ if(GDB_VERSION VERSION_LESS "7.8")
+ set(gdb_dflags "-dwarf-version=2")
+ endif()
+else()
+ set(gdb_flags "OFF")
+endif()
+
+function(add_testsuite config_name dflags gdbflags model)
set(name dmd-testsuite${config_name})
set(outdir ${CMAKE_BINARY_DIR}/${name})
add_test(NAME clean-${name}
COMMAND ${CMAKE_COMMAND} -E remove_directory ${outdir})
+ set(all_dflags "${dflags} ${gdb_dflags}")
+
# The DFLAGS environment variable read by LDMD is used because the DMD
# testsuite build system provides no way to run the test cases with a
# given set of flags without trying all combinations of them.
add_test(NAME ${name}
- COMMAND make -k -C ${PROJECT_SOURCE_DIR}/tests/d2/dmd-testsuite RESULTS_DIR=${outdir} DMD=${LDMD_EXE_FULL} DFLAGS=${dflags} MODEL=${model} quick
+ COMMAND make -k -C ${PROJECT_SOURCE_DIR}/tests/d2/dmd-testsuite RESULTS_DIR=${outdir} DMD=${LDMD_EXE_FULL} DFLAGS=${all_dflags} MODEL=${model} GDB_FLAGS=${gdbflags} quick
)
set_tests_properties(${name} PROPERTIES DEPENDS clean-${name})
endfunction()
-# Would like to specify the "-release" flag for relase builds, but some of the
+string(REGEX REPLACE "[^0-9]*([0-9]+[0-9.]*).*" "\\1" GDB_VERSION "${GDB_VERSION}")
+# Would like to specify the "-release" flag for release builds, but some of the
# tests (e.g. 'testdstress') depend on contracts and invariants being active.
# Need a solution integrated with d_do_test.
-add_testsuite("-debug" "-gc -link-debuglib" ${host_model})
-add_testsuite("" -O3 ${host_model})
+add_testsuite("-debug" "-g -link-debuglib" "${gdb_flags}" ${host_model})
+add_testsuite("" -O3 "OFF" ${host_model})
if(MULTILIB AND host_model EQUAL 64)
# Also test in 32 bit mode on x86_64 multilib builds.
- add_testsuite("-debug-32" "-gc -link-debuglib" 32)
- add_testsuite("-32" -O3 32)
+ add_testsuite("-debug-32" "-g -link-debuglib" "${gdb_flags}" 32)
+ add_testsuite("-32" -O3 "OFF" 32)
endif()
diff --git a/tests/d2/dmd-testsuite b/tests/d2/dmd-testsuite
index eeebe9a..0e308ff 160000
--- a/tests/d2/dmd-testsuite
+++ b/tests/d2/dmd-testsuite
@@ -1 +1 @@
-Subproject commit eeebe9a301ec05fb5dbdb79f2b567f2061943790
+Subproject commit 0e308ffa054e5d72aa775dd4db715f2ef50514b9
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-d/ldc.git
More information about the pkg-d-commits
mailing list