25
25
#include " sanitizer_common/sanitizer_thread_registry.h"
26
26
#include " sanitizer_common/sanitizer_tls_get_addr.h"
27
27
28
+ extern " C" const char *__lsan_current_stage = " unknown" ;
29
+
28
30
#if CAN_SANITIZE_LEAKS
29
31
namespace __lsan {
30
32
@@ -34,6 +36,7 @@ BlockingMutex global_mutex(LINKER_INITIALIZED);
34
36
35
37
Flags lsan_flags;
36
38
39
+
37
40
void DisableCounterUnderflow () {
38
41
if (common_flags ()->detect_leaks ) {
39
42
Report (" Unmatched call to __lsan_enable().\n " );
@@ -363,6 +366,7 @@ static void FloodFillTag(Frontier *frontier, ChunkTag tag) {
363
366
// ForEachChunk callback. If the chunk is marked as leaked, marks all chunks
364
367
// which are reachable from it as indirectly leaked.
365
368
static void MarkIndirectlyLeakedCb (uptr chunk, void *arg) {
369
+ __lsan_current_stage = " MarkIndirectlyLeakedCb" ;
366
370
chunk = GetUserBegin (chunk);
367
371
LsanMetadata m (chunk);
368
372
if (m.allocated () && m.tag () != kReachable ) {
@@ -375,6 +379,7 @@ static void MarkIndirectlyLeakedCb(uptr chunk, void *arg) {
375
379
// frontier.
376
380
static void CollectIgnoredCb (uptr chunk, void *arg) {
377
381
CHECK (arg);
382
+ __lsan_current_stage = " CollectIgnoredCb" ;
378
383
chunk = GetUserBegin (chunk);
379
384
LsanMetadata m (chunk);
380
385
if (m.allocated () && m.tag () == kIgnored ) {
@@ -404,6 +409,7 @@ struct InvalidPCParam {
404
409
static void MarkInvalidPCCb (uptr chunk, void *arg) {
405
410
CHECK (arg);
406
411
InvalidPCParam *param = reinterpret_cast <InvalidPCParam *>(arg);
412
+ __lsan_current_stage = " MarkInvalidPCCb" ;
407
413
chunk = GetUserBegin (chunk);
408
414
LsanMetadata m (chunk);
409
415
if (m.allocated () && m.tag () != kReachable && m.tag () != kIgnored ) {
@@ -479,6 +485,7 @@ static void ClassifyAllChunks(SuspendedThreadsList const &suspended_threads,
479
485
// ForEachChunk callback. Resets the tags to pre-leak-check state.
480
486
static void ResetTagsCb (uptr chunk, void *arg) {
481
487
(void )arg;
488
+ __lsan_current_stage = " ResetTagsCb" ;
482
489
chunk = GetUserBegin (chunk);
483
490
LsanMetadata m (chunk);
484
491
if (m.allocated () && m.tag () != kIgnored )
@@ -495,6 +502,7 @@ static void PrintStackTraceById(u32 stack_trace_id) {
495
502
static void CollectLeaksCb (uptr chunk, void *arg) {
496
503
CHECK (arg);
497
504
LeakReport *leak_report = reinterpret_cast <LeakReport *>(arg);
505
+ __lsan_current_stage = " CollectLeaksCb" ;
498
506
chunk = GetUserBegin (chunk);
499
507
LsanMetadata m (chunk);
500
508
if (!m.allocated ()) return ;
0 commit comments