diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp index e0c2eaeb86c7..9f7bd8a0c246 100644 --- a/lldb/source/Target/ThreadPlanCallFunction.cpp +++ b/lldb/source/Target/ThreadPlanCallFunction.cpp @@ -68,8 +68,9 @@ ThreadPlanCallFunction::ConstructorSetup (Thread &thread, process_sp->ReadUnsignedIntegerFromMemory(m_function_sp, 4, 0, error); if (!error.Success()) { + m_constructor_errors.Printf ("Trying to put the stack in unreadable memory at: 0x%" PRIx64 ".", m_function_sp); if (log) - log->Printf ("ThreadPlanCallFunction(%p): Trying to put the stack in unreadable memory at: 0x%" PRIx64 ".", this, m_function_sp); + log->Printf ("ThreadPlanCallFunction(%p): %s.", this, m_constructor_errors.GetData()); return false; } @@ -77,8 +78,9 @@ ThreadPlanCallFunction::ConstructorSetup (Thread &thread, if (exe_module == NULL) { + m_constructor_errors.Printf ("Can't execute code without an executable module."); if (log) - log->Printf ("ThreadPlanCallFunction(%p): Can't execute code without an executable module.", this); + log->Printf ("ThreadPlanCallFunction(%p): %s.", this, m_constructor_errors.GetData()); return false; } else @@ -86,17 +88,21 @@ ThreadPlanCallFunction::ConstructorSetup (Thread &thread, ObjectFile *objectFile = exe_module->GetObjectFile(); if (!objectFile) { + m_constructor_errors.Printf ("Could not find object file for module \"%s\".", + exe_module->GetFileSpec().GetFilename().AsCString()); + if (log) - log->Printf ("ThreadPlanCallFunction(%p): Could not find object file for module \"%s\".", - this, exe_module->GetFileSpec().GetFilename().AsCString()); + log->Printf ("ThreadPlanCallFunction(%p): %s.", this, m_constructor_errors.GetData()); return false; } + m_start_addr = objectFile->GetEntryPointAddress(); if (!m_start_addr.IsValid()) { + m_constructor_errors.Printf ("Could not find entry point address for executable module \"%s\".", + exe_module->GetFileSpec().GetFilename().AsCString()); if (log) - log->Printf ("ThreadPlanCallFunction(%p): Could not find entry point address for executable module \"%s\".", - this, exe_module->GetFileSpec().GetFilename().AsCString()); + log->Printf ("ThreadPlanCallFunction(%p): %s.", this, m_constructor_errors.GetData()); return false; } } @@ -109,8 +115,9 @@ ThreadPlanCallFunction::ConstructorSetup (Thread &thread, if (!thread.CheckpointThreadState (m_stored_thread_state)) { + m_constructor_errors.Printf ("Setting up ThreadPlanCallFunction, failed to checkpoint thread state."); if (log) - log->Printf ("ThreadPlanCallFunction(%p): Setting up ThreadPlanCallFunction, failed to checkpoint thread state.", this); + log->Printf ("ThreadPlanCallFunction(%p): %s.", this, m_constructor_errors.GetData()); return false; } function_load_addr = m_function_addr.GetLoadAddress (target_sp.get()); @@ -330,7 +337,16 @@ bool ThreadPlanCallFunction::ValidatePlan (Stream *error) { if (!m_valid) + { + if (error) + { + if (m_constructor_errors.GetSize() > 0) + error->PutCString (m_constructor_errors.GetData()); + else + error->PutCString ("Unknown error"); + } return false; + } return true; }