[Lldb-commits] [PATCH] D15092: Fix hang in global static initialization
Adrian McCarthy via lldb-commits
lldb-commits at lists.llvm.org
Mon Nov 30 13:57:43 PST 2015
amccarth created this revision.
amccarth added reviewers: EwanCrawford, zturner.
amccarth added a subscriber: lldb-commits.
A previous patch introduced a global static ConstString instance. On Windows, this results in a hang because constructing the string pool appears to depend on other globals which haven't yet been initialized.
All other instances of static ConstStrings I could find were function static, so I modified the code to use a static function.
http://reviews.llvm.org/D15092
Files:
source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
Index: source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
===================================================================
--- source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
+++ source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
@@ -182,7 +182,7 @@
empirical_type<uint32_t> array_size; // Number of items in array, only needed for strucrs
ConstString type_name; // Name of type, only needed for structs
- static const ConstString FallbackStructName; // Print this as the type name of a struct Element
+ static const ConstString &GetFallbackStructName(); // Print this as the type name of a struct Element
// If we can't resolve the actual struct name
};
@@ -250,7 +250,13 @@
}
};
-const ConstString RenderScriptRuntime::Element::FallbackStructName("struct");
+
+const ConstString &
+RenderScriptRuntime::Element::GetFallbackStructName()
+{
+ static const ConstString FallbackStructName("struct");
+ return FallbackStructName;
+}
unsigned int RenderScriptRuntime::AllocationDetails::ID = 1;
@@ -1629,7 +1635,7 @@
if (!elem.type_name.IsEmpty()) // Name already set
return;
else
- elem.type_name = Element::FallbackStructName; // Default type name if we don't succeed
+ elem.type_name = Element::GetFallbackStructName(); // Default type name if we don't succeed
// Find all the global variables from the script rs modules
VariableList variable_list;
@@ -2428,7 +2434,7 @@
{
strm.Printf("\n(%u, %u, %u) = ", x, y, z);
if ((type == Element::RS_TYPE_NONE) && (alloc->element.children.size() > 0) &&
- (alloc->element.type_name != Element::FallbackStructName))
+ (alloc->element.type_name != Element::GetFallbackStructName()))
{
// Here we are dumping an Element of struct type.
// This is done using expression evaluation with the name of the struct type and pointer to element.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15092.41433.patch
Type: text/x-patch
Size: 2234 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20151130/47e5d720/attachment.bin>
More information about the lldb-commits
mailing list