From e6ca2ee6b82d86ef68914de6252fbf2ddc4d47f8 Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Fri, 19 Jul 2013 04:39:22 +0000 Subject: [PATCH] Don't use a function-scope static varaibles in RegisterContextLLDB::SavedLocationForRegister to cache the pc and sp register numbers -- if lldb is debugging multiple Targets of different architectures, this will be incorrect. If these were to be cached anywhere, it would have to be up in the Target. llvm-svn: 186651 --- lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp index b0d6231..1ffc30d 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp @@ -936,15 +936,10 @@ RegisterContextLLDB::SavedLocationForRegister (uint32_t lldb_regnum, lldb_privat } } - static uint32_t sp_regnum = LLDB_INVALID_REGNUM; - static uint32_t pc_regnum = LLDB_INVALID_REGNUM; - static bool generic_registers_initialized = false; - if (!generic_registers_initialized) - { - m_thread.GetRegisterContext()->ConvertBetweenRegisterKinds (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP, eRegisterKindLLDB, sp_regnum); - m_thread.GetRegisterContext()->ConvertBetweenRegisterKinds (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC, eRegisterKindLLDB, pc_regnum); - generic_registers_initialized = true; - } + uint32_t sp_regnum = LLDB_INVALID_REGNUM; + uint32_t pc_regnum = LLDB_INVALID_REGNUM; + m_thread.GetRegisterContext()->ConvertBetweenRegisterKinds (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP, eRegisterKindLLDB, sp_regnum); + m_thread.GetRegisterContext()->ConvertBetweenRegisterKinds (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC, eRegisterKindLLDB, pc_regnum); // Are we looking for the CALLER's stack pointer? The stack pointer is defined to be the same as THIS frame's // CFA so just return the CFA value. This is true on x86-32/x86-64 at least. -- 2.7.4