[PATCH] D65832: [llvm-readelf] Implement NT_FILE core file parsing
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 6 22:09:21 PDT 2019
MaskRay added inline comments.
================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:4362
+ StringRef Filename =
+ StringRef(reinterpret_cast<const char *>(Filenames.data()));
+ // Advance by size() + 1 due to null delimiter.
----------------
`StringRef Filename(reinterpret_cast<const char *>(Filenames.data()));`
================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:4363
+ StringRef(reinterpret_cast<const char *>(Filenames.data()));
+ // Advance by size() + 1 due to null delimiter.
+ Filenames = Filenames.drop_front(Filename.size() + 1);
----------------
(I think it is NUL, not null.)
================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:4369
+ Ret.Mappings.resize(FileCount);
+ for (unsigned int I = 0; I < FileCount; ++I) {
+ if (Filenames.empty())
----------------
Or `for (CoreFileMapping<ELFT> &Mapping : Ret.Mappings) {`
================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:4442
OS << " " << N.Type << ":\n " << N.Value << '\n';
+ } else if (Name == "CORE" || Obj->getHeader()->e_type == ELF::ET_CORE) {
+ OS << getCoreNoteTypeName(Type) << '\n';
----------------
` || Obj->getHeader()->e_type == ELF::ET_CORE` can be deleted.
readelf -n doesn't seem to perform the test, either.
================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:5601
W.printString(N.Type, N.Value);
+ } else if (Name == "CORE" || Obj->getHeader()->e_type == ELF::ET_CORE) {
+ W.printString("Type", getCoreNoteTypeName(Type));
----------------
` || Obj->getHeader()->e_type == ELF::ET_CORE` can be deleted.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65832/new/
https://reviews.llvm.org/D65832
More information about the llvm-commits
mailing list