@@ -146,17 +146,6 @@ inline constexpr bool kPlatformUsesOPDSections = false;
146146// pointers and the first one is the function's entry.
147147const size_t kFunctionDescriptorSize = sizeof (void * ) * 2 ;
148148
149- const int kMaxDecorators = 10 ; // Seems like a reasonable upper limit.
150-
151- struct InstalledSymbolDecorator {
152- LegacySymbolDecorator fn;
153- void * arg;
154- int ticket;
155- };
156-
157- int g_num_decorators;
158- InstalledSymbolDecorator g_decorators[kMaxDecorators];
159-
160149std ::atomic< SymbolDecorator ::Factory* > g_decorator_factory = nullptr;
161150
162151struct FileMappingHint {
@@ -166,16 +155,6 @@ struct FileMappingHint {
166155 const char * filename;
167156};
168157
169- // Protects g_decorators.
170- // We are using SpinLock and not a Mutex here, because we may be called
171- // from inside Mutex::Lock itself, and it prohibits recursive calls.
172- // This happens in e.g. base/stacktrace_syscall_unittest.
173- // Moreover, we are using only try_lock(), if the decorator list
174- // is being modified (is busy), we skip all decorators, and possibly
175- // loose some info. Sorry, that's the best we could do.
176- ABSL_CONST_INIT absl ::base_internal ::SpinLock g_decorators_mu (
177- absl ::base_internal ::SCHEDULE_KERNEL_ONLY);
178-
179158const int kMaxFileMappingHints = 8 ;
180159int g_num_file_mapping_hints;
181160FileMappingHint g_file_mapping_hints[kMaxFileMappingHints];
@@ -1507,7 +1486,6 @@ static bool MaybeInitializeObjFile(
15071486const char * Symbolizer ::GetUncachedSymbol (const void * pc) {
15081487 ObjFile * const obj = FindObjFile (pc, 1 );
15091488 ptrdiff_t relocation = 0 ;
1510- int fd = - 1 ;
15111489 if (obj ! = nullptr) {
15121490 if (MaybeInitializeObjFile (obj, decorator_factory_)) {
15131491 const size_t start_addr = reinterpret_cast< size_t> (obj- > start_addr);
@@ -1549,7 +1527,6 @@ const char *Symbolizer::GetUncachedSymbol(const void *pc) {
15491527 }
15501528 }
15511529
1552- fd = obj- > fd;
15531530 if (GetSymbolFromObjectFile (* obj, pc, relocation, symbol_buf_,
15541531 sizeof (symbol_buf_), tmp_buf_,
15551532 sizeof (tmp_buf_)) == SYMBOL_FOUND) {
@@ -1574,18 +1551,6 @@ const char *Symbolizer::GetUncachedSymbol(const void *pc) {
15741551# endif
15751552 }
15761553
1577- if (g_decorators_mu.try_lock ()) {
1578- if (g_num_decorators > 0 ) {
1579- SymbolDecoratorArgs decorator_args = {
1580- pc, relocation, fd, symbol_buf_, sizeof (symbol_buf_),
1581- tmp_buf_, sizeof (tmp_buf_), nullptr};
1582- for (int i = 0 ; i < g_num_decorators; ++ i) {
1583- decorator_args.arg = g_decorators[i].arg;
1584- g_decorators[i].fn (& decorator_args);
1585- }
1586- }
1587- g_decorators_mu.unlock ();
1588- }
15891554 if (obj ! = nullptr && obj- > decorator ! = nullptr) {
15901555 obj- > decorator- > Decorate (pc, relocation, symbol_buf_, sizeof (symbol_buf_),
15911556 tmp_buf_, sizeof (tmp_buf_));
@@ -1633,55 +1598,6 @@ const char *Symbolizer::GetSymbol(const void *pc) {
16331598# endif
16341599}
16351600
1636- bool RemoveAllSymbolDecorators () {
1637- SetSymbolDecoratorFactory (nullptr);
1638-
1639- if (! g_decorators_mu.try_lock ()) {
1640- // Someone else is using decorators. Get out.
1641- return false ;
1642- }
1643- g_num_decorators = 0 ;
1644- g_decorators_mu.unlock ();
1645- return true ;
1646- }
1647-
1648- bool RemoveSymbolDecorator (int ticket) {
1649- if (! g_decorators_mu.try_lock ()) {
1650- // Someone else is using decorators. Get out.
1651- return false ;
1652- }
1653- for (int i = 0 ; i < g_num_decorators; ++ i) {
1654- if (g_decorators[i].ticket == ticket) {
1655- while (i < g_num_decorators - 1 ) {
1656- g_decorators[i] = g_decorators[i + 1 ];
1657- ++ i;
1658- }
1659- g_num_decorators = i;
1660- break ;
1661- }
1662- }
1663- g_decorators_mu.unlock ();
1664- return true ; // Decorator is known to be removed.
1665- }
1666-
1667- int InstallSymbolDecorator (LegacySymbolDecorator decorator, void * arg) {
1668- static int ticket = 0 ;
1669-
1670- if (! g_decorators_mu.try_lock ()) {
1671- // Someone else is using decorators. Get out.
1672- return - 2 ;
1673- }
1674- int ret = ticket;
1675- if (g_num_decorators >= kMaxDecorators) {
1676- ret = - 1 ;
1677- } else {
1678- g_decorators[g_num_decorators] = {decorator, arg, ticket++ };
1679- ++ g_num_decorators;
1680- }
1681- g_decorators_mu.unlock ();
1682- return ret;
1683- }
1684-
16851601SymbolDecorator ::Factory* SetSymbolDecoratorFactory (
16861602 SymbolDecorator ::Factory* factory) {
16871603 return g_decorator_factory.exchange (factory, std ::memory_order_acq_rel);
0 commit comments