virtual lldb_private::Address GetEntryPointAddress() { return Address(); }
//------------------------------------------------------------------
- /// Returns the address that represents the header of this object file.
+ /// Returns base address of this object file.
///
- /// The header address is defined as where the header for the object file is
- /// that describes the content of the file. If the header doesn't appear in
- /// a section that is defined in the object file, an address with no section
- /// is returned that has the file offset set in the m_file_offset member of
- /// the lldb_private::Address object.
- ///
- /// @return
- /// Returns the entry address for this module.
+ /// This also sometimes referred to as the "preferred load address" or the
+ /// "image base address". Addresses within object files are often expressed
+ /// relative to this base. If this address corresponds to a specific section
+ /// (usually the first byte of the first section) then the returned address
+ /// will have this section set. Otherwise, the address will just have the
+ /// offset member filled in, indicating that this represents a file address.
//------------------------------------------------------------------
- virtual lldb_private::Address GetHeaderAddress() {
+ virtual lldb_private::Address GetBaseAddress() {
return Address(m_memory_addr);
}
if (module_sp) {
ObjectFile *objfile_ptr = module_sp->GetObjectFile();
if (objfile_ptr)
- sb_addr.ref() = objfile_ptr->GetHeaderAddress();
+ sb_addr.ref() = objfile_ptr->GetBaseAddress();
}
return sb_addr;
}
{ LLDB_OPT_SET_1, false, "address", 'a', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeAddressOrExpression, "Display the image at this address." },
{ LLDB_OPT_SET_1, false, "arch", 'A', OptionParser::eOptionalArgument, nullptr, {}, 0, eArgTypeWidth, "Display the architecture when listing images." },
{ LLDB_OPT_SET_1, false, "triple", 't', OptionParser::eOptionalArgument, nullptr, {}, 0, eArgTypeWidth, "Display the triple when listing images." },
- { LLDB_OPT_SET_1, false, "header", 'h', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Display the image header address as a load address if debugging, a file address otherwise." },
- { LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Display the image header address offset from the header file address (the slide amount)." },
+ { LLDB_OPT_SET_1, false, "header", 'h', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Display the image base address as a load address if debugging, a file address otherwise." },
+ { LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Display the image load address offset from the base file address (the slide amount)." },
{ LLDB_OPT_SET_1, false, "uuid", 'u', OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone, "Display the UUID when listing images." },
{ LLDB_OPT_SET_1, false, "fullpath", 'f', OptionParser::eOptionalArgument, nullptr, {}, 0, eArgTypeWidth, "Display the fullpath to the image object file." },
{ LLDB_OPT_SET_1, false, "directory", 'd', OptionParser::eOptionalArgument, nullptr, {}, 0, eArgTypeWidth, "Display the directory with optional width for the image object file." },
ObjectFile *objfile = module->GetObjectFile();
if (objfile) {
- Address header_addr(objfile->GetHeaderAddress());
- if (header_addr.IsValid()) {
+ Address base_addr(objfile->GetBaseAddress());
+ if (base_addr.IsValid()) {
if (target && !target->GetSectionLoadList().IsEmpty()) {
- lldb::addr_t header_load_addr =
- header_addr.GetLoadAddress(target);
- if (header_load_addr == LLDB_INVALID_ADDRESS) {
- header_addr.Dump(&strm, target,
+ lldb::addr_t load_addr =
+ base_addr.GetLoadAddress(target);
+ if (load_addr == LLDB_INVALID_ADDRESS) {
+ base_addr.Dump(&strm, target,
Address::DumpStyleModuleWithFileAddress,
Address::DumpStyleFileAddress);
} else {
// Show the offset of slide for the image
strm.Printf(
"0x%*.*" PRIx64, addr_nibble_width, addr_nibble_width,
- header_load_addr - header_addr.GetFileAddress());
+ load_addr - base_addr.GetFileAddress());
} else {
// Show the load address of the image
strm.Printf("0x%*.*" PRIx64, addr_nibble_width,
- addr_nibble_width, header_load_addr);
+ addr_nibble_width, load_addr);
}
}
break;
}
// The address was valid, but the image isn't loaded, output the
// address in an appropriate format
- header_addr.Dump(&strm, target, Address::DumpStyleFileAddress);
+ base_addr.Dump(&strm, target, Address::DumpStyleFileAddress);
break;
}
}
exe_objfile->GetStrata() != ObjectFile::eStrataKernel)
return LLDB_INVALID_ADDRESS;
- if (!exe_objfile->GetHeaderAddress().IsValid())
+ if (!exe_objfile->GetBaseAddress().IsValid())
return LLDB_INVALID_ADDRESS;
if (CheckForKernelImageAtAddress(
- exe_objfile->GetHeaderAddress().GetFileAddress(), process) ==
+ exe_objfile->GetBaseAddress().GetFileAddress(), process) ==
exe_module->GetUUID())
- return exe_objfile->GetHeaderAddress().GetFileAddress();
+ return exe_objfile->GetBaseAddress().GetFileAddress();
return LLDB_INVALID_ADDRESS;
}
ObjectFile *kernel_object_file = m_module_sp->GetObjectFile();
if (kernel_object_file) {
addr_t file_address =
- kernel_object_file->GetHeaderAddress().GetFileAddress();
+ kernel_object_file->GetBaseAddress().GetFileAddress();
if (m_load_address != LLDB_INVALID_ADDRESS &&
file_address != LLDB_INVALID_ADDRESS) {
s->Printf("Kernel slid 0x%" PRIx64 " in memory.\n",
ObjectFile *kernel_object_file = m_kernel.GetModule()->GetObjectFile();
if (kernel_object_file) {
addr_t load_address =
- kernel_object_file->GetHeaderAddress().GetLoadAddress(
+ kernel_object_file->GetBaseAddress().GetLoadAddress(
&m_process->GetTarget());
addr_t file_address =
- kernel_object_file->GetHeaderAddress().GetFileAddress();
+ kernel_object_file->GetBaseAddress().GetFileAddress();
if (load_address != LLDB_INVALID_ADDRESS && load_address != 0) {
m_kernel.SetLoadAddress(load_address);
if (load_address != file_address) {
return Address();
}
-lldb_private::Address ObjectFileJIT::GetHeaderAddress() { return Address(); }
+lldb_private::Address ObjectFileJIT::GetBaseAddress() { return Address(); }
ObjectFile::Type ObjectFileJIT::CalculateType() { return eTypeJIT; }
lldb_private::Address GetEntryPointAddress() override;
- lldb_private::Address GetHeaderAddress() override;
+ lldb_private::Address GetBaseAddress() override;
ObjectFile::Type CalculateType() override;
} else if (unified_section_sp) {
if (is_dsym && unified_section_sp->GetFileAddress() != load_cmd.vmaddr) {
// Check to see if the module was read from memory?
- if (module_sp->GetObjectFile()->GetHeaderAddress().IsValid()) {
+ if (module_sp->GetObjectFile()->GetBaseAddress().IsValid()) {
// We have a module that is in memory and needs to have its file
// address adjusted. We need to do this because when we load a file
// from memory, its addresses will be slid already, yet the addresses
return m_entry_point_address;
}
-lldb_private::Address ObjectFileMachO::GetHeaderAddress() {
+lldb_private::Address ObjectFileMachO::GetBaseAddress() {
lldb_private::Address header_addr;
SectionList *section_list = GetSectionList();
if (section_list) {
lldb_private::Address GetEntryPointAddress() override;
- lldb_private::Address GetHeaderAddress() override;
+ lldb_private::Address GetBaseAddress() override;
uint32_t GetNumThreadContexts() override;
if (sl) {
addr_t func_range_start_file_addr =
function_info.valid_range_offset_start +
- m_objfile.GetHeaderAddress().GetFileAddress();
+ m_objfile.GetBaseAddress().GetFileAddress();
AddressRange func_range(func_range_start_file_addr,
function_info.valid_range_offset_end -
function_info.valid_range_offset_start,
return false;
addr_t function_offset =
- address.GetFileAddress() - m_objfile.GetHeaderAddress().GetFileAddress();
+ address.GetFileAddress() - m_objfile.GetBaseAddress().GetFileAddress();
UnwindIndex key;
key.function_offset = function_offset;
if (sl) {
uint32_t lsda_offset = GetLSDAForFunctionOffset(
lsda_array_start, lsda_array_count, function_offset);
- addr_t objfile_header_file_address =
- m_objfile.GetHeaderAddress().GetFileAddress();
+ addr_t objfile_base_address =
+ m_objfile.GetBaseAddress().GetFileAddress();
unwind_info.lsda_address.ResolveAddressUsingFileSections(
- objfile_header_file_address + lsda_offset, sl);
+ objfile_base_address + lsda_offset, sl);
}
}
if (unwind_info.encoding & UNWIND_PERSONALITY_MASK) {
SectionList *sl = m_objfile.GetSectionList();
if (sl) {
uint32_t personality_offset = m_unwindinfo_data.GetU32(&offset);
- addr_t objfile_header_file_address =
- m_objfile.GetHeaderAddress().GetFileAddress();
+ addr_t objfile_base_address =
+ m_objfile.GetBaseAddress().GetFileAddress();
unwind_info.personality_ptr_address.ResolveAddressUsingFileSections(
- objfile_header_file_address + personality_offset, sl);
+ objfile_base_address + personality_offset, sl);
}
}
}
if (sl) {
uint32_t lsda_offset = GetLSDAForFunctionOffset(
lsda_array_start, lsda_array_count, function_offset);
- addr_t objfile_header_file_address =
- m_objfile.GetHeaderAddress().GetFileAddress();
+ addr_t objfile_base_address =
+ m_objfile.GetBaseAddress().GetFileAddress();
unwind_info.lsda_address.ResolveAddressUsingFileSections(
- objfile_header_file_address + lsda_offset, sl);
+ objfile_base_address + lsda_offset, sl);
}
}
if (unwind_info.encoding & UNWIND_PERSONALITY_MASK) {
SectionList *sl = m_objfile.GetSectionList();
if (sl) {
uint32_t personality_offset = m_unwindinfo_data.GetU32(&offset);
- addr_t objfile_header_file_address =
- m_objfile.GetHeaderAddress().GetFileAddress();
+ addr_t objfile_base_address =
+ m_objfile.GetBaseAddress().GetFileAddress();
unwind_info.personality_ptr_address.ResolveAddressUsingFileSections(
- objfile_header_file_address + personality_offset, sl);
+ objfile_base_address + personality_offset, sl);
}
}
}