aboutsummaryrefslogtreecommitdiffstats
path: root/source/Target/RegisterContext.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-08-17 19:37:50 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-08-17 19:37:50 +0000
commit3b6b9a026ed26abe3a3f1470da00ae1f478c4aca (patch)
tree7cc7530d12529b80577ff4d97d97ba6db915102e /source/Target/RegisterContext.cpp
parent98043205754656c922673ff69114f7a7751037b6 (diff)
downloadsrc-3b6b9a026ed26abe3a3f1470da00ae1f478c4aca.tar.gz
src-3b6b9a026ed26abe3a3f1470da00ae1f478c4aca.zip
Notes
Notes: svn path=/vendor/lldb/dist/; revision=304308 svn path=/vendor/lldb/lldb-release_390-r280324/; revision=305297; tag=vendor/lldb/lldb-release_390-r280324
Diffstat (limited to 'source/Target/RegisterContext.cpp')
-rw-r--r--source/Target/RegisterContext.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/source/Target/RegisterContext.cpp b/source/Target/RegisterContext.cpp
index 483c932719d6..ae3c43def275 100644
--- a/source/Target/RegisterContext.cpp
+++ b/source/Target/RegisterContext.cpp
@@ -21,6 +21,9 @@
#include "lldb/Target/Process.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/Target.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Expression/DWARFExpression.h"
+#include "lldb/Core/Value.h"
using namespace lldb;
using namespace lldb_private;
@@ -76,6 +79,46 @@ RegisterContext::GetRegisterInfoByName (const char *reg_name, uint32_t start_idx
return nullptr;
}
+uint32_t
+RegisterContext::UpdateDynamicRegisterSize (const lldb_private::ArchSpec &arch,
+ RegisterInfo* reg_info)
+{
+ ExecutionContext exe_ctx (CalculateThread());
+
+ // In MIPS, the floating point registers size is depends on FR bit of SR register.
+ // if SR.FR == 1 then all floating point registers are 64 bits.
+ // else they are all 32 bits.
+
+ int expr_result;
+ uint32_t addr_size = arch.GetAddressByteSize ();
+ const uint8_t* dwarf_opcode_ptr = reg_info->dynamic_size_dwarf_expr_bytes;
+ const size_t dwarf_opcode_len = reg_info->dynamic_size_dwarf_len;
+
+ DataExtractor dwarf_data (dwarf_opcode_ptr, dwarf_opcode_len,
+ arch.GetByteOrder (), addr_size);
+ ModuleSP opcode_ctx;
+ DWARFExpression dwarf_expr (opcode_ctx, dwarf_data, nullptr, 0, dwarf_opcode_len);
+ Value result;
+ Error error;
+ const lldb::offset_t offset = 0;
+ if (dwarf_expr.Evaluate (&exe_ctx, nullptr, nullptr, this, opcode_ctx, dwarf_data, nullptr,
+ offset, dwarf_opcode_len, eRegisterKindDWARF, nullptr, nullptr, result, &error))
+ {
+ expr_result = result.GetScalar ().SInt (-1);
+ switch (expr_result)
+ {
+ case 0: return 4;
+ case 1: return 8;
+ default: return reg_info->byte_size;
+ }
+ }
+ else
+ {
+ printf ("Error executing DwarfExpression::Evaluate %s\n", error.AsCString());
+ return reg_info->byte_size;
+ }
+}
+
const RegisterInfo *
RegisterContext::GetRegisterInfo (lldb::RegisterKind kind, uint32_t num)
{