[Lldb-commits] [PATCH] Fetch object file load address if it isn't specified by the linker

Pavel Labath labath at google.com
Tue Jun 16 16:58:04 PDT 2015

Comment at: include/lldb/Target/Process.h:3040
@@ +3039,3 @@
+    virtual Error
+    GetFileLoadAddress(const FileSpec& file, lldb::addr_t& load_addr)
+    {
tberghammer wrote:
> ovyalov wrote:
> > Nit - I'd rather call it GetModuleLoadAddress in order to underscore that it's not a regular file.
> > 
> I intentionally named it a FileLoadAddress because the function (at least with the current implementation) can because to find the load address of any file mapped into the memory. I am not sure if we will use it for anything else but it might be useful.
If you go down that road you better specify the contract of the function much more precisely. For a program module (.so), the load address is a relatively clear concept (even though I am not sure if it is not possible to have the same module loaded twice at different addresses). However, regular files can be mapped into memory in strange ways:
- same file mapped multiple times
- a portion of a file mapped, but starting at a non-zero file offset
What will be the "load address" in these cases?



More information about the lldb-commits mailing list