2222#include " asan_thread.h"
2323#include " sanitizer_common/sanitizer_common.h"
2424#include " sanitizer_common/sanitizer_dense_map.h"
25+ #include " sanitizer_common/sanitizer_internal_defs.h"
2526#include " sanitizer_common/sanitizer_list.h"
2627#include " sanitizer_common/sanitizer_mutex.h"
2728#include " sanitizer_common/sanitizer_placement_new.h"
@@ -179,7 +180,7 @@ int GetGlobalsForAddress(uptr addr, Global *globals, u32 *reg_sites,
179180 int res = 0 ;
180181 for (const auto &l : list_of_all_globals) {
181182 const Global &g = *l.g ;
182- if (flags ( )->report_globals >= 2 )
183+ if (UNLIKELY ( common_flags ( )->verbosity >= 3 ) )
183184 ReportGlobal (g, " Search" );
184185 if (IsAddressNearGlobal (addr, g)) {
185186 internal_memcpy (&globals[res], &g, sizeof (g));
@@ -270,7 +271,7 @@ static inline bool UseODRIndicator(const Global *g) {
270271// so we store the globals in a map.
271272static void RegisterGlobal (const Global *g) SANITIZER_REQUIRES(mu_for_globals) {
272273 CHECK (AsanInited ());
273- if (flags ( )->report_globals >= 2 )
274+ if (UNLIKELY ( common_flags ( )->verbosity >= 3 ) )
274275 ReportGlobal (*g, " Added" );
275276 CHECK (flags ()->report_globals );
276277 CHECK (AddrIsInMem (g->beg ));
@@ -307,7 +308,7 @@ static void RegisterGlobal(const Global *g) SANITIZER_REQUIRES(mu_for_globals) {
307308static void UnregisterGlobal (const Global *g)
308309 SANITIZER_REQUIRES(mu_for_globals) {
309310 CHECK (AsanInited ());
310- if (flags ( )->report_globals >= 2 )
311+ if (UNLIKELY ( common_flags ( )->verbosity >= 3 ) )
311312 ReportGlobal (*g, " Removed" );
312313 CHECK (flags ()->report_globals );
313314 CHECK (AddrIsInMem (g->beg ));
@@ -438,7 +439,7 @@ void __asan_register_globals(__asan_global *globals, uptr n) {
438439 }
439440 GlobalRegistrationSite site = {stack_id, &globals[0 ], &globals[n - 1 ]};
440441 global_registration_site_vector->push_back (site);
441- if (flags ( )->report_globals >= 2 ) {
442+ if (UNLIKELY ( common_flags ( )->verbosity >= 3 ) ) {
442443 PRINT_CURRENT_STACK ();
443444 Printf (" === ID %d; %p %p\n " , stack_id, (void *)&globals[0 ],
444445 (void *)&globals[n - 1 ]);
@@ -497,9 +498,7 @@ void __asan_before_dynamic_init(const char *module_name) {
497498 Lock lock (&mu_for_globals);
498499 if (current_dynamic_init_module_name == module_name)
499500 return ;
500- if (flags ()->report_globals >= 3 )
501- Printf (" DynInitPoison module: %s\n " , module_name);
502-
501+ VPrintf (2 , " DynInitPoison module: %s\n " , module_name);
503502 if (current_dynamic_init_module_name == nullptr ) {
504503 // First call, poison all globals from other modules.
505504 DynInitGlobals ().forEach ([&](auto &kv) {
@@ -545,8 +544,7 @@ static void UnpoisonBeforeMain(void) {
545544 return ;
546545 allow_after_dynamic_init = true ;
547546 }
548- if (flags ()->report_globals >= 3 )
549- Printf (" UnpoisonBeforeMain\n " );
547+ VPrintf (2 , " UnpoisonBeforeMain\n " );
550548 __asan_after_dynamic_init ();
551549}
552550
@@ -570,8 +568,7 @@ void __asan_after_dynamic_init() {
570568 if (!current_dynamic_init_module_name)
571569 return ;
572570
573- if (flags ()->report_globals >= 3 )
574- Printf (" DynInitUnpoison\n " );
571+ VPrintf (2 , " DynInitUnpoison\n " );
575572
576573 DynInitGlobals ().forEach ([&](auto &kv) {
577574 UnpoisonDynamicGlobals (kv.second , /* mark_initialized=*/ false );
0 commit comments