This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Remove logging from Platform::~Platform
ClosedPublic

Authored by teemperor on Oct 14 2021, 9:19 AM.

Details

Summary

Platform instances are stored in a function-local static list. However,
the logging code involves locking a function-local static mutex. This only
works on some implementations where the Log mutex is by accident
destroyed *after* the Platform list is destroyed.

This fixes randomly failing tests due to recursive_mutex lock failed: Invalid argument.

Diff Detail

Event Timeline

teemperor created this revision.Oct 14 2021, 9:19 AM
teemperor requested review of this revision.Oct 14 2021, 9:19 AM
kastiglione accepted this revision.Oct 14 2021, 9:20 AM
This revision is now accepted and ready to land.Oct 14 2021, 9:20 AM

This logging doesn't seem too useful anyway.

should this be = default; now?

  • defaulted dtor

should this be = default; now?

Thanks, we have other functions for pinning the vtable so this seems like the way to go.

This revision was automatically updated to reflect the committed changes.
thakis added a subscriber: thakis.Oct 14 2021, 11:46 AM

http://45.33.8.238/mac/37050/step_4.txt

In file included from ../../lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp:9:
In file included from ../../lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.h:12:
In file included from ../../../chrome/src/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/map:495:
In file included from ../../../chrome/src/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/__node_handle:63:
In file included from ../../../chrome/src/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/memory:682:
In file included from ../../../chrome/src/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/__memory/shared_ptr.h:25:
../../../chrome/src/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/__memory/unique_ptr.h:50:19: error: invalid application of 'sizeof' to an incomplete type 'lldb_private::ModuleCache'
    static_assert(sizeof(_Tp) > 0,
                  ^~~~~~~~~~~
../../../chrome/src/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/__memory/unique_ptr.h:315:7: note: in instantiation of member function 'std::default_delete<lldb_private::ModuleCache>::operator()' requested here
      __ptr_.second()(__tmp);
      ^
../../../chrome/src/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/__memory/unique_ptr.h:269:19: note: in instantiation of member function 'std::unique_ptr<lldb_private::ModuleCache>::reset' requested here
  ~unique_ptr() { reset(); }
                  ^
../../lldb/include/lldb/Target/Platform.h:78:3: note: in instantiation of member function 'std::unique_ptr<lldb_private::ModuleCache>::~unique_ptr' requested here
  ~Platform() override = default;
  ^
../../lldb/include/lldb/Target/Platform.h:39:7: note: forward declaration of 'lldb_private::ModuleCache'
class ModuleCache;
      ^

Fixed, thanks!

http://45.33.8.238/mac/37050/step_4.txt

In file included from ../../lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp:9:
In file included from ../../lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.h:12:
In file included from ../../../chrome/src/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/map:495:
In file included from ../../../chrome/src/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/__node_handle:63:
In file included from ../../../chrome/src/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/memory:682:
In file included from ../../../chrome/src/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/__memory/shared_ptr.h:25:
../../../chrome/src/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/__memory/unique_ptr.h:50:19: error: invalid application of 'sizeof' to an incomplete type 'lldb_private::ModuleCache'
    static_assert(sizeof(_Tp) > 0,
                  ^~~~~~~~~~~
../../../chrome/src/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/__memory/unique_ptr.h:315:7: note: in instantiation of member function 'std::default_delete<lldb_private::ModuleCache>::operator()' requested here
      __ptr_.second()(__tmp);
      ^
../../../chrome/src/third_party/llvm-build/Release+Asserts/bin/../include/c++/v1/__memory/unique_ptr.h:269:19: note: in instantiation of member function 'std::unique_ptr<lldb_private::ModuleCache>::reset' requested here
  ~unique_ptr() { reset(); }
                  ^
../../lldb/include/lldb/Target/Platform.h:78:3: note: in instantiation of member function 'std::unique_ptr<lldb_private::ModuleCache>::~unique_ptr' requested here
  ~Platform() override = default;
  ^
../../lldb/include/lldb/Target/Platform.h:39:7: note: forward declaration of 'lldb_private::ModuleCache'
class ModuleCache;
      ^