22
22
#include " asan_thread.h"
23
23
#include " sanitizer_common/sanitizer_common.h"
24
24
#include " sanitizer_common/sanitizer_dense_map.h"
25
- #include " sanitizer_common/sanitizer_internal_defs.h"
26
25
#include " sanitizer_common/sanitizer_list.h"
27
26
#include " sanitizer_common/sanitizer_mutex.h"
28
27
#include " sanitizer_common/sanitizer_placement_new.h"
@@ -180,7 +179,7 @@ int GetGlobalsForAddress(uptr addr, Global *globals, u32 *reg_sites,
180
179
int res = 0 ;
181
180
for (const auto &l : list_of_all_globals) {
182
181
const Global &g = *l.g ;
183
- if (UNLIKELY ( common_flags ( )->verbosity >= 3 ) )
182
+ if (flags ( )->report_globals >= 2 )
184
183
ReportGlobal (g, " Search" );
185
184
if (IsAddressNearGlobal (addr, g)) {
186
185
internal_memcpy (&globals[res], &g, sizeof (g));
@@ -271,7 +270,7 @@ static inline bool UseODRIndicator(const Global *g) {
271
270
// so we store the globals in a map.
272
271
static void RegisterGlobal (const Global *g) SANITIZER_REQUIRES(mu_for_globals) {
273
272
CHECK (AsanInited ());
274
- if (UNLIKELY ( common_flags ( )->verbosity >= 3 ) )
273
+ if (flags ( )->report_globals >= 2 )
275
274
ReportGlobal (*g, " Added" );
276
275
CHECK (flags ()->report_globals );
277
276
CHECK (AddrIsInMem (g->beg ));
@@ -308,7 +307,7 @@ static void RegisterGlobal(const Global *g) SANITIZER_REQUIRES(mu_for_globals) {
308
307
static void UnregisterGlobal (const Global *g)
309
308
SANITIZER_REQUIRES(mu_for_globals) {
310
309
CHECK (AsanInited ());
311
- if (UNLIKELY ( common_flags ( )->verbosity >= 3 ) )
310
+ if (flags ( )->report_globals >= 2 )
312
311
ReportGlobal (*g, " Removed" );
313
312
CHECK (flags ()->report_globals );
314
313
CHECK (AddrIsInMem (g->beg ));
@@ -439,7 +438,7 @@ void __asan_register_globals(__asan_global *globals, uptr n) {
439
438
}
440
439
GlobalRegistrationSite site = {stack_id, &globals[0 ], &globals[n - 1 ]};
441
440
global_registration_site_vector->push_back (site);
442
- if (UNLIKELY ( common_flags ( )->verbosity >= 3 ) ) {
441
+ if (flags ( )->report_globals >= 2 ) {
443
442
PRINT_CURRENT_STACK ();
444
443
Printf (" === ID %d; %p %p\n " , stack_id, (void *)&globals[0 ],
445
444
(void *)&globals[n - 1 ]);
@@ -498,7 +497,9 @@ void __asan_before_dynamic_init(const char *module_name) {
498
497
Lock lock (&mu_for_globals);
499
498
if (current_dynamic_init_module_name == module_name)
500
499
return ;
501
- VPrintf (2 , " DynInitPoison module: %s\n " , module_name);
500
+ if (flags ()->report_globals >= 3 )
501
+ Printf (" DynInitPoison module: %s\n " , module_name);
502
+
502
503
if (current_dynamic_init_module_name == nullptr ) {
503
504
// First call, poison all globals from other modules.
504
505
DynInitGlobals ().forEach ([&](auto &kv) {
@@ -544,7 +545,8 @@ static void UnpoisonBeforeMain(void) {
544
545
return ;
545
546
allow_after_dynamic_init = true ;
546
547
}
547
- VPrintf (2 , " UnpoisonBeforeMain\n " );
548
+ if (flags ()->report_globals >= 3 )
549
+ Printf (" UnpoisonBeforeMain\n " );
548
550
__asan_after_dynamic_init ();
549
551
}
550
552
@@ -568,7 +570,8 @@ void __asan_after_dynamic_init() {
568
570
if (!current_dynamic_init_module_name)
569
571
return ;
570
572
571
- VPrintf (2 , " DynInitUnpoison\n " );
573
+ if (flags ()->report_globals >= 3 )
574
+ Printf (" DynInitUnpoison\n " );
572
575
573
576
DynInitGlobals ().forEach ([&](auto &kv) {
574
577
UnpoisonDynamicGlobals (kv.second , /* mark_initialized=*/ false );
0 commit comments