本文整理汇总了C++中Target::CalculateProcess方法的典型用法代码示例。如果您正苦于以下问题:C++ Target::CalculateProcess方法的具体用法?C++ Target::CalculateProcess怎么用?C++ Target::CalculateProcess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Target
的用法示例。
在下文中一共展示了Target::CalculateProcess方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadInMemory
Status ObjectFile::LoadInMemory(Target &target, bool set_pc) {
Status error;
ProcessSP process = target.CalculateProcess();
if (!process)
return Status("No Process");
if (set_pc && !GetEntryPointAddress().IsValid())
return Status("No entry address in object file");
SectionList *section_list = GetSectionList();
if (!section_list)
return Status("No section in object file");
size_t section_count = section_list->GetNumSections(0);
for (size_t i = 0; i < section_count; ++i) {
SectionSP section_sp = section_list->GetSectionAtIndex(i);
addr_t addr = target.GetSectionLoadList().GetSectionLoadAddress(section_sp);
if (addr != LLDB_INVALID_ADDRESS) {
DataExtractor section_data;
// We can skip sections like bss
if (section_sp->GetFileSize() == 0)
continue;
section_sp->GetSectionData(section_data);
lldb::offset_t written = process->WriteMemory(
addr, section_data.GetDataStart(), section_data.GetByteSize(), error);
if (written != section_data.GetByteSize())
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;
}