[Lldb-commits] [lldb] r316106 - lldb-server tests: Fix undefined behavior
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Wed Oct 18 11:52:17 PDT 2017
Author: labath
Date: Wed Oct 18 11:52:16 2017
New Revision: 316106
URL: http://llvm.org/viewvc/llvm-project?rev=316106&view=rev
Log:
lldb-server tests: Fix undefined behavior
We were creating a StringRef pointing to a temporary string. Problem manifested
itself when running the test on osx.
Modified:
lldb/trunk/unittests/tools/lldb-server/tests/MessageObjects.cpp
Modified: lldb/trunk/unittests/tools/lldb-server/tests/MessageObjects.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/tools/lldb-server/tests/MessageObjects.cpp?rev=316106&r1=316105&r2=316106&view=diff
==============================================================================
--- lldb/trunk/unittests/tools/lldb-server/tests/MessageObjects.cpp (original)
+++ lldb/trunk/unittests/tools/lldb-server/tests/MessageObjects.cpp Wed Oct 18 11:52:16 2017
@@ -67,8 +67,8 @@ StringRef ThreadInfo::ReadRegister(unsig
bool ThreadInfo::ReadRegisterAsUint64(unsigned int register_id,
uint64_t &value) const {
- StringRef value_str(m_registers.lookup(register_id));
- if (value_str.getAsInteger(16, value)) {
+ std::string value_str(m_registers.lookup(register_id));
+ if (!llvm::to_integer(value_str, value, 16)) {
GTEST_LOG_(ERROR)
<< formatv("ThreadInfo: Unable to parse register value at {0}.",
register_id)
More information about the lldb-commits
mailing list