mirror of
https://github.com/intel/llvm.git
synced 2026-01-16 05:32:28 +08:00
<rdar://problem/13925432>
A user request such as: memory read -fc -s10 -c1 *charPtrPtr would cause us to crash upon trying to read 1 char of size 10 from memory This request is now translated into: memory read -fc -s1 -c10 *charPtrPtr (i.e. read 10 chars of size 1 from memory) which is probably also what the user originally wanted llvm-svn: 182398
This commit is contained in:
@@ -827,12 +827,25 @@ protected:
|
||||
DataExtractor data (data_sp,
|
||||
target->GetArchitecture().GetByteOrder(),
|
||||
target->GetArchitecture().GetAddressByteSize());
|
||||
|
||||
|
||||
Format format = m_format_options.GetFormat();
|
||||
if ( ( (format == eFormatChar) || (format == eFormatCharPrintable) )
|
||||
&& (item_byte_size != 1)
|
||||
&& (item_count == 1))
|
||||
{
|
||||
// this turns requests such as
|
||||
// memory read -fc -s10 -c1 *charPtrPtr
|
||||
// which make no sense (what is a char of size 10?)
|
||||
// into a request for fetching 10 chars of size 1 from the same memory location
|
||||
format = eFormatCharArray;
|
||||
item_count = item_byte_size;
|
||||
item_byte_size = 1;
|
||||
}
|
||||
|
||||
assert (output_stream);
|
||||
size_t bytes_dumped = data.Dump (output_stream,
|
||||
0,
|
||||
m_format_options.GetFormat(),
|
||||
format,
|
||||
item_byte_size,
|
||||
item_count,
|
||||
num_per_line,
|
||||
|
||||
Reference in New Issue
Block a user