Allow reading memory from files before the target has been run.

llvm-svn: 134780
This commit is contained in:
Jim Ingham 2011-07-09 00:55:34 +00:00
parent 9e00b6a654
commit b8e8a5f3ee
3 changed files with 12 additions and 8 deletions

View File

@ -298,7 +298,7 @@ public:
"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 @@ public:
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 @@ public:
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);

View File

@ -229,9 +229,13 @@ CommandObject::ExecuteWithOptions (Args& args, CommandReturnObject &result)
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
{

View File

@ -39,7 +39,6 @@ ThreadPlanStepOverBreakpoint::ThreadPlanStepOverBreakpoint (Thread &thread) :
{
m_breakpoint_addr = m_thread.GetRegisterContext()->GetPC();
m_breakpoint_site_id = m_thread.GetProcess().GetBreakpointSiteList().FindIDByAddress (m_breakpoint_addr);
}
ThreadPlanStepOverBreakpoint::~ThreadPlanStepOverBreakpoint ()