[Lldb-commits] [PATCH] Fix assertion for i386 process on x86_64 linux host

Todd Fiala tfiala at google.com
Mon Aug 11 20:01:59 PDT 2014


Hey Tong,

I think the intent here was simply a mistake of forgetting a reference.
 Let's go with a simpler fix:

Index: source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp
===================================================================
--- source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp (revision
215418)
+++ source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp (working
copy)
@@ -90,7 +90,7 @@
 static const RegisterInfo *
 GetRegisterInfo_i386(const lldb_private::ArchSpec &arch)
 {
-    static std::vector<lldb_private::RegisterInfo> g_register_infos
(GetPrivateRegisterInfoVector ());
+    std::vector<lldb_private::RegisterInfo> &g_register_infos =
GetPrivateRegisterInfoVector ();

     // Allocate RegisterInfo only once
     if (g_register_infos.empty())

This removes the need for the global destructor and doesn't pay a price if
that register info type is never hit.

Can you verify if this patch still fixes the issue?  If so, I'd rather go
with this.

Thanks!

-Todd




On Mon, Aug 11, 2014 at 3:43 PM, Tong Shen <endlessroad at google.com> wrote:

> Hi,
>
> This patch fixes assertion for i386 process on x86_64 linux host.
> Static variables with the same name in different functions are different
> variables.
>
> --
> Best Regards, Tong Shen
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>
>


-- 
Todd Fiala | Software Engineer | tfiala at google.com | 650-943-3180
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140811/342a2f56/attachment.html>
-------------- next part --------------
Index: source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp
===================================================================
--- source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp	(revision 215418)
+++ source/Plugins/Process/Utility/RegisterContextLinux_x86_64.cpp	(working copy)
@@ -90,7 +90,7 @@
 static const RegisterInfo *
 GetRegisterInfo_i386(const lldb_private::ArchSpec &arch)
 {
-    static std::vector<lldb_private::RegisterInfo> g_register_infos (GetPrivateRegisterInfoVector ());
+    std::vector<lldb_private::RegisterInfo> &g_register_infos = GetPrivateRegisterInfoVector ();
 
     // Allocate RegisterInfo only once
     if (g_register_infos.empty())


More information about the lldb-commits mailing list