summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2017-06-29 02:57:03 +0000
committerJason Molenda <jmolenda@apple.com>2017-06-29 02:57:03 +0000
commit43294c9f48760eae68aa8976bf0ac5e9eaa448d8 (patch)
tree4585cb01cd88fd39a900aa062686601930eb9e34
parent8e07cadde0ba53385afd4762af3a12412609483b (diff)
downloadbcm5719-llvm-43294c9f48760eae68aa8976bf0ac5e9eaa448d8.tar.gz
bcm5719-llvm-43294c9f48760eae68aa8976bf0ac5e9eaa448d8.zip
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> llvm-svn: 306633
-rw-r--r--lldb/include/lldb/Target/ABI.h19
-rw-r--r--lldb/include/lldb/lldb-private-interfaces.h2
-rw-r--r--lldb/source/API/SBTarget.cpp2
-rw-r--r--lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp25
-rw-r--r--lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h6
-rw-r--r--lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp4
-rw-r--r--lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h4
-rw-r--r--lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp4
-rw-r--r--lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h4
-rw-r--r--lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp4
-rw-r--r--lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.h4
-rw-r--r--lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp4
-rw-r--r--lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h4
-rw-r--r--lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp4
-rw-r--r--lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h4
-rwxr-xr-xlldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp4
-rw-r--r--lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.h4
-rw-r--r--lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp4
-rw-r--r--lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.h4
-rw-r--r--lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp4
-rw-r--r--lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h4
-rw-r--r--lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp4
-rw-r--r--lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h4
-rw-r--r--lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp4
-rw-r--r--lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h4
-rw-r--r--lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp4
-rw-r--r--lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h4
-rw-r--r--lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp4
-rw-r--r--lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h4
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp4
-rw-r--r--lldb/source/Symbol/Variable.cpp4
-rw-r--r--lldb/source/Target/ABI.cpp6
-rw-r--r--lldb/source/Target/Process.cpp2
33 files changed, 88 insertions, 78 deletions
diff --git a/lldb/include/lldb/Target/ABI.h b/lldb/include/lldb/Target/ABI.h
index a8e08e1a800..0418d683af6 100644
--- a/lldb/include/lldb/Target/ABI.h
+++ b/lldb/include/lldb/Target/ABI.h
@@ -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);
diff --git a/lldb/include/lldb/lldb-private-interfaces.h b/lldb/include/lldb/lldb-private-interfaces.h
index 9f25eb1f9a2..806068ece7b 100644
--- a/lldb/include/lldb/lldb-private-interfaces.h
+++ b/lldb/include/lldb/lldb-private-interfaces.h
@@ -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,
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 0ab7375ccc3..c706344ee4a 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -2170,7 +2170,7 @@ lldb::addr_t SBTarget::GetStackRedZoneSize() {
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();
}
diff --git a/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp b/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
index 06b1c7054c1..fd5ee6ede4c 100644
--- a/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
+++ b/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
@@ -1326,7 +1326,7 @@ size_t ABIMacOSX_arm::GetRedZoneSize() const { return 0; }
//------------------------------------------------------------------
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 ArchSpec &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(Thread &thread, ValueList &values) const {
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::GetReturnValueObjectImpl(
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::SetReturnValueObject(lldb::StackFrameSP &frame_sp,
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
diff --git a/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h b/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h
index 5aa817c20ec..d3c20e1e618 100644
--- a/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h
+++ b/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h
@@ -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.
}
};
diff --git a/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp b/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp
index a545dfc837d..e301b21d542 100644
--- a/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp
+++ b/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp
@@ -1666,7 +1666,7 @@ size_t ABIMacOSX_arm64::GetRedZoneSize() const { return 128; }
//------------------------------------------------------------------
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 ArchSpec &arch) {
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;
}
}
diff --git a/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h b/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h
index 589e2ea468e..2dd7337542d 100644
--- a/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h
+++ b/lldb/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h
@@ -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.
}
};
diff --git a/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp b/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
index c393ac9c916..716a73b854b 100644
--- a/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
+++ b/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
@@ -713,13 +713,13 @@ size_t ABIMacOSX_i386::GetRedZoneSize() const { return 0; }
//------------------------------------------------------------------
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();
diff --git a/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h b/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h
index 88fb6ffd7a4..e026e324867 100644
--- a/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h
+++ b/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h
@@ -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.
}
};
diff --git a/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp b/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp
index 614c6e89380..882d5cd23e5 100644
--- a/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp
+++ b/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp
@@ -1327,7 +1327,7 @@ size_t ABISysV_arm::GetRedZoneSize() const { return 0; }
//------------------------------------------------------------------
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 ArchSpec &arch) {
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;
}
}
diff --git a/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.h b/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.h
index 81f1277419a..f046968c213 100644
--- a/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.h
+++ b/lldb/source/Plugins/ABI/SysV-arm/ABISysV_arm.h
@@ -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.
}
};
diff --git a/lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp b/lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
index ce8f8a65e3e..f91ed851a3e 100644
--- a/lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
+++ b/lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
@@ -1670,7 +1670,7 @@ size_t ABISysV_arm64::GetRedZoneSize() const { return 128; }
//------------------------------------------------------------------
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 ArchSpec &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;
}
}
diff --git a/lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h b/lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h
index c048e8634ae..8d23c2419ba 100644
--- a/lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h
+++ b/lldb/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h
@@ -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.
}
};
diff --git a/lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp b/lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
index 425bf2ce0bf..74274f08b24 100644
--- a/lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
+++ b/lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp
@@ -1019,11 +1019,11 @@ size_t ABISysV_hexagon::GetRedZoneSize() const { return 0; }
//------------------------------------------------------------------
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();
diff --git a/lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h b/lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h
index 5f808291eac..5a6809371d9 100644
--- a/lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h
+++ b/lldb/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h
@@ -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.
}
};
diff --git a/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp b/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp
index cb3644d46af..63da5a77b48 100755
--- a/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp
+++ b/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp
@@ -203,12 +203,12 @@ ABISysV_i386::GetRegisterInfoArray(uint32_t &count) {
//------------------------------------------------------------------
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();
diff --git a/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.h b/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.h
index 038bf656b1f..4dce54c4f07 100644
--- a/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.h
+++ b/lldb/source/Plugins/ABI/SysV-i386/ABISysV_i386.h
@@ -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.
}
};
diff --git a/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp b/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
index a77252a2049..95e2a7b0afe 100644
--- a/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
+++ b/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
@@ -559,13 +559,13 @@ size_t ABISysV_mips::GetRedZoneSize() const { return 0; }
//------------------------------------------------------------------
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();
diff --git a/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.h b/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.h
index 980553c506b..0de8e7751fc 100644
--- a/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.h
+++ b/lldb/source/Plugins/ABI/SysV-mips/ABISysV_mips.h
@@ -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.
}
};
diff --git a/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp b/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
index baa478ea110..749e170fa17 100644
--- a/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
+++ b/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp
@@ -559,13 +559,13 @@ size_t ABISysV_mips64::GetRedZoneSize() const { return 0; }
//------------------------------------------------------------------
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();
diff --git a/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h b/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h
index ac7d9b87194..6258c08e35f 100644
--- a/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h
+++ b/lldb/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h
@@ -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.
}
};
diff --git a/lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp b/lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
index 00adfe1be82..06a8ce932fd 100644
--- a/lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
+++ b/lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp
@@ -223,11 +223,11 @@ size_t ABISysV_ppc::GetRedZoneSize() const { return 224; }
//------------------------------------------------------------------
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();
diff --git a/lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h b/lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h
index 8cb9bf24881..df3ebe83faf 100644
--- a/lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h
+++ b/lldb/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h
@@ -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.
}
};
diff --git a/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp b/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
index 449990d7130..c090f01ccb1 100644
--- a/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
+++ b/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp
@@ -223,11 +223,11 @@ size_t ABISysV_ppc64::GetRedZoneSize() const { return 224; }
//------------------------------------------------------------------
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();
diff --git a/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h b/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h
index 29237a68fc9..21608a5c1cd 100644
--- a/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h
+++ b/lldb/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h
@@ -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.
}
};
diff --git a/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp b/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp
index 7f76d49bfb0..967e407188f 100644
--- a/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp
+++ b/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp
@@ -205,11 +205,11 @@ size_t ABISysV_s390x::GetRedZoneSize() const { return 0; }
//------------------------------------------------------------------
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();
diff --git a/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h b/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h
index e233a900e39..5e3d20d7898 100644
--- a/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h
+++ b/lldb/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h
@@ -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.
}
};
diff --git a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
index deccca8c29e..10bbae56649 100644
--- a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
+++ b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
@@ -1093,11 +1093,11 @@ size_t ABISysV_x86_64::GetRedZoneSize() const { return 128; }
//------------------------------------------------------------------
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();
diff --git a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h
index 8d420e88167..5b67e8656d3 100644
--- a/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h
+++ b/lldb/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h
@@ -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.
}
};
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index aeb7c742b4f..ac64b689f4c 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -599,7 +599,7 @@ void ProcessGDBRemote::BuildDynamicRegisterInfo(bool force) {
// 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::GetGDBServerRegisterInfo(ArchSpec &arch_to_use) {
// 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);
diff --git a/lldb/source/Symbol/Variable.cpp b/lldb/source/Symbol/Variable.cpp
index fd19a099496..ff32aa73146 100644
--- a/lldb/source/Symbol/Variable.cpp
+++ b/lldb/source/Symbol/Variable.cpp
@@ -160,7 +160,7 @@ void Variable::Dump(Stream *s, bool show_context) const {
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(Stream *s, const Address &address) {
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();
diff --git a/lldb/source/Target/ABI.cpp b/lldb/source/Target/ABI.cpp
index 87363a3b8ae..72f58be5a3d 100644
--- a/lldb/source/Target/ABI.cpp
+++ b/lldb/source/Target/ABI.cpp
@@ -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) {
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index c6ad536cee1..6cbe289ef26 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -1735,7 +1735,7 @@ addr_t Process::GetImageInfoAddress() { return LLDB_INVALID_ADDRESS; }
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;
}
OpenPOWER on IntegriCloud