diff options
author | Pavel Labath <pavel@labath.sk> | 2018-12-11 15:21:15 +0000 |
---|---|---|
committer | Pavel Labath <pavel@labath.sk> | 2018-12-11 15:21:15 +0000 |
commit | d1e3fe2190acbd9b38a2badf6e40d2f7014b9ed4 (patch) | |
tree | b9503ea6dfb91ff5720eb6653125cac4c8ab7551 /lldb/source/Commands/CommandObjectTarget.cpp | |
parent | 2d7f3a3132c4ee87548279faaf10e0eeab7edb36 (diff) | |
download | bcm5719-llvm-d1e3fe2190acbd9b38a2badf6e40d2f7014b9ed4.tar.gz bcm5719-llvm-d1e3fe2190acbd9b38a2badf6e40d2f7014b9ed4.zip |
Rename ObjectFile::GetHeaderAddress to GetBaseAddress
Summary:
This function was named such because in the case of MachO files, the
mach header is located at this address. However all (most?) usages of
this function were not interested in that fact, but the fact that this
address is used as the base address for expressing various relative
addresses in the object file.
For other object file formats, this name is not appropriate (and it's
probably the reason why this function was not implemented in these
classes). In the ELF case the ELF header will usually end up at this
address, but this is a result of the linker optimizing the file layout
and not a requirement of the spec. For COFF files, I believe the is no
header located at this address either.
Reviewers: clayborg, jasonmolenda, amccarth, lemo, stella.stamenova
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D55422
llvm-svn: 348849
Diffstat (limited to 'lldb/source/Commands/CommandObjectTarget.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectTarget.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 4eddc0f9f1c..4a4d0d2d609 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -2969,8 +2969,8 @@ static constexpr OptionDefinition g_target_modules_list_options[] = { { 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." }, @@ -3229,13 +3229,13 @@ protected: 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 { @@ -3243,18 +3243,18 @@ protected: // 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; } } |