aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectMemory.cpp
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2015-04-06 18:41:17 +0000
committerEnrico Granata <egranata@apple.com>2015-04-06 18:41:17 +0000
commitdc3c3ee8526e1cbfdb4859882f5e4739c5acc37f (patch)
treeb45b62ba7dc7ac84081c08b37d9995a0c1ce7d55 /lldb/source/Commands/CommandObjectMemory.cpp
parent49ba9b8e2ffcbe78de5971074a76a60191d59d86 (diff)
downloadllvm-dc3c3ee8526e1cbfdb4859882f5e4739c5acc37f.zip
llvm-dc3c3ee8526e1cbfdb4859882f5e4739c5acc37f.tar.gz
llvm-dc3c3ee8526e1cbfdb4859882f5e4739c5acc37f.tar.bz2
If memory read does not find a NULL terminator, still print whatever it gathered instead of just NOP'ing out
However, remark that this is an incomplete chunk of data by still emitting the "no NULL found" warning rdar://20330073 llvm-svn: 234194
Diffstat (limited to 'lldb/source/Commands/CommandObjectMemory.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectMemory.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index 4f41d9b..23da6e2 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -744,6 +744,7 @@ protected:
auto data_addr = addr;
auto count = item_count;
item_count = 0;
+ bool break_on_no_NULL = false;
while (item_count < count)
{
std::string buffer;
@@ -756,17 +757,24 @@ protected:
result.SetStatus(eReturnStatusFailed);
return false;
}
+
if (item_byte_size == read)
{
result.AppendWarningWithFormat("unable to find a NULL terminated string at 0x%" PRIx64 ".Consider increasing the maximum read length.\n", data_addr);
- break;
+ --read;
+ break_on_no_NULL = true;
}
- read+=1; // account for final NULL byte
+ else
+ ++read; // account for final NULL byte
+
memcpy(data_ptr, &buffer[0], read);
data_ptr += read;
data_addr += read;
bytes_read += read;
item_count++; // if we break early we know we only read item_count strings
+
+ if (break_on_no_NULL)
+ break;
}
data_sp.reset(new DataBufferHeap(data_sp->GetBytes(),bytes_read+1));
}