mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
llvm-readobj: process FreeBSD core notes
core files on FreeBSD have additional notes to capture state. Process those notes when dumping the notes. llvm-svn: 294909
This commit is contained in:
parent
261a1c23e2
commit
0d4bc5e5d5
@ -1313,6 +1313,19 @@ enum {
|
||||
enum { VER_NEED_NONE = 0, VER_NEED_CURRENT = 1 };
|
||||
|
||||
// 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,
|
||||
|
@ -3337,6 +3337,34 @@ static std::string getGNUNoteTypeName(const uint32_t NT) {
|
||||
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 ELFFile<ELFT> *Obj) {
|
||||
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) << ')';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user