diff options
Diffstat (limited to 'lldb/source/Symbol/ObjectFile.cpp')
-rw-r--r-- | lldb/source/Symbol/ObjectFile.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp index ecae78e3954..c5f0b477a91 100644 --- a/lldb/source/Symbol/ObjectFile.cpp +++ b/lldb/source/Symbol/ObjectFile.cpp @@ -652,11 +652,13 @@ ConstString ObjectFile::GetNextSyntheticSymbolName() { return ConstString(ss.GetString()); } -Error ObjectFile::LoadInMemory(Target &target) { +Error ObjectFile::LoadInMemory(Target &target, bool set_pc) { Error error; ProcessSP process = target.CalculateProcess(); if (!process) return Error("No Process"); + if (set_pc && !GetEntryPointAddress().IsValid()) + return Error("No entry address in object file"); SectionList *section_list = GetSectionList(); if (!section_list) @@ -677,5 +679,12 @@ Error ObjectFile::LoadInMemory(Target &target) { return error; } } + if (set_pc) { + ThreadList &thread_list = process->GetThreadList(); + ThreadSP curr_thread(thread_list.GetSelectedThread()); + RegisterContextSP reg_context(curr_thread->GetRegisterContext()); + Address file_entry = GetEntryPointAddress(); + reg_context->SetPC(file_entry.GetLoadAddress(&target)); + } return error; } |