[Lldb-commits] [lldb] r183276 - <rdar://problem/13239809>
Enrico Granata
egranata at apple.com
Tue Jun 4 15:54:16 PDT 2013
Author: enrico
Date: Tue Jun 4 17:54:16 2013
New Revision: 183276
URL: http://llvm.org/viewvc/llvm-project?rev=183276&view=rev
Log:
<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
Modified:
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/source/Commands/CommandObjectMemory.cpp
lldb/trunk/source/Target/Target.cpp
Modified: lldb/trunk/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=183276&r1=183275&r2=183276&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Tue Jun 4 17:54:16 2013
@@ -127,6 +127,9 @@ public:
uint32_t
GetMaximumSizeOfStringSummary() const;
+
+ uint32_t
+ GetMaximumMemReadSize () const;
FileSpec
GetStandardInputPath () const;
Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=183276&r1=183275&r2=183276&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Tue Jun 4 17:54:16 2013
@@ -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())
Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=183276&r1=183275&r2=183276&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Tue Jun 4 17:54:16 2013
@@ -2295,6 +2295,7 @@ g_properties[] =
{ "exec-search-paths" , OptionValue::eTypeFileSpecList, false, 0 , NULL, NULL, "Executable search paths to use when locating executable files whose paths don't match the local file system." },
{ "max-children-count" , OptionValue::eTypeSInt64 , false, 256 , NULL, NULL, "Maximum number of children to expand in any level of depth." },
{ "max-string-summary-length" , OptionValue::eTypeSInt64 , false, 1024 , NULL, NULL, "Maximum number of characters to show when using %s in summary strings." },
+ { "max-memory-read-size" , OptionValue::eTypeSInt64 , false, 1024 , NULL, NULL, "Maximum number of bytes that 'memory read' will fetch before --force must be specified." },
{ "breakpoints-use-platform-avoid-list", OptionValue::eTypeBoolean , false, true , NULL, NULL, "Consult the platform module avoid list when setting non-module specific breakpoints." },
{ "arg0" , OptionValue::eTypeString , false, 0 , NULL, NULL, "The first argument passed to the program in the argument array which can be different from the executable itself." },
{ "run-args" , OptionValue::eTypeArgs , false, 0 , NULL, NULL, "A list containing all the arguments to be passed to the executable when it is run. Note that this does NOT include the argv[0] which is in target.arg0." },
@@ -2329,6 +2330,7 @@ enum
ePropertyExecutableSearchPaths,
ePropertyMaxChildrenCount,
ePropertyMaxSummaryLength,
+ ePropertyMaxMemReadSize,
ePropertyBreakpointUseAvoidList,
ePropertyArg0,
ePropertyRunArgs,
@@ -2624,6 +2626,13 @@ TargetProperties::GetMaximumSizeOfString
return m_collection_sp->GetPropertyAtIndexAsSInt64 (NULL, idx, g_properties[idx].default_uint_value);
}
+uint32_t
+TargetProperties::GetMaximumMemReadSize () const
+{
+ const uint32_t idx = ePropertyMaxMemReadSize;
+ return m_collection_sp->GetPropertyAtIndexAsSInt64 (NULL, idx, g_properties[idx].default_uint_value);
+}
+
FileSpec
TargetProperties::GetStandardInputPath () const
{
More information about the lldb-commits
mailing list