[Lldb-commits] [PATCH] D99314: [lldb] Add IsSafeToCallAPI to DynamicLoader
Jonas Devlieghere via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Mar 25 15:44:55 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbbb419151cc8: [lldb] Add IsFullyInitialized to DynamicLoader (authored by JDevlieghere).
Herald added a project: LLDB.
Changed prior to commit:
https://reviews.llvm.org/D99314?vs=333192&id=333443#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99314/new/
https://reviews.llvm.org/D99314
Files:
lldb/include/lldb/Target/DynamicLoader.h
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h
Index: lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h
===================================================================
--- lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h
+++ lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.h
@@ -68,6 +68,8 @@
uint32_t GetPluginVersion() override;
+ bool IsFullyInitialized() override;
+
protected:
void PutToLog(lldb_private::Log *log) const;
Index: lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
===================================================================
--- lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
+++ lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
@@ -1114,6 +1114,12 @@
return false;
}
+bool DynamicLoaderMacOSXDYLD::IsFullyInitialized() {
+ if (ReadAllImageInfosStructure())
+ return m_dyld_all_image_infos.libSystemInitialized;
+ return false;
+}
+
void DynamicLoaderMacOSXDYLD::Initialize() {
PluginManager::RegisterPlugin(GetPluginNameStatic(),
GetPluginDescriptionStatic(), CreateInstance);
Index: lldb/include/lldb/Target/DynamicLoader.h
===================================================================
--- lldb/include/lldb/Target/DynamicLoader.h
+++ lldb/include/lldb/Target/DynamicLoader.h
@@ -251,6 +251,14 @@
return false;
}
+ /// Return whether the dynamic loader is fully initialized and it's safe to
+ /// call its APIs.
+ ///
+ /// On some systems (e.g. Darwin based systems), lldb will get notified by
+ /// the dynamic loader before it itself finished initializing and it's not
+ /// safe to call certain APIs or SPIs.
+ virtual bool IsFullyInitialized() { return true; }
+
protected:
// Utility methods for derived classes
@@ -294,7 +302,7 @@
// Read a pointer from memory at the given addr. Return LLDB_INVALID_ADDRESS
// if the read fails.
lldb::addr_t ReadPointer(lldb::addr_t addr);
-
+
// Calls into the Process protected method LoadOperatingSystemPlugin:
void LoadOperatingSystemPlugin(bool flush);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99314.333443.patch
Type: text/x-patch
Size: 2139 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210325/429daf75/attachment-0001.bin>
More information about the lldb-commits
mailing list