[llvm] r294909 - llvm-readobj: process FreeBSD core notes
Saleem Abdulrasool via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 12 10:55:33 PST 2017
Author: compnerd
Date: Sun Feb 12 12:55:33 2017
New Revision: 294909
URL: http://llvm.org/viewvc/llvm-project?rev=294909&view=rev
Log:
llvm-readobj: process FreeBSD core notes
core files on FreeBSD have additional notes to capture state. Process
those notes when dumping the notes.
Modified:
llvm/trunk/include/llvm/Support/ELF.h
llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
Modified: llvm/trunk/include/llvm/Support/ELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ELF.h?rev=294909&r1=294908&r2=294909&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/ELF.h (original)
+++ llvm/trunk/include/llvm/Support/ELF.h Sun Feb 12 12:55:33 2017
@@ -1314,6 +1314,19 @@ enum { VER_NEED_NONE = 0, VER_NEED_CURRE
// SHT_NOTE section types
enum {
+ NT_FREEBSD_THRMISC = 7,
+ NT_FREEBSD_PROCSTAT_PROC = 8,
+ NT_FREEBSD_PROCSTAT_FILES = 9,
+ NT_FREEBSD_PROCSTAT_VMMAP = 10,
+ NT_FREEBSD_PROCSTAT_GROUPS = 11,
+ NT_FREEBSD_PROCSTAT_UMASK = 12,
+ NT_FREEBSD_PROCSTAT_RLIMIT = 13,
+ NT_FREEBSD_PROCSTAT_OSREL = 14,
+ NT_FREEBSD_PROCSTAT_PSSTRINGS = 15,
+ NT_FREEBSD_PROCSTAT_AUXV = 16,
+};
+
+enum {
NT_GNU_ABI_TAG = 1,
NT_GNU_HWCAP = 2,
NT_GNU_BUILD_ID = 3,
Modified: llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ELFDumper.cpp?rev=294909&r1=294908&r2=294909&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/ELFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/ELFDumper.cpp Sun Feb 12 12:55:33 2017
@@ -3337,6 +3337,34 @@ static std::string getGNUNoteTypeName(co
return string;
}
+static std::string getFreeBSDNoteTypeName(const uint32_t NT) {
+ static const struct {
+ uint32_t ID;
+ const char *Name;
+ } Notes[] = {
+ {ELF::NT_FREEBSD_THRMISC, "NT_THRMISC (thrmisc structure)"},
+ {ELF::NT_FREEBSD_PROCSTAT_PROC, "NT_PROCSTAT_PROC (proc data)"},
+ {ELF::NT_FREEBSD_PROCSTAT_FILES, "NT_PROCSTAT_FILES (files data)"},
+ {ELF::NT_FREEBSD_PROCSTAT_VMMAP, "NT_PROCSTAT_VMMAP (vmmap data)"},
+ {ELF::NT_FREEBSD_PROCSTAT_GROUPS, "NT_PROCSTAT_GROUPS (groups data)"},
+ {ELF::NT_FREEBSD_PROCSTAT_UMASK, "NT_PROCSTAT_UMASK (umask data)"},
+ {ELF::NT_FREEBSD_PROCSTAT_RLIMIT, "NT_PROCSTAT_RLIMIT (rlimit data)"},
+ {ELF::NT_FREEBSD_PROCSTAT_OSREL, "NT_PROCSTAT_OSREL (osreldate data)"},
+ {ELF::NT_FREEBSD_PROCSTAT_PSSTRINGS,
+ "NT_PROCSTAT_PSSTRINGS (ps_strings data)"},
+ {ELF::NT_FREEBSD_PROCSTAT_AUXV, "NT_PROCSTAT_AUXV (auxv data)"},
+ };
+
+ for (const auto &Note : Notes)
+ if (Note.ID == NT)
+ return std::string(Note.Name);
+
+ std::string string;
+ raw_string_ostream OS(string);
+ OS << format("Unknown note type (0x%08x)", NT);
+ return string;
+}
+
template <typename ELFT>
static void printGNUNote(raw_ostream &OS, uint32_t NoteType,
ArrayRef<typename ELFFile<ELFT>::Elf_Word> Words) {
@@ -3416,6 +3444,8 @@ void GNUStyle<ELFT>::printNotes(const EL
if (Name == "GNU") {
OS << getGNUNoteTypeName(Type) << '\n';
printGNUNote<ELFT>(OS, Type, Descriptor);
+ } else if (Name == "FreeBSD") {
+ OS << getFreeBSDNoteTypeName(Type) << '\n';
} else {
OS << "Unknown note type: (" << format_hex(Type, 10) << ')';
}
More information about the llvm-commits
mailing list