[Lldb-commits] [lldb] r155750 - /lldb/trunk/source/Commands/CommandObjectMemory.cpp
Sean Callanan
scallanan at apple.com
Fri Apr 27 18:27:39 PDT 2012
Author: spyffe
Date: Fri Apr 27 20:27:38 2012
New Revision: 155750
URL: http://llvm.org/viewvc/llvm-project?rev=155750&view=rev
Log:
Added a --force option to "memory read,"
disallowing reads over 1KiB in total size
unless the user explicitly allows them.
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=155750&r1=155749&r2=155750&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Fri Apr 27 20:27:38 2012
@@ -37,7 +37,8 @@
{
{ LLDB_OPT_SET_1, false, "num-per-line" ,'l', required_argument, NULL, 0, eArgTypeNumberPerLine ,"The number of items per line to display."},
{ LLDB_OPT_SET_2, false, "binary" ,'b', no_argument , NULL, 0, eArgTypeNone ,"If true, memory will be saved as binary. If false, the memory is saved save as an ASCII dump that uses the format, size, count and number per line settings."},
- { LLDB_OPT_SET_3, true , "view-as" ,'t', required_argument, NULL, 0, eArgTypeNone ,"The name of a type to view memory as."},
+ { LLDB_OPT_SET_3, true , "view-as" ,'t', required_argument, NULL, 0, eArgTypeNone ,"The name of a type to view memory as."},
+ { LLDB_OPT_SET_4, false, "force" ,'r', no_argument, NULL, 0, eArgTypeNone ,"Necessary if reading over 1024 bytes of memory."},
};
@@ -94,6 +95,10 @@
case 't':
error = m_view_as_type.SetValueFromCString (option_arg);
break;
+
+ case 'r':
+ m_force = true;
+ break;
default:
error.SetErrorStringWithFormat("unrecognized short option '%c'", short_option);
@@ -270,6 +275,7 @@
OptionValueUInt64 m_num_per_line;
bool m_output_as_binary;
OptionValueString m_view_as_type;
+ bool m_force;
};
@@ -591,6 +597,13 @@
item_count = total_byte_size / item_byte_size;
}
+ if (total_byte_size > 1024 && !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");
+ return false;
+ }
+
DataBufferSP data_sp;
size_t bytes_read = 0;
if (!clang_ast_type.GetOpaqueQualType())
More information about the lldb-commits
mailing list