--- a/nbproject/configurations.xml Mon Sep 24 13:37:30 2018 +0200
+++ b/nbproject/configurations.xml Mon Sep 24 13:47:02 2018 +0200
@@ -67,8 +67,7 @@
<rebuildPropChanged>false</rebuildPropChanged>
</toolsSet>
<flagsDictionary>
- <element flagsID="0"
- commonFlags="-mtune=generic -march=x86-64 -fstack-protector-strong"/>
+ <element flagsID="0" commonFlags="-fsanitize=address"/>
</flagsDictionary>
<codeAssistance>
</codeAssistance>
@@ -80,7 +79,6 @@
<executablePath>build/Debug/src/relpipe-out-chart</executablePath>
<ccTool>
<incDir>
- <pElem>src</pElem>
<pElem>build/Debug/src</pElem>
</incDir>
</ccTool>
--- a/src/CMakeLists.txt Mon Sep 24 13:37:30 2018 +0200
+++ b/src/CMakeLists.txt Mon Sep 24 13:47:02 2018 +0200
@@ -1,1 +1,6 @@
+# Add ASan AddressSanitizer
+set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
+set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
+# From ASan wiki: "To get nicer stack traces in error messages add -fno-omit-frame-pointer."
+
add_executable (relpipe-out-chart relpipe-out-chart.cpp)
--- a/src/relpipe-out-chart.cpp Mon Sep 24 13:37:30 2018 +0200
+++ b/src/relpipe-out-chart.cpp Mon Sep 24 13:47:02 2018 +0200
@@ -2,5 +2,6 @@
int main(int argc, char**argv) {
std::cout << "TODO: relpipe-out-chart..." << std::endl;
+ // char * x = new char[1000]; // simulate a memory leak and test that ASan is working
return 0;
}