<rdar://problem/13239809>

Two things:
1) fixing a bug where memory read was not clearing the m_force flag after it was passed, so that subsequent memory reads would not need to be forced even if over boundary
2) adding a setting target.max-memory-read-size that you can set instead of the hardcoded 1024 bytes limit we had before

llvm-svn: 183276
This commit is contained in:
Enrico Granata
2013-06-04 22:54:16 +00:00
parent 4ec309700b
commit d325bf9da1
3 changed files with 20 additions and 6 deletions

View File

@@ -44,7 +44,7 @@ g_option_table[] =
{ LLDB_OPT_SET_3, true , "type" ,'t', required_argument, NULL, 0, eArgTypeNone ,"The name of a type to view memory as."},
{ LLDB_OPT_SET_1|
LLDB_OPT_SET_2|
LLDB_OPT_SET_3, false, "force" ,'r', no_argument, NULL, 0, eArgTypeNone ,"Necessary if reading over 1024 bytes of memory."},
LLDB_OPT_SET_3, false, "force" ,'r', no_argument, NULL, 0, eArgTypeNone ,"Necessary if reading over target.max-memory-read-size bytes."},
};
@@ -119,6 +119,7 @@ public:
m_num_per_line.Clear();
m_output_as_binary = false;
m_view_as_type.Clear();
m_force = false;
}
Error
@@ -642,15 +643,16 @@ protected:
item_count = total_byte_size / item_byte_size;
}
if (total_byte_size > 1024 && !m_memory_options.m_force)
uint32_t max_unforced_size = target->GetMaximumMemReadSize();
if (total_byte_size > max_unforced_size && !m_memory_options.m_force)
{
result.AppendErrorWithFormat("Normally, \'memory read\' will not read over 1Kbyte of data.\n");
result.AppendErrorWithFormat("Please use --force to override this restriction.\n");
result.AppendErrorWithFormat("Normally, \'memory read\' will not read over %" PRIu32 " bytes of data.\n",max_unforced_size);
result.AppendErrorWithFormat("Please use --force to override this restriction just once.\n");
result.AppendErrorWithFormat("or set target.max-memory-read-size if you will often need a larger limit.\n");
return false;
}
DataBufferSP data_sp;
size_t bytes_read = 0;
if (clang_ast_type.GetOpaqueQualType())