Reimplementing SBValue/ValueObject.GetValueAsUnsigned() in terms of appropriate calls in Scalar - Making sure Scalar does the right thing when casting signed values to unsigned ones.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@166618 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBValue.cpp b/source/API/SBValue.cpp
index df92da6..2e4be07 100644
--- a/source/API/SBValue.cpp
+++ b/source/API/SBValue.cpp
@@ -1284,7 +1284,7 @@
Mutex::Locker api_locker (target_sp->GetAPIMutex());
Scalar scalar;
if (value_sp->ResolveValue (scalar))
- return scalar.GetRawBits64(fail_value);
+ return scalar.ULongLong(fail_value);
else
error.SetErrorString("could not get value");
}
@@ -1347,7 +1347,7 @@
Mutex::Locker api_locker (target_sp->GetAPIMutex());
Scalar scalar;
if (value_sp->ResolveValue (scalar))
- return scalar.GetRawBits64(fail_value);
+ return scalar.ULongLong(fail_value);
}
}
}
diff --git a/source/Core/Scalar.cpp b/source/Core/Scalar.cpp
index eaf0bc5..58f72ed 100644
--- a/source/Core/Scalar.cpp
+++ b/source/Core/Scalar.cpp
@@ -765,11 +765,11 @@
{
default:
case e_void: break;
- case e_sint: return (unsigned int)m_data.sint;
+ case e_sint:
case e_uint: return (unsigned int)m_data.uint;
- case e_slong: return (unsigned int)m_data.slong;
+ case e_slong:
case e_ulong: return (unsigned int)m_data.ulong;
- case e_slonglong: return (unsigned int)m_data.slonglong;
+ case e_slonglong:
case e_ulonglong: return (unsigned int)m_data.ulonglong;
case e_float: return (unsigned int)m_data.flt;
case e_double: return (unsigned int)m_data.dbl;
@@ -808,11 +808,11 @@
{
default:
case e_void: break;
- case e_sint: return (unsigned long)m_data.sint;
+ case e_sint:
case e_uint: return (unsigned long)m_data.uint;
- case e_slong: return (unsigned long)m_data.slong;
+ case e_slong:
case e_ulong: return (unsigned long)m_data.ulong;
- case e_slonglong: return (unsigned long)m_data.slonglong;
+ case e_slonglong:
case e_ulonglong: return (unsigned long)m_data.ulonglong;
case e_float: return (unsigned long)m_data.flt;
case e_double: return (unsigned long)m_data.dbl;
@@ -902,11 +902,11 @@
{
default:
case e_void: break;
- case e_sint: return (unsigned long long)m_data.sint;
+ case e_sint:
case e_uint: return (unsigned long long)m_data.uint;
- case e_slong: return (unsigned long long)m_data.slong;
+ case e_slong:
case e_ulong: return (unsigned long long)m_data.ulong;
- case e_slonglong: return (unsigned long long)m_data.slonglong;
+ case e_slonglong:
case e_ulonglong: return (unsigned long long)m_data.ulonglong;
case e_float: return (unsigned long long)m_data.flt;
case e_double: return (unsigned long long)m_data.dbl;
diff --git a/source/Core/ValueObject.cpp b/source/Core/ValueObject.cpp
index 86b7e89..f608f85 100644
--- a/source/Core/ValueObject.cpp
+++ b/source/Core/ValueObject.cpp
@@ -1294,7 +1294,7 @@
{
if (success)
*success = true;
- return scalar.GetRawBits64(fail_value);
+ return scalar.ULongLong(fail_value);
}
// fallthrough, otherwise...
}
@@ -1681,7 +1681,7 @@
Process *process = exe_ctx.GetProcessPtr();
if (process)
{
- addr_t target_addr = m_value.GetScalar().GetRawBits64(LLDB_INVALID_ADDRESS);
+ addr_t target_addr = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
size_t bytes_written = process->WriteScalarToMemory (target_addr,
new_scalar,
byte_size,