summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSergey Matveev <earthdok@google.com>2013-07-18 14:06:07 +0000
committerSergey Matveev <earthdok@google.com>2013-07-18 14:06:07 +0000
commitf93fa97b9fb49c6aaeeadf94fc54c76374b580bd (patch)
treeb40dbcd8865323e89dd583bc26535dea03c0142e /include
parent158ca5237af46076225d5d82a38ae0f733f57f31 (diff)
[lsan] Add __lsan_do_leak_check() to the public interface.
Let users override the normal behavior to run leak checking earlier in the process. Also fix a couple nits here and there. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@186581 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/sanitizer/lsan_interface.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/include/sanitizer/lsan_interface.h b/include/sanitizer/lsan_interface.h
index 97a88a502..96ddc84ef 100644
--- a/include/sanitizer/lsan_interface.h
+++ b/include/sanitizer/lsan_interface.h
@@ -20,15 +20,23 @@
extern "C" {
#endif
// Allocations made between calls to __lsan_disable() and __lsan_enable() will
- // be treated as non-leaks. Disable/enable pairs can be nested.
+ // be treated as non-leaks. Disable/enable pairs may be nested.
void __lsan_disable();
void __lsan_enable();
// The heap object into which p points will be treated as a non-leak.
void __lsan_ignore_object(const void *p);
// The user may optionally provide this function to disallow leak checking
- // for the program it is linked into. Note: this function may be called late,
- // after all the global destructors.
+ // for the program it is linked into (if the return value is non-zero). This
+ // function must be defined as returning a constant value; any behavior beyond
+ // that is unsupported.
int __lsan_is_turned_off();
+ // Calling this function makes LSan enter the leak checking phase immediately.
+ // Use this if normal end-of-process leak checking happens too late (e.g. if
+ // you have intentional memory leaks in your shutdown code). Calling this
+ // function overrides end-of-process leak checking; it must be called at
+ // most once per process. This function will terminate the process if there
+ // are memory leaks and the exit_code flag is non-zero.
+ void __lsan_do_leak_check();
#ifdef __cplusplus
} // extern "C"