diff options
| author | Jim Ingham <jingham@apple.com> | 2011-03-07 23:44:08 +0000 |
|---|---|---|
| committer | Jim Ingham <jingham@apple.com> | 2011-03-07 23:44:08 +0000 |
| commit | 672e6f59c5e487b83b81c8b13ce162dfda7fdddf (patch) | |
| tree | 9172f417067f8fa5c3591dc80174639e99a5685b /lldb/source/Target/ThreadPlanCallFunction.cpp | |
| parent | 77ad1dc56dcd64faa3fe718cb4133242ead2f5b0 (diff) | |
Add a method "GetEntryPoint" to the ObjectFile class, and implement it on MachO & ELF - though the ELF implementation is probably a little weak. Then use this method in place of directly looking for "start" in the ThreadPlanCallFunction constructor to find the stopping point for our function evaluation.
llvm-svn: 127194
Diffstat (limited to 'lldb/source/Target/ThreadPlanCallFunction.cpp')
| -rw-r--r-- | lldb/source/Target/ThreadPlanCallFunction.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp index d3b62e6c7aaa..a5e1c1a0e794 100644 --- a/lldb/source/Target/ThreadPlanCallFunction.cpp +++ b/lldb/source/Target/ThreadPlanCallFunction.cpp @@ -66,19 +66,33 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread, lldb::addr_t spBelowRedZone = thread.GetRegisterContext()->GetSP() - abi->GetRedZoneSize(); - SymbolContextList contexts; - SymbolContext context; ModuleSP executableModuleSP (target.GetExecutableModule()); - if (!executableModuleSP || - !executableModuleSP->FindSymbolsWithNameAndType(ConstString ("start"), eSymbolTypeCode, contexts)) + if (!executableModuleSP) + { + log->Printf ("Can't execute code without an executable module."); return; + } + else + { + ObjectFile *objectFile = executableModuleSP->GetObjectFile(); + if (!objectFile) + { + log->Printf ("Could not find object file for module \"%s\".", + executableModuleSP->GetFileSpec().GetFilename().AsCString()); + return; + } + m_start_addr = objectFile->GetEntryPointAddress(); + if (!m_start_addr.IsValid()) + { + log->Printf ("Could not find entry point address for executable module \"%s\".", + executableModuleSP->GetFileSpec().GetFilename().AsCString()); + return; + } + } - contexts.GetContextAtIndex(0, context); - - m_start_addr = context.symbol->GetValue(); lldb::addr_t StartLoadAddr = m_start_addr.GetLoadAddress(&target); - + // Checkpoint the thread state so we can restore it later. if (log && log->GetVerbose()) ReportRegisterState ("About to checkpoint thread before function call. Original register state was:"); |
