[PATCH] Add flag to dump the labels when the program terminates.

Peter Collingbourne peter at pcc.me.uk
Tue Nov 18 12:16:36 PST 2014


================
Comment at: lib/dfsan/dfsan.cc:277
@@ +276,3 @@
+      atomic_load(&__dfsan_last_label, memory_order_relaxed);
+  for (dfsan_label l = 0; l <= last_label; ++l) {
+    char buf[64];
----------------
You can skip index 0.

================
Comment at: lib/dfsan/dfsan.cc:342
@@ -295,1 +341,3 @@
 static void (*dfsan_init_ptr)(int, char **, char **) = dfsan_init;
+__attribute__((section(".fini_array"), used))
+static void (*dfsan_fini_ptr)() = dfsan_fini;
----------------
The other sanitizers use atexit for this type of thing.

================
Comment at: test/dfsan/dump_labels.c:3
@@ +2,3 @@
+
+// Tests that labels are properly dumped at program termination.
+
----------------
You should also test the case where the program terminates due to running out of labels.

http://reviews.llvm.org/D6306






More information about the llvm-commits mailing list