summaryrefslogtreecommitdiffstats
path: root/oatdump
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2014-10-08 17:27:48 -0700
committerIan Rogers <irogers@google.com>2014-10-09 08:25:34 -0700
commit0279ebb3efd653e6bb255470c99d26949c7bcd95 (patch)
treed58b29754f7b3c88616e6e4d6c19346821d244ae /oatdump
parentf1f05d303988a5c071c87b760056be8358276c94 (diff)
downloadart-0279ebb3efd653e6bb255470c99d26949c7bcd95.zip
art-0279ebb3efd653e6bb255470c99d26949c7bcd95.tar.gz
art-0279ebb3efd653e6bb255470c99d26949c7bcd95.tar.bz2
Tidy ELF builder.
Don't do "if (ptr)". Use const. Use DISALLOW_COPY_AND_ASSIGN. Avoid public member variables. Move ValueObject to base and use in ELF builder. Tidy VectorOutputStream to not use non-const reference arguments. Change-Id: I2c727c3fc61769c3726de7cfb68b2d6eb4477e53
Diffstat (limited to 'oatdump')
-rw-r--r--oatdump/oatdump.cc21
1 files changed, 10 insertions, 11 deletions
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index d5e766f..51b7a98 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -120,10 +120,12 @@ const char* image_roots_descriptions_[] = {
"kClassRoots",
};
-class OatSymbolizer : public CodeOutput {
+class OatSymbolizer FINAL : public CodeOutput {
public:
- explicit OatSymbolizer(const OatFile* oat_file, std::string& output_name) :
- oat_file_(oat_file), builder_(nullptr), elf_output_(nullptr), output_name_(output_name) {}
+ explicit OatSymbolizer(const OatFile* oat_file, const std::string& output_name) :
+ oat_file_(oat_file), builder_(nullptr), elf_output_(nullptr),
+ output_name_(output_name.empty() ? "symbolized.oat" : output_name) {
+ }
bool Init() {
Elf32_Word oat_data_size = oat_file_->GetOatHeader().GetExecutableOffset();
@@ -131,9 +133,6 @@ class OatSymbolizer : public CodeOutput {
uint32_t diff = static_cast<uint32_t>(oat_file_->End() - oat_file_->Begin());
uint32_t oat_exec_size = diff - oat_data_size;
- if (output_name_.empty()) {
- output_name_ = "symbolized.oat";
- }
elf_output_ = OS::CreateEmptyFile(output_name_.c_str());
builder_.reset(new ElfBuilder<Elf32_Word, Elf32_Sword, Elf32_Addr, Elf32_Dyn,
@@ -307,11 +306,11 @@ class OatSymbolizer : public CodeOutput {
}
ElfSymtabBuilder<Elf32_Word, Elf32_Sword, Elf32_Addr,
- Elf32_Sym, Elf32_Shdr>* symtab = &builder_->symtab_builder_;
+ Elf32_Sym, Elf32_Shdr>* symtab = builder_->GetSymtabBuilder();
- symtab->AddSymbol(pretty_name, &builder_->text_builder_, oat_method.GetCodeOffset() -
- oat_file_->GetOatHeader().GetExecutableOffset(), true,
- oat_method.GetQuickCodeSize(), STB_GLOBAL, STT_FUNC);
+ symtab->AddSymbol(pretty_name, &builder_->GetTextBuilder(),
+ oat_method.GetCodeOffset() - oat_file_->GetOatHeader().GetExecutableOffset(),
+ true, oat_method.GetQuickCodeSize(), STB_GLOBAL, STT_FUNC);
}
}
@@ -340,7 +339,7 @@ class OatSymbolizer : public CodeOutput {
Elf32_Sym, Elf32_Ehdr, Elf32_Phdr, Elf32_Shdr> > builder_;
File* elf_output_;
std::unordered_map<uint32_t, uint32_t> state_;
- std::string output_name_;
+ const std::string output_name_;
};
class OatDumperOptions {