[Lldb-commits] [PATCH] D17970: Implement ObjectFilePECOFF::GetEntryPointAddress.
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Tue Mar 8 15:37:44 PST 2016
clayborg added a comment.
lldb_private::Address is a section offset address class. We use section offset addresses everywhere. We also have the notion of three types of addresses: file address, load address and host address.
File addresses are virtual addresses as they are found in the object files (ELF, PECOFF, mach-o). They don't mean anything to the debugger because you will load your object file at various addresses as you are debugging. So we like to store the address as ".text + 0x123". Then when you load your shared library during runtime, the ".text" section will get slid by some offset. The target tracks where each shared library loads each of its sections and can turn a load address, or an address from a live process, into a section offset address. So load addresses can be resolved back into section + offset when running. A host address is when we stored constant data in the LLDB process itself. So in order to be able to slide your shared library around when running, we store all addresses as lldb_private::Address objects to facilite this. Targets can resolve a load address into a lldb_private::Address. When parsing things in object files, you must always translate any file addresses into lldb_private::Addresses (in symbols, debug info for functions and line entries, entry point addresses and much more).
Your function was causing an implicit constructor to be called on Address:
Address (lldb::addr_t abs_addr);
This will always result in a Address that has no section with an m_offset set to "abs_addr", meaning this is an absolute address that never slides.
More information about the lldb-commits