summaryrefslogtreecommitdiff
path: root/lldb/source/DataFormatters/StringPrinter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/DataFormatters/StringPrinter.cpp')
-rw-r--r--lldb/source/DataFormatters/StringPrinter.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/lldb/source/DataFormatters/StringPrinter.cpp b/lldb/source/DataFormatters/StringPrinter.cpp
index 0c6438f7dd86..ec8664ebe17a 100644
--- a/lldb/source/DataFormatters/StringPrinter.cpp
+++ b/lldb/source/DataFormatters/StringPrinter.cpp
@@ -408,8 +408,8 @@ static bool ReadEncodedBufferAndDumpToStream(
options.GetLocation() == LLDB_INVALID_ADDRESS)
return false;
- lldb::ProcessSP process_sp(options.GetProcessSP());
- if (!process_sp)
+ lldb::TargetSP target_sp = options.GetTargetSP();
+ if (!target_sp)
return false;
constexpr int type_width = sizeof(SourceDataType);
@@ -423,7 +423,7 @@ static bool ReadEncodedBufferAndDumpToStream(
bool needs_zero_terminator = options.GetNeedsZeroTermination();
bool is_truncated = false;
- const auto max_size = process_sp->GetTarget().GetMaximumSizeOfStringSummary();
+ const auto max_size = target_sp->GetMaximumSizeOfStringSummary();
uint32_t sourceSize;
if (elem_type == StringElementType::ASCII && !options.GetSourceSize()) {
@@ -462,24 +462,22 @@ static bool ReadEncodedBufferAndDumpToStream(
char *buffer = reinterpret_cast<char *>(buffer_sp->GetBytes());
if (elem_type == StringElementType::ASCII)
- process_sp->ReadCStringFromMemory(options.GetLocation(), buffer,
+ target_sp->ReadCStringFromMemory(options.GetLocation(), buffer,
bufferSPSize, error);
else if (needs_zero_terminator)
- process_sp->ReadStringFromMemory(options.GetLocation(), buffer,
+ target_sp->ReadStringFromMemory(options.GetLocation(), buffer,
bufferSPSize, error, type_width);
else
- process_sp->ReadMemoryFromInferior(options.GetLocation(), buffer,
- bufferSPSize, error);
+ target_sp->ReadMemory(options.GetLocation(), buffer, bufferSPSize, error);
if (error.Fail()) {
options.GetStream()->Printf("unable to read data");
return true;
}
- DataExtractor data(buffer_sp, process_sp->GetByteOrder(),
- process_sp->GetAddressByteSize());
-
StringPrinter::ReadBufferAndDumpToStreamOptions dump_options(options);
- dump_options.SetData(data);
+ dump_options.SetData(
+ DataExtractor(buffer_sp, target_sp->GetArchitecture().GetByteOrder(),
+ target_sp->GetArchitecture().GetAddressByteSize()));
dump_options.SetSourceSize(sourceSize);
dump_options.SetIsTruncated(is_truncated);
dump_options.SetNeedsZeroTermination(needs_zero_terminator);