Author: jmolenda Date: Wed Jun 28 19:57:03 2017 New Revision: 306633 URL: http://llvm.org/viewvc/llvm-project?rev=306633&view=rev Log: Change the ABI class to have a weak pointer to its Process; some methods in the ABI need a Process to do their work. Instead of passing it in as a one-off argument to those methods, this patch puts it in the base class and the methods can retrieve if it needed.
Note that ABI's are sometimes built without a Process (e.g. SBTarget::GetStackRedZoneSize) so it's entirely possible that the process weak pointer will not be able to reconsistitue into a strong pointer. <rdar://problem/32526754> Modified: lldb/trunk/include/lldb/Target/ABI.h lldb/trunk/include/lldb/lldb-private-interfaces.h lldb/trunk/source/API/SBTarget.cpp lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.h lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.h lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.h lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Symbol/Variable.cpp lldb/trunk/source/Target/ABI.cpp lldb/trunk/source/Target/Process.cpp Modified: lldb/trunk/include/lldb/Target/ABI.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ABI.h?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/include/lldb/Target/ABI.h (original) +++ lldb/trunk/include/lldb/Target/ABI.h Wed Jun 28 19:57:03 2017 @@ -92,6 +92,16 @@ protected: virtual lldb::ValueObjectSP GetReturnValueObjectImpl(Thread &thread, llvm::Type &ir_type) const; + //------------------------------------------------------------------ + /// Request to get a Process shared pointer. + /// + /// This ABI object may not have been created with a Process object, + /// or the Process object may no longer be alive. Be sure to handle + /// the case where the shared pointer returned does not have an + /// object inside it. + //------------------------------------------------------------------ + lldb::ProcessSP GetProcessSP() const { return m_process_wp.lock(); } + public: virtual bool CreateFunctionEntryUnwindPlan(UnwindPlan &unwind_plan) = 0; @@ -131,13 +141,18 @@ public: virtual bool GetPointerReturnRegister(const char *&name) { return false; } - static lldb::ABISP FindPlugin(const ArchSpec &arch); + static lldb::ABISP FindPlugin(lldb::ProcessSP process_sp, const ArchSpec &arch); protected: //------------------------------------------------------------------ // Classes that inherit from ABI can see and modify these //------------------------------------------------------------------ - ABI(); + ABI(lldb::ProcessSP process_sp) { + if (process_sp.get()) + m_process_wp = process_sp; + } + + lldb::ProcessWP m_process_wp; private: DISALLOW_COPY_AND_ASSIGN(ABI); Modified: lldb/trunk/include/lldb/lldb-private-interfaces.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-interfaces.h?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/include/lldb/lldb-private-interfaces.h (original) +++ lldb/trunk/include/lldb/lldb-private-interfaces.h Wed Jun 28 19:57:03 2017 @@ -21,7 +21,7 @@ #include <set> namespace lldb_private { -typedef lldb::ABISP (*ABICreateInstance)(const ArchSpec &arch); +typedef lldb::ABISP (*ABICreateInstance)(lldb::ProcessSP process_sp, const ArchSpec &arch); typedef Disassembler *(*DisassemblerCreateInstance)(const ArchSpec &arch, const char *flavor); typedef DynamicLoader *(*DynamicLoaderCreateInstance)(Process *process, Modified: lldb/trunk/source/API/SBTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/API/SBTarget.cpp (original) +++ lldb/trunk/source/API/SBTarget.cpp Wed Jun 28 19:57:03 2017 @@ -2170,7 +2170,7 @@ lldb::addr_t SBTarget::GetStackRedZoneSi if (process_sp) abi_sp = process_sp->GetABI(); else - abi_sp = ABI::FindPlugin(target_sp->GetArchitecture()); + abi_sp = ABI::FindPlugin(ProcessSP(), target_sp->GetArchitecture()); if (abi_sp) return abi_sp->GetRedZoneSize(); } Modified: lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp (original) +++ lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp Wed Jun 28 19:57:03 2017 @@ -1326,7 +1326,7 @@ size_t ABIMacOSX_arm::GetRedZoneSize() c //------------------------------------------------------------------ ABISP -ABIMacOSX_arm::CreateInstance(const ArchSpec &arch) { +ABIMacOSX_arm::CreateInstance(ProcessSP process_sp, const ArchSpec &arch) { static ABISP g_abi_sp; const llvm::Triple::ArchType arch_type = arch.GetTriple().getArch(); const llvm::Triple::VendorType vendor_type = arch.GetTriple().getVendor(); @@ -1335,7 +1335,7 @@ ABIMacOSX_arm::CreateInstance(const Arch if ((arch_type == llvm::Triple::arm) || (arch_type == llvm::Triple::thumb)) { if (!g_abi_sp) - g_abi_sp.reset(new ABIMacOSX_arm); + g_abi_sp.reset(new ABIMacOSX_arm(process_sp)); return g_abi_sp; } } @@ -1546,16 +1546,14 @@ bool ABIMacOSX_arm::GetArgumentValues(Th return true; } -bool ABIMacOSX_arm::IsArmv7kProcess(Thread *thread) const { +bool ABIMacOSX_arm::IsArmv7kProcess() const { bool is_armv7k = false; - if (thread) { - ProcessSP process_sp(thread->GetProcess()); - if (process_sp) { - const ArchSpec &arch(process_sp->GetTarget().GetArchitecture()); - const ArchSpec::Core system_core = arch.GetCore(); - if (system_core == ArchSpec::eCore_arm_armv7k) { - is_armv7k = true; - } + ProcessSP process_sp(GetProcessSP()); + if (process_sp) { + const ArchSpec &arch(process_sp->GetTarget().GetArchitecture()); + const ArchSpec::Core system_core = arch.GetCore(); + if (system_core == ArchSpec::eCore_arm_armv7k) { + is_armv7k = true; } } return is_armv7k; @@ -1588,7 +1586,7 @@ ValueObjectSP ABIMacOSX_arm::GetReturnVa default: return return_valobj_sp; case 128: - if (IsArmv7kProcess(&thread)) { + if (IsArmv7kProcess()) { // "A composite type not larger than 16 bytes is returned in r0-r3. The // format is // as if the result had been stored in memory at a word-aligned address @@ -1755,8 +1753,7 @@ Status ABIMacOSX_arm::SetReturnValueObje set_it_simple = true; } } - } else if (num_bytes <= 16 && - IsArmv7kProcess(frame_sp->GetThread().get())) { + } else if (num_bytes <= 16 && IsArmv7kProcess()) { // "A composite type not larger than 16 bytes is returned in r0-r3. The // format is // as if the result had been stored in memory at a word-aligned address Modified: lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h (original) +++ lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h Wed Jun 28 19:57:03 2017 @@ -66,7 +66,7 @@ public: const lldb_private::RegisterInfo * GetRegisterInfoArray(uint32_t &count) override; - bool IsArmv7kProcess(lldb_private::Thread *thread) const; + bool IsArmv7kProcess() const; //------------------------------------------------------------------ // Static Functions @@ -76,7 +76,7 @@ public: static void Terminate(); - static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch); + static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch); static lldb_private::ConstString GetPluginNameStatic(); @@ -94,7 +94,7 @@ protected: lldb_private::CompilerType &ast_type) const override; private: - ABIMacOSX_arm() : lldb_private::ABI() { + ABIMacOSX_arm(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) { // Call CreateInstance instead. } }; Modified: lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp (original) +++ lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp Wed Jun 28 19:57:03 2017 @@ -1666,7 +1666,7 @@ size_t ABIMacOSX_arm64::GetRedZoneSize() //------------------------------------------------------------------ ABISP -ABIMacOSX_arm64::CreateInstance(const ArchSpec &arch) { +ABIMacOSX_arm64::CreateInstance(ProcessSP process_sp, const ArchSpec &arch) { static ABISP g_abi_sp; const llvm::Triple::ArchType arch_type = arch.GetTriple().getArch(); const llvm::Triple::VendorType vendor_type = arch.GetTriple().getVendor(); @@ -1674,7 +1674,7 @@ ABIMacOSX_arm64::CreateInstance(const Ar if (vendor_type == llvm::Triple::Apple) { if (arch_type == llvm::Triple::aarch64) { if (!g_abi_sp) - g_abi_sp.reset(new ABIMacOSX_arm64); + g_abi_sp.reset(new ABIMacOSX_arm64(process_sp)); return g_abi_sp; } } Modified: lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h (original) +++ lldb/trunk/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h Wed Jun 28 19:57:03 2017 @@ -78,7 +78,7 @@ public: static void Terminate(); - static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch); + static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch); //------------------------------------------------------------------ // PluginInterface protocol @@ -102,7 +102,7 @@ protected: lldb_private::CompilerType &ast_type) const override; private: - ABIMacOSX_arm64() : lldb_private::ABI() { + ABIMacOSX_arm64(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) { // Call CreateInstance instead. } }; Modified: lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp (original) +++ lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp Wed Jun 28 19:57:03 2017 @@ -713,13 +713,13 @@ size_t ABIMacOSX_i386::GetRedZoneSize() //------------------------------------------------------------------ ABISP -ABIMacOSX_i386::CreateInstance(const ArchSpec &arch) { +ABIMacOSX_i386::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) { static ABISP g_abi_sp; if ((arch.GetTriple().getArch() == llvm::Triple::x86) && (arch.GetTriple().isMacOSX() || arch.GetTriple().isiOS() || arch.GetTriple().isWatchOS())) { if (!g_abi_sp) - g_abi_sp.reset(new ABIMacOSX_i386); + g_abi_sp.reset(new ABIMacOSX_i386(process_sp)); return g_abi_sp; } return ABISP(); Modified: lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h (original) +++ lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h Wed Jun 28 19:57:03 2017 @@ -81,7 +81,7 @@ public: static void Terminate(); - static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch); + static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch); //------------------------------------------------------------------ // PluginInterface protocol @@ -101,7 +101,7 @@ protected: bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info); private: - ABIMacOSX_i386() : lldb_private::ABI() { + ABIMacOSX_i386(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) { // Call CreateInstance instead. } }; Modified: lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp (original) +++ lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp Wed Jun 28 19:57:03 2017 @@ -1327,7 +1327,7 @@ size_t ABISysV_arm::GetRedZoneSize() con //------------------------------------------------------------------ ABISP -ABISysV_arm::CreateInstance(const ArchSpec &arch) { +ABISysV_arm::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) { static ABISP g_abi_sp; const llvm::Triple::ArchType arch_type = arch.GetTriple().getArch(); const llvm::Triple::VendorType vendor_type = arch.GetTriple().getVendor(); @@ -1336,7 +1336,7 @@ ABISysV_arm::CreateInstance(const ArchSp if ((arch_type == llvm::Triple::arm) || (arch_type == llvm::Triple::thumb)) { if (!g_abi_sp) - g_abi_sp.reset(new ABISysV_arm); + g_abi_sp.reset(new ABISysV_arm(process_sp)); return g_abi_sp; } } Modified: lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.h?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.h (original) +++ lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.h Wed Jun 28 19:57:03 2017 @@ -76,7 +76,7 @@ public: static void Terminate(); - static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch); + static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch); static lldb_private::ConstString GetPluginNameStatic(); @@ -94,7 +94,7 @@ protected: lldb_private::CompilerType &ast_type) const override; private: - ABISysV_arm() : lldb_private::ABI() { + ABISysV_arm(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) { // Call CreateInstance instead. } }; Modified: lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp (original) +++ lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp Wed Jun 28 19:57:03 2017 @@ -1670,7 +1670,7 @@ size_t ABISysV_arm64::GetRedZoneSize() c //------------------------------------------------------------------ ABISP -ABISysV_arm64::CreateInstance(const ArchSpec &arch) { +ABISysV_arm64::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) { static ABISP g_abi_sp; const llvm::Triple::ArchType arch_type = arch.GetTriple().getArch(); const llvm::Triple::VendorType vendor_type = arch.GetTriple().getVendor(); @@ -1678,7 +1678,7 @@ ABISysV_arm64::CreateInstance(const Arch if (vendor_type != llvm::Triple::Apple) { if (arch_type == llvm::Triple::aarch64) { if (!g_abi_sp) - g_abi_sp.reset(new ABISysV_arm64); + g_abi_sp.reset(new ABISysV_arm64(process_sp)); return g_abi_sp; } } Modified: lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h (original) +++ lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h Wed Jun 28 19:57:03 2017 @@ -83,7 +83,7 @@ public: static void Terminate(); - static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch); + static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch); static lldb_private::ConstString GetPluginNameStatic(); @@ -101,7 +101,7 @@ protected: lldb_private::CompilerType &ast_type) const override; private: - ABISysV_arm64() : lldb_private::ABI() { + ABISysV_arm64(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) { // Call CreateInstance instead. } }; Modified: lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp (original) +++ lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp Wed Jun 28 19:57:03 2017 @@ -1019,11 +1019,11 @@ size_t ABISysV_hexagon::GetRedZoneSize() //------------------------------------------------------------------ ABISP -ABISysV_hexagon::CreateInstance(const ArchSpec &arch) { +ABISysV_hexagon::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) { static ABISP g_abi_sp; if (arch.GetTriple().getArch() == llvm::Triple::hexagon) { if (!g_abi_sp) - g_abi_sp.reset(new ABISysV_hexagon); + g_abi_sp.reset(new ABISysV_hexagon(process_sp)); return g_abi_sp; } return ABISP(); Modified: lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h (original) +++ lldb/trunk/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h Wed Jun 28 19:57:03 2017 @@ -84,7 +84,7 @@ public: static void Terminate(); - static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch); + static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch); static lldb_private::ConstString GetPluginNameStatic(); @@ -106,7 +106,7 @@ protected: bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info); private: - ABISysV_hexagon() : lldb_private::ABI() { + ABISysV_hexagon(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) { // Call CreateInstance instead. } }; Modified: lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp (original) +++ lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp Wed Jun 28 19:57:03 2017 @@ -203,12 +203,12 @@ ABISysV_i386::GetRegisterInfoArray(uint3 //------------------------------------------------------------------ ABISP -ABISysV_i386::CreateInstance(const ArchSpec &arch) { +ABISysV_i386::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) { static ABISP g_abi_sp; if ((arch.GetTriple().getArch() == llvm::Triple::x86) && arch.GetTriple().isOSLinux()) { if (!g_abi_sp) - g_abi_sp.reset(new ABISysV_i386); + g_abi_sp.reset(new ABISysV_i386(process_sp)); return g_abi_sp; } return ABISP(); Modified: lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.h?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.h (original) +++ lldb/trunk/source/Plugins/ABI/SysV-i386/ABISysV_i386.h Wed Jun 28 19:57:03 2017 @@ -89,7 +89,7 @@ public: static void Terminate(); - static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch); + static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch); //------------------------------------------------------------------ // PluginInterface protocol @@ -109,7 +109,7 @@ protected: bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info); private: - ABISysV_i386() : lldb_private::ABI() { + ABISysV_i386(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) { // Call CreateInstance instead. } }; Modified: lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp (original) +++ lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp Wed Jun 28 19:57:03 2017 @@ -559,13 +559,13 @@ size_t ABISysV_mips::GetRedZoneSize() co //------------------------------------------------------------------ ABISP -ABISysV_mips::CreateInstance(const ArchSpec &arch) { +ABISysV_mips::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) { static ABISP g_abi_sp; const llvm::Triple::ArchType arch_type = arch.GetTriple().getArch(); if ((arch_type == llvm::Triple::mips) || (arch_type == llvm::Triple::mipsel)) { if (!g_abi_sp) - g_abi_sp.reset(new ABISysV_mips); + g_abi_sp.reset(new ABISysV_mips(process_sp)); return g_abi_sp; } return ABISP(); Modified: lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.h?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.h (original) +++ lldb/trunk/source/Plugins/ABI/SysV-mips/ABISysV_mips.h Wed Jun 28 19:57:03 2017 @@ -74,7 +74,7 @@ public: static void Terminate(); - static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch); + static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch); static lldb_private::ConstString GetPluginNameStatic(); @@ -96,7 +96,7 @@ protected: bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info); private: - ABISysV_mips() : lldb_private::ABI() { + ABISysV_mips(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) { // Call CreateInstance instead. } }; Modified: lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp (original) +++ lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp Wed Jun 28 19:57:03 2017 @@ -559,13 +559,13 @@ size_t ABISysV_mips64::GetRedZoneSize() //------------------------------------------------------------------ ABISP -ABISysV_mips64::CreateInstance(const ArchSpec &arch) { +ABISysV_mips64::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) { static ABISP g_abi_sp; const llvm::Triple::ArchType arch_type = arch.GetTriple().getArch(); if ((arch_type == llvm::Triple::mips64) || (arch_type == llvm::Triple::mips64el)) { if (!g_abi_sp) - g_abi_sp.reset(new ABISysV_mips64); + g_abi_sp.reset(new ABISysV_mips64(process_sp)); return g_abi_sp; } return ABISP(); Modified: lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h (original) +++ lldb/trunk/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h Wed Jun 28 19:57:03 2017 @@ -87,7 +87,7 @@ public: static void Terminate(); - static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch); + static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch); static lldb_private::ConstString GetPluginNameStatic(); @@ -109,7 +109,7 @@ protected: bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info); private: - ABISysV_mips64() : lldb_private::ABI() { + ABISysV_mips64(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) { // Call CreateInstance instead. } }; Modified: lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp (original) +++ lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp Wed Jun 28 19:57:03 2017 @@ -223,11 +223,11 @@ size_t ABISysV_ppc::GetRedZoneSize() con //------------------------------------------------------------------ ABISP -ABISysV_ppc::CreateInstance(const ArchSpec &arch) { +ABISysV_ppc::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) { static ABISP g_abi_sp; if (arch.GetTriple().getArch() == llvm::Triple::ppc) { if (!g_abi_sp) - g_abi_sp.reset(new ABISysV_ppc); + g_abi_sp.reset(new ABISysV_ppc(process_sp)); return g_abi_sp; } return ABISP(); Modified: lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h (original) +++ lldb/trunk/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h Wed Jun 28 19:57:03 2017 @@ -83,7 +83,7 @@ public: static void Terminate(); - static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch); + static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch); static lldb_private::ConstString GetPluginNameStatic(); @@ -105,7 +105,7 @@ protected: bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info); private: - ABISysV_ppc() : lldb_private::ABI() { + ABISysV_ppc(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) { // Call CreateInstance instead. } }; Modified: lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp (original) +++ lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp Wed Jun 28 19:57:03 2017 @@ -223,11 +223,11 @@ size_t ABISysV_ppc64::GetRedZoneSize() c //------------------------------------------------------------------ ABISP -ABISysV_ppc64::CreateInstance(const ArchSpec &arch) { +ABISysV_ppc64::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) { static ABISP g_abi_sp; if (arch.GetTriple().getArch() == llvm::Triple::ppc64) { if (!g_abi_sp) - g_abi_sp.reset(new ABISysV_ppc64); + g_abi_sp.reset(new ABISysV_ppc64(process_sp)); return g_abi_sp; } return ABISP(); Modified: lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h (original) +++ lldb/trunk/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h Wed Jun 28 19:57:03 2017 @@ -83,7 +83,7 @@ public: static void Terminate(); - static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch); + static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch); static lldb_private::ConstString GetPluginNameStatic(); @@ -105,7 +105,7 @@ protected: bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info); private: - ABISysV_ppc64() : lldb_private::ABI() { + ABISysV_ppc64(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) { // Call CreateInstance instead. } }; Modified: lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp (original) +++ lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp Wed Jun 28 19:57:03 2017 @@ -205,11 +205,11 @@ size_t ABISysV_s390x::GetRedZoneSize() c //------------------------------------------------------------------ ABISP -ABISysV_s390x::CreateInstance(const ArchSpec &arch) { +ABISysV_s390x::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) { static ABISP g_abi_sp; if (arch.GetTriple().getArch() == llvm::Triple::systemz) { if (!g_abi_sp) - g_abi_sp.reset(new ABISysV_s390x); + g_abi_sp.reset(new ABISysV_s390x(process_sp)); return g_abi_sp; } return ABISP(); Modified: lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h (original) +++ lldb/trunk/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h Wed Jun 28 19:57:03 2017 @@ -77,7 +77,7 @@ public: static void Terminate(); - static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch); + static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch); static lldb_private::ConstString GetPluginNameStatic(); @@ -99,7 +99,7 @@ protected: bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info); private: - ABISysV_s390x() : lldb_private::ABI() { + ABISysV_s390x(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) { // Call CreateInstance instead. } }; Modified: lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp (original) +++ lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp Wed Jun 28 19:57:03 2017 @@ -1093,11 +1093,11 @@ size_t ABISysV_x86_64::GetRedZoneSize() //------------------------------------------------------------------ ABISP -ABISysV_x86_64::CreateInstance(const ArchSpec &arch) { +ABISysV_x86_64::CreateInstance(lldb::ProcessSP process_sp, const ArchSpec &arch) { static ABISP g_abi_sp; if (arch.GetTriple().getArch() == llvm::Triple::x86_64) { if (!g_abi_sp) - g_abi_sp.reset(new ABISysV_x86_64); + g_abi_sp.reset(new ABISysV_x86_64(process_sp)); return g_abi_sp; } return ABISP(); Modified: lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h (original) +++ lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h Wed Jun 28 19:57:03 2017 @@ -85,7 +85,7 @@ public: static void Terminate(); - static lldb::ABISP CreateInstance(const lldb_private::ArchSpec &arch); + static lldb::ABISP CreateInstance(lldb::ProcessSP process_sp, const lldb_private::ArchSpec &arch); static lldb_private::ConstString GetPluginNameStatic(); @@ -107,7 +107,7 @@ protected: bool RegisterIsCalleeSaved(const lldb_private::RegisterInfo *reg_info); private: - ABISysV_x86_64() : lldb_private::ABI() { + ABISysV_x86_64(lldb::ProcessSP process_sp) : lldb_private::ABI(process_sp) { // Call CreateInstance instead. } }; Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Wed Jun 28 19:57:03 2017 @@ -599,7 +599,7 @@ void ProcessGDBRemote::BuildDynamicRegis // gets called in DidAttach, when the target architecture (and // consequently the ABI we'll get from // the process) may be wrong. - ABISP abi_to_use = ABI::FindPlugin(arch_to_use); + ABISP abi_to_use = ABI::FindPlugin(shared_from_this(), arch_to_use); AugmentRegisterInfoViaABI(reg_info, reg_name, abi_to_use); @@ -4419,7 +4419,7 @@ bool ProcessGDBRemote::GetGDBServerRegis // that context we haven't // set the Target's architecture yet, so the ABI is also potentially // incorrect. - ABISP abi_to_use_sp = ABI::FindPlugin(arch_to_use); + ABISP abi_to_use_sp = ABI::FindPlugin(shared_from_this(), arch_to_use); if (feature_node) { ParseRegisters(feature_node, target_info, this->m_register_info, abi_to_use_sp, cur_reg_num, reg_offset); Modified: lldb/trunk/source/Symbol/Variable.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Variable.cpp?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Symbol/Variable.cpp (original) +++ lldb/trunk/source/Symbol/Variable.cpp Wed Jun 28 19:57:03 2017 @@ -160,7 +160,7 @@ void Variable::Dump(Stream *s, bool show if (m_owner_scope) { ModuleSP module_sp(m_owner_scope->CalculateSymbolContextModule()); if (module_sp) - abi = ABI::FindPlugin(module_sp->GetArchitecture()).get(); + abi = ABI::FindPlugin(ProcessSP(), module_sp->GetArchitecture()).get(); } m_location.GetDescription(s, lldb::eDescriptionLevelBrief, loclist_base_addr, abi); @@ -471,7 +471,7 @@ bool Variable::DumpLocationForAddress(St if (m_owner_scope) { ModuleSP module_sp(m_owner_scope->CalculateSymbolContextModule()); if (module_sp) - abi = ABI::FindPlugin(module_sp->GetArchitecture()).get(); + abi = ABI::FindPlugin(ProcessSP(), module_sp->GetArchitecture()).get(); } const addr_t file_addr = address.GetFileAddress(); Modified: lldb/trunk/source/Target/ABI.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ABI.cpp?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Target/ABI.cpp (original) +++ lldb/trunk/source/Target/ABI.cpp Wed Jun 28 19:57:03 2017 @@ -25,7 +25,7 @@ using namespace lldb; using namespace lldb_private; ABISP -ABI::FindPlugin(const ArchSpec &arch) { +ABI::FindPlugin(lldb::ProcessSP process_sp, const ArchSpec &arch) { ABISP abi_sp; ABICreateInstance create_callback; @@ -33,7 +33,7 @@ ABI::FindPlugin(const ArchSpec &arch) { (create_callback = PluginManager::GetABICreateCallbackAtIndex(idx)) != nullptr; ++idx) { - abi_sp = create_callback(arch); + abi_sp = create_callback(process_sp, arch); if (abi_sp) return abi_sp; @@ -42,8 +42,6 @@ ABI::FindPlugin(const ArchSpec &arch) { return abi_sp; } -ABI::ABI() = default; - ABI::~ABI() = default; bool ABI::GetRegisterInfoByName(const ConstString &name, RegisterInfo &info) { Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=306633&r1=306632&r2=306633&view=diff ============================================================================== --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Wed Jun 28 19:57:03 2017 @@ -1735,7 +1735,7 @@ addr_t Process::GetImageInfoAddress() { const lldb::ABISP &Process::GetABI() { if (!m_abi_sp) - m_abi_sp = ABI::FindPlugin(GetTarget().GetArchitecture()); + m_abi_sp = ABI::FindPlugin(shared_from_this(), GetTarget().GetArchitecture()); return m_abi_sp; } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits