diff options
| author | Greg Clayton <gclayton@apple.com> | 2012-02-27 23:00:14 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2012-02-27 23:00:14 +0000 |
| commit | 70a08d99c8152231efc0f921a08308cd69902432 (patch) | |
| tree | 474b4d07a3a3bbd6fed9d84f79f93721f19e55bf /lldb/source/Core/ValueObject.cpp | |
| parent | 688793da4ab0cb47b6b1770680286648481d8d65 (diff) | |
| download | bcm5719-llvm-70a08d99c8152231efc0f921a08308cd69902432.tar.gz bcm5719-llvm-70a08d99c8152231efc0f921a08308cd69902432.zip | |
<rdar://problem/10017623>
Fixed an error where if we tried to format a ValueObject using a format
that was incorrect for a variable, then it would set ValueObject::m_error
to an error state and stop the value from being able to be updated. We now
leave m_error alone and only let the update value code change that. Any errors
in formatting will return a valid value as C string that contains an error
string. This lets us then modify the format and redisplay without any issues.
llvm-svn: 151581
Diffstat (limited to 'lldb/source/Core/ValueObject.cpp')
| -rw-r--r-- | lldb/source/Core/ValueObject.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index 7c8cd7f62ed..023234cf99f 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -1135,24 +1135,26 @@ ValueObject::GetValueAsCString () } StreamString sstr; ExecutionContext exe_ctx (GetExecutionContextRef()); - if (ClangASTType::DumpTypeValue (GetClangAST(), // The clang AST - clang_type, // The clang type to display - &sstr, - my_format, // Format to display this type with - m_data, // Data to extract from - 0, // Byte offset into "m_data" - GetByteSize(), // Byte size of item in "m_data" - GetBitfieldBitSize(), // Bitfield bit size - GetBitfieldBitOffset(), - exe_ctx.GetBestExecutionContextScope())) // Bitfield bit offset - m_value_str.swap(sstr.GetString()); - else - { - m_error.SetErrorStringWithFormat ("unsufficient data for value (only %lu of %lu bytes available)", - m_data.GetByteSize(), - GetByteSize()); + ClangASTType::DumpTypeValue (GetClangAST(), // The clang AST + clang_type, // The clang type to display + &sstr, + my_format, // Format to display this type with + m_data, // Data to extract from + 0, // Byte offset into "m_data" + GetByteSize(), // Byte size of item in "m_data" + GetBitfieldBitSize(), // Bitfield bit size + GetBitfieldBitOffset(), // Bitfield bit offset + exe_ctx.GetBestExecutionContextScope()); + // Don't set the m_error to anything here otherwise + // we won't be able to re-format as anything else. The + // code for ClangASTType::DumpTypeValue() should always + // return something, even if that something contains + // an error messsage. "m_error" is used to detect errors + // when reading the valid object, not for formatting errors. + if (sstr.GetString().empty()) m_value_str.clear(); - } + else + m_value_str.swap(sstr.GetString()); } } break; |

