bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 4/4] doc: using asan


From: Akim Demaille
Subject: [PATCH 4/4] doc: using asan
Date: Mon, 1 Jun 2020 07:51:20 +0200

* README-hacking.md: here.
---
 README-hacking.md | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/README-hacking.md b/README-hacking.md
index d596c7e3..2fa15824 100644
--- a/README-hacking.md
+++ b/README-hacking.md
@@ -437,6 +437,31 @@ Use the `javaexec.sh` script.  For instance to run the 
parser of test case
 
     $ sh ./_build/javaexec.sh -cp ./_build/tests/testsuite.dir/504 Calc
 
+## Using Sanitizers
+Address sanitizer (ASAN) and undefined-behavior sanitizer (UBSAN) are very
+useful.  Here's one way to set ASAN up with GCC 10 on MacPorts
+
+1. Configure with
+
+    $ ~bison/configure -C --enable-gcc-warnings \
+        CPPFLAGS='-isystem /opt/local/include' \
+        CC='gcc-mp-10 -fsanitize=address' \
+        CFLAGS='-ggdb' \
+        CXX='g++-mp-10.0 -fsanitize=address' \
+        CXXFLAGS='-ggdb' \
+        LDFLAGS='-L/opt/local/lib'
+
+2. Compile
+
+3. Generate debug symbols:
+
+    $ dsymutil src/bison
+
+4. Run the tests with leak detection enabled
+   (`ASAN_OPTIONS=detect_leaks=1`).  E.g. for counterexamples:
+
+    $ make check-local TESTSUITEFLAGS='-j5 -k cex' ASAN_OPTIONS=detect_leaks=1
+
 ## make maintainer-check-valgrind
 This target uses valgrind both to check bison, and the generated parsers.
 
-- 
2.26.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]