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

Lorenzo Martignoni martignlo at google.com
Wed Nov 19 05:32:02 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];
----------------
pcc wrote:
> You can skip index 0.
Done.

================
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;
----------------
pcc wrote:
> The other sanitizers use atexit for this type of thing.
Moved the registration to dfsan_init.

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

http://reviews.llvm.org/D6306






More information about the llvm-commits mailing list