[Lldb-commits] [lldb] r134780 - in /lldb/trunk/source: Commands/CommandObjectMemory.cpp Interpreter/CommandObject.cpp Target/ThreadPlanStepOverBreakpoint.cpp

Jim Ingham jingham at apple.com
Fri Jul 8 17:55:34 PDT 2011


Author: jingham
Date: Fri Jul  8 19:55:34 2011
New Revision: 134780

URL: http://llvm.org/viewvc/llvm-project?rev=134780&view=rev
Log:
Allow reading memory from files before the target has been run.

Modified:
    lldb/trunk/source/Commands/CommandObjectMemory.cpp
    lldb/trunk/source/Interpreter/CommandObject.cpp
    lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp

Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=134780&r1=134779&r2=134780&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Fri Jul  8 19:55:34 2011
@@ -298,7 +298,7 @@
                        "memory read",
                        "Read from the memory of the process being debugged.",
                        NULL,
-                       eFlagProcessMustBeLaunched),
+                       eFlagProcessMustBePaused),
         m_option_group (interpreter),
         m_format_options (eFormatBytesWithASCII, 0, true),
         m_memory_options (),
@@ -351,9 +351,9 @@
              CommandReturnObject &result)
     {
         ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
-        if (exe_ctx.process == NULL)
+        if (exe_ctx.target == NULL)
         {
-            result.AppendError("need a process to read memory");
+            result.AppendError("need at least a target to read memory");
             result.SetStatus(eReturnStatusFailed);
             return false;
         }
@@ -561,7 +561,8 @@
         if (!clang_ast_type.GetOpaqueQualType())
         {
             data_sp.reset (new DataBufferHeap (total_byte_size, '\0'));
-            bytes_read = exe_ctx.process->ReadMemory(addr, data_sp->GetBytes (), data_sp->GetByteSize(), error);
+            Address address(NULL, addr);
+            bytes_read = exe_ctx.target->ReadMemory(address, false, data_sp->GetBytes (), data_sp->GetByteSize(), error);
             if (bytes_read == 0)
             {
                 result.AppendWarningWithFormat("Read from 0x%llx failed.\n", addr);

Modified: lldb/trunk/source/Interpreter/CommandObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=134780&r1=134779&r2=134780&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObject.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObject.cpp Fri Jul  8 19:55:34 2011
@@ -229,9 +229,13 @@
         Process *process = m_interpreter.GetExecutionContext().process;
         if (process == NULL)
         {
-            result.AppendError ("Process must exist.");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
+            // A process that is not running is considered paused.
+            if (GetFlags().Test(CommandObject::eFlagProcessMustBeLaunched))
+            {
+                result.AppendError ("Process must exist.");
+                result.SetStatus (eReturnStatusFailed);
+                return false;
+            }
         }
         else
         {

Modified: lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp?rev=134780&r1=134779&r2=134780&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp Fri Jul  8 19:55:34 2011
@@ -39,7 +39,6 @@
 {
     m_breakpoint_addr = m_thread.GetRegisterContext()->GetPC();
     m_breakpoint_site_id =  m_thread.GetProcess().GetBreakpointSiteList().FindIDByAddress (m_breakpoint_addr);
-
 }
 
 ThreadPlanStepOverBreakpoint::~ThreadPlanStepOverBreakpoint ()





More information about the lldb-commits mailing list