Skip to content
This repository was archived by the owner on May 21, 2019. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4a0a125

Browse files
author
Enrico Granata
committedOct 24, 2012
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
1 parent 82ad7ca commit 4a0a125

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed
 

‎source/API/SBValue.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,7 +1284,7 @@ SBValue::GetValueAsUnsigned(SBError& error, uint64_t fail_value)
12841284
Mutex::Locker api_locker (target_sp->GetAPIMutex());
12851285
Scalar scalar;
12861286
if (value_sp->ResolveValue (scalar))
1287-
return scalar.GetRawBits64(fail_value);
1287+
return scalar.ULongLong(fail_value);
12881288
else
12891289
error.SetErrorString("could not get value");
12901290
}
@@ -1347,7 +1347,7 @@ SBValue::GetValueAsUnsigned(uint64_t fail_value)
13471347
Mutex::Locker api_locker (target_sp->GetAPIMutex());
13481348
Scalar scalar;
13491349
if (value_sp->ResolveValue (scalar))
1350-
return scalar.GetRawBits64(fail_value);
1350+
return scalar.ULongLong(fail_value);
13511351
}
13521352
}
13531353
}

‎source/Core/Scalar.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -765,11 +765,11 @@ Scalar::UInt(unsigned int fail_value) const
765765
{
766766
default:
767767
case e_void: break;
768-
case e_sint: return (unsigned int)m_data.sint;
768+
case e_sint:
769769
case e_uint: return (unsigned int)m_data.uint;
770-
case e_slong: return (unsigned int)m_data.slong;
770+
case e_slong:
771771
case e_ulong: return (unsigned int)m_data.ulong;
772-
case e_slonglong: return (unsigned int)m_data.slonglong;
772+
case e_slonglong:
773773
case e_ulonglong: return (unsigned int)m_data.ulonglong;
774774
case e_float: return (unsigned int)m_data.flt;
775775
case e_double: return (unsigned int)m_data.dbl;
@@ -808,11 +808,11 @@ Scalar::ULong(unsigned long fail_value) const
808808
{
809809
default:
810810
case e_void: break;
811-
case e_sint: return (unsigned long)m_data.sint;
811+
case e_sint:
812812
case e_uint: return (unsigned long)m_data.uint;
813-
case e_slong: return (unsigned long)m_data.slong;
813+
case e_slong:
814814
case e_ulong: return (unsigned long)m_data.ulong;
815-
case e_slonglong: return (unsigned long)m_data.slonglong;
815+
case e_slonglong:
816816
case e_ulonglong: return (unsigned long)m_data.ulonglong;
817817
case e_float: return (unsigned long)m_data.flt;
818818
case e_double: return (unsigned long)m_data.dbl;
@@ -902,11 +902,11 @@ Scalar::ULongLong(unsigned long long fail_value) const
902902
{
903903
default:
904904
case e_void: break;
905-
case e_sint: return (unsigned long long)m_data.sint;
905+
case e_sint:
906906
case e_uint: return (unsigned long long)m_data.uint;
907-
case e_slong: return (unsigned long long)m_data.slong;
907+
case e_slong:
908908
case e_ulong: return (unsigned long long)m_data.ulong;
909-
case e_slonglong: return (unsigned long long)m_data.slonglong;
909+
case e_slonglong:
910910
case e_ulonglong: return (unsigned long long)m_data.ulonglong;
911911
case e_float: return (unsigned long long)m_data.flt;
912912
case e_double: return (unsigned long long)m_data.dbl;

‎source/Core/ValueObject.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,7 +1294,7 @@ ValueObject::GetValueAsUnsigned (uint64_t fail_value, bool *success)
12941294
{
12951295
if (success)
12961296
*success = true;
1297-
return scalar.GetRawBits64(fail_value);
1297+
return scalar.ULongLong(fail_value);
12981298
}
12991299
// fallthrough, otherwise...
13001300
}
@@ -1681,7 +1681,7 @@ ValueObject::SetValueFromCString (const char *value_str, Error& error)
16811681
Process *process = exe_ctx.GetProcessPtr();
16821682
if (process)
16831683
{
1684-
addr_t target_addr = m_value.GetScalar().GetRawBits64(LLDB_INVALID_ADDRESS);
1684+
addr_t target_addr = m_value.GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
16851685
size_t bytes_written = process->WriteScalarToMemory (target_addr,
16861686
new_scalar,
16871687
byte_size,

0 commit comments

Comments
 (0)
This repository has been archived.