[PATCH] D24706: [ELF] - Partial support of --gdb-index command line option (Part 1).

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 18 12:56:51 PDT 2016


ruiu added inline comments.


================
Comment at: ELF/GdbIndex.cpp:76
+
+  std::unique_ptr<llvm::DWARFContext> Dwarf;
+  if (Expected<std::unique_ptr<object::ObjectFile>> Obj =
----------------
Remove `llvm::`.


================
Comment at: ELF/GdbIndex.cpp:76-85
+  std::unique_ptr<llvm::DWARFContext> Dwarf;
+  if (Expected<std::unique_ptr<object::ObjectFile>> Obj =
+          object::ObjectFile::createObjectFile(DebugInfoSec->getFile()->MB))
+    Dwarf.reset(new DWARFContextInMemory(*Obj.get()));
+
+  if (!Dwarf) {
+    error(getFilename(DebugInfoSec->getFile()) +
----------------
ruiu wrote:
> Remove `llvm::`.
 


================
Comment at: ELF/GdbIndex.cpp:78
+  if (Expected<std::unique_ptr<object::ObjectFile>> Obj =
+          object::ObjectFile::createObjectFile(DebugInfoSec->getFile()->MB))
+    Dwarf.reset(new DWARFContextInMemory(*Obj.get()));
----------------
It seems that `createObjectFile` parses the file again. Can you avoid that?


================
Comment at: ELF/GdbIndex.cpp:88
+  std::vector<std::pair<uintX_t, uintX_t>> Ret;
+  for (const auto &CU : Dwarf->compile_units())
+    Ret.push_back(
----------------
Replace `auto` with its concrete type.


================
Comment at: ELF/GdbIndex.cpp:94-101
+template std::vector<std::pair<ELF32LE::uint, ELF32LE::uint>>
+lld::elf::readCuList<ELF32LE>(InputSection<ELF32LE> *Sec);
+template std::vector<std::pair<ELF32BE::uint, ELF32BE::uint>>
+lld::elf::readCuList<ELF32BE>(InputSection<ELF32BE> *Sec);
+template std::vector<std::pair<ELF64LE::uint, ELF64LE::uint>>
+lld::elf::readCuList<ELF64LE>(InputSection<ELF64LE> *Sec);
+template std::vector<std::pair<ELF64BE::uint, ELF64BE::uint>>
----------------
Remove `Sec`. Use uint32_t and uint64_t instead of ELF????::uint.


https://reviews.llvm.org/D24706





More information about the llvm-commits mailing list