[Lldb-commits] [lldb] r155837 - in /lldb/branches/lldb-platform-work: ./ source/Commands/CommandObjectMemory.cpp

Johnny Chen johnny.chen at apple.com
Mon Apr 30 11:15:25 PDT 2012


Author: johnny
Date: Mon Apr 30 13:15:25 2012
New Revision: 155837

URL: http://llvm.org/viewvc/llvm-project?rev=155837&view=rev
Log:
Merge r155750 from ToT trunk:

svn merge -r 155694:155750 https://johnny@llvm.org/svn/llvm-project/lldb/trunk .

Modified:
    lldb/branches/lldb-platform-work/   (props changed)
    lldb/branches/lldb-platform-work/source/Commands/CommandObjectMemory.cpp

Propchange: lldb/branches/lldb-platform-work/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Apr 30 13:15:25 2012
@@ -1 +1 @@
-/lldb/trunk:154223-155694
+/lldb/trunk:154223-155750

Modified: lldb/branches/lldb-platform-work/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/source/Commands/CommandObjectMemory.cpp?rev=155837&r1=155836&r2=155837&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/branches/lldb-platform-work/source/Commands/CommandObjectMemory.cpp Mon Apr 30 13:15:25 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