summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Core/Value.h5
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py20
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/c/register_variables/test.c8
-rw-r--r--lldb/source/Core/RegisterValue.cpp4
-rw-r--r--lldb/source/Expression/Materializer.cpp4
5 files changed, 35 insertions, 6 deletions
diff --git a/lldb/include/lldb/Core/Value.h b/lldb/include/lldb/Core/Value.h
index a6d934afd29..7539b550dc4 100644
--- a/lldb/include/lldb/Core/Value.h
+++ b/lldb/include/lldb/Core/Value.h
@@ -169,9 +169,8 @@ public:
m_context = p;
if (m_context_type == eContextTypeRegisterInfo) {
RegisterInfo *reg_info = GetRegisterInfo();
- if (reg_info->encoding == lldb::eEncodingVector)
- SetValueType(eValueTypeVector);
- else
+ if (reg_info->encoding == lldb::eEncodingVector &&
+ m_vector.byte_order != lldb::eByteOrderInvalid)
SetValueType(eValueTypeScalar);
}
}
diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py b/lldb/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py
index 0cb99238621..8fae3c982b0 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py
+++ b/lldb/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py
@@ -24,7 +24,7 @@ class RegisterVariableTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the main.
- lldbutil.run_break_set_by_source_regexp(self, "break", num_expected_locations=2)
+ lldbutil.run_break_set_by_source_regexp(self, "break", num_expected_locations=3)
####################
# First breakpoint
@@ -68,4 +68,22 @@ class RegisterVariableTestCase(TestBase):
self.expect("expr c", VARIABLES_DISPLAYED_CORRECTLY,
substrs = ['(int) $3 = 5'])
+ #####################
+ # Third breakpoint
+
+ self.runCmd("continue")
+
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = ['stopped',
+ 'stop reason = breakpoint'])
+
+ # The breakpoint should have a hit count of 1.
+ self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
+ substrs = [' resolved, hit count = 1'])
+
+ # Try some variables that should be visible
+ self.expect("expr f", VARIABLES_DISPLAYED_CORRECTLY,
+ substrs = ['(float) $4 = 3.1'])
+
self.runCmd("kill")
diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/register_variables/test.c b/lldb/packages/Python/lldbsuite/test/lang/c/register_variables/test.c
index e467ac48f74..9acd3f3835b 100644
--- a/lldb/packages/Python/lldbsuite/test/lang/c/register_variables/test.c
+++ b/lldb/packages/Python/lldbsuite/test/lang/c/register_variables/test.c
@@ -18,10 +18,18 @@ void f2(struct bar *b)
printf("%d\n", c); // set breakpoint here
}
+float f3() __attribute__ ((noinline));
+float f3() {
+ return 3.14f;
+}
+
int main()
{
struct bar myBar = { 3, 4 };
f1(2, &myBar);
f2(&myBar);
+
+ float f = f3();
+ printf("%f\n", f); // set breakpoint here
return 0;
}
diff --git a/lldb/source/Core/RegisterValue.cpp b/lldb/source/Core/RegisterValue.cpp
index 1e0a0abc783..649d94d3997 100644
--- a/lldb/source/Core/RegisterValue.cpp
+++ b/lldb/source/Core/RegisterValue.cpp
@@ -247,6 +247,9 @@ RegisterValue::GetScalarValue (Scalar &scalar) const
case 2: scalar = *(const uint16_t *)buffer.bytes; return true;
case 4: scalar = *(const uint32_t *)buffer.bytes; return true;
case 8: scalar = *(const uint64_t *)buffer.bytes; return true;
+ case 16:
+ scalar = llvm::APInt(128, llvm::ArrayRef<uint64_t>((const uint64_t *)buffer.bytes, 2));
+ return true;
}
}
break;
@@ -374,6 +377,7 @@ RegisterValue::SetValueFromData (const RegisterInfo *reg_info, DataExtractor &sr
case eTypeLongDouble: SetFloat (src.GetLongDouble (&src_offset)); break;
case eTypeBytes:
{
+ m_type = eTypeBytes;
buffer.length = reg_info->byte_size;
buffer.byte_order = src.GetByteOrder();
assert (buffer.length <= kMaxRegisterByteSize);
diff --git a/lldb/source/Expression/Materializer.cpp b/lldb/source/Expression/Materializer.cpp
index 1aa93a76c9f..3575f5436d9 100644
--- a/lldb/source/Expression/Materializer.cpp
+++ b/lldb/source/Expression/Materializer.cpp
@@ -531,7 +531,7 @@ public:
return;
}
- if (data.GetByteSize() != m_variable_sp->GetType()->GetByteSize())
+ if (data.GetByteSize() < m_variable_sp->GetType()->GetByteSize())
{
if (data.GetByteSize() == 0 && m_variable_sp->LocationExpression().IsValid() == false)
{
@@ -539,7 +539,7 @@ public:
}
else
{
- err.SetErrorStringWithFormat("size of variable %s (%" PRIu64 ") disagrees with the ValueObject's size (%" PRIu64 ")",
+ err.SetErrorStringWithFormat("size of variable %s (%" PRIu64 ") is larger than the ValueObject's size (%" PRIu64 ")",
m_variable_sp->GetName().AsCString(),
m_variable_sp->GetType()->GetByteSize(),
data.GetByteSize());
OpenPOWER on IntegriCloud