summaryrefslogtreecommitdiff
path: root/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp')
-rw-r--r--source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp b/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
index ce02f8677a63..6f3d2e3b3696 100644
--- a/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
+++ b/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp
@@ -9,16 +9,11 @@
#include "ABISysV_mips.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Triple.h"
-// Project includes
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Core/RegisterValue.h"
#include "lldb/Core/Value.h"
#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/Core/ValueObjectMemory.h"
@@ -32,6 +27,7 @@
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/Log.h"
+#include "lldb/Utility/RegisterValue.h"
#include "lldb/Utility/Status.h"
using namespace lldb;
@@ -560,13 +556,10 @@ size_t ABISysV_mips::GetRedZoneSize() const { return 0; }
ABISP
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(process_sp));
- return g_abi_sp;
+ return ABISP(new ABISysV_mips(process_sp));
}
return ABISP();
}
@@ -819,9 +812,11 @@ ValueObjectSP ABISysV_mips::GetReturnValueObjectImpl(
// In MIPS register "r2" (v0) holds the integer function return values
const RegisterInfo *r2_reg_info = reg_ctx->GetRegisterInfoByName("r2", 0);
- size_t bit_width = return_compiler_type.GetBitSize(&thread);
+ llvm::Optional<uint64_t> bit_width = return_compiler_type.GetBitSize(&thread);
+ if (!bit_width)
+ return return_valobj_sp;
if (return_compiler_type.IsIntegerOrEnumerationType(is_signed)) {
- switch (bit_width) {
+ switch (*bit_width) {
default:
return return_valobj_sp;
case 64: {
@@ -880,7 +875,7 @@ ValueObjectSP ABISysV_mips::GetReturnValueObjectImpl(
uint64_t raw_value = reg_ctx->ReadRegisterAsUnsigned(r2_reg_info, 0);
if (count != 1 && is_complex)
return return_valobj_sp;
- switch (bit_width) {
+ switch (*bit_width) {
default:
return return_valobj_sp;
case 32:
@@ -912,7 +907,7 @@ ValueObjectSP ABISysV_mips::GetReturnValueObjectImpl(
lldb::offset_t offset = 0;
if (count == 1 && !is_complex) {
- switch (bit_width) {
+ switch (*bit_width) {
default:
return return_valobj_sp;
case 64: {