Author: enrico
Date: Mon Apr 6 13:41:17 2015
New Revision: 234194
URL: http://llvm.org/viewvc/llvm-project?rev=234194&view=rev
Log:
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
Modified:
lldb/trunk/source/Commands/CommandObjectMemory.cpp
Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=234194&r1=234193&r2=234194&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Mon Apr 6 13:41:17 2015
@@ -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));
}
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits