From d884fbde2a829ef8c78d1a0b0f2478e7e672bc0a Mon Sep 17 00:00:00 2001 From: Jordan Rupprecht Date: Mon, 5 Aug 2019 15:43:20 +0000 Subject: [llvm-readelf] Fix core note descriptions Summary: Core files have different descriptions for note values. llvm-readelf currently prints the generic note type, which is wrong when using it to read a core file. To verify the constants/strings, see: Values: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=include/elf/common.h;h=75c4fb7e9d7c0f780d635ac305f579546b7b071b;hb=HEAD#l571 Strings: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=binutils/readelf.c;h=c31a5c1266b7bb62a485895b01b49e1f832ade35;hb=HEAD#l16881 Note: this does not handle printing the note data for NT_FILE, it just fixes the descriptions. Reviewers: MaskRay Reviewed By: MaskRay Subscribers: labath, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D65608 llvm-svn: 367878 --- llvm/test/tools/llvm-readobj/note-core.test | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 llvm/test/tools/llvm-readobj/note-core.test (limited to 'llvm/test/tools/llvm-readobj/note-core.test') diff --git a/llvm/test/tools/llvm-readobj/note-core.test b/llvm/test/tools/llvm-readobj/note-core.test new file mode 100644 index 00000000000..dd513c74504 --- /dev/null +++ b/llvm/test/tools/llvm-readobj/note-core.test @@ -0,0 +1,28 @@ +## Test that note values are interpreted correctly for core files. + +# RUN: yaml2obj %s > %t.o +# RUN: llvm-readelf --notes %t.o 2>&1 | FileCheck %s + +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_CORE + Machine: EM_X86_64 +Sections: + - Name: .note.foo + Type: SHT_NOTE + # Note: format is 0500000000000000434F524500000000 repeated + Content: 050000000000000001000000434F524500000000050000000000000002000000434F524500000000050000000000000003000000434F524500000000050000000000000004000000434F524500000000050000000000000006000000434F524500000000 +ProgramHeaders: + - Type: PT_NOTE + Sections: + - Section: .note.foo + +# CHECK: Displaying notes found +# CHECK-NEXT: Owner Data size Description +# CHECK-NEXT: CORE 0x00000000 NT_PRSTATUS (prstatus structure) +# CHECK-NEXT: CORE 0x00000000 NT_FPREGSET (floating point registers) +# CHECK-NEXT: CORE 0x00000000 NT_PRPSINFO (prpsinfo structure) +# CHECK-NEXT: CORE 0x00000000 NT_TASKSTRUCT (task structure) +# CHECK-NEXT: CORE 0x00000000 NT_AUXV (auxiliary vector) -- cgit v1.2.3