It turns out that the notes section for corefiles (or really any elf
file with multiple notes) is set up in such a way for LLVM formatted
output that the JSON equivalent only has the last note since the notes
are held in a dictionary with every key being Note. This pr alters the
layout for the notes to a list of dictionaries to sidestep this issue
for JSON output. Prior to this pr a note section in the output looked
like (for LLVM output):
```
Notes [
NoteSection {
Name: <?>
Offset: 0x2148
Size: 0x1F864
Note {
Owner: CORE
Data size: 0x150
Type: NT_PRSTATUS (prstatus structure)
Description data (
0000: 06000000 00000000 00000000 06000000 |................|
...
)
}
Note {
Owner: CORE
Data size: 0x88
Type: NT_PRPSINFO (prpsinfo structure)
Description data (
0000: 02440000 00000000 04054040 00000000 |.D........@@....|
....
```
But is now:
```
NoteSections [
NoteSection {
Name: <?>
Offset: 0x2148
Size: 0x1F864
Notes [
{
Owner: CORE
Data size: 0x150
Type: NT_PRSTATUS (prstatus structure)
Description data (
0000: 06000000 00000000 00000000 06000000 |................|
...
)
}
{
Owner: CORE
Data size: 0x88
Type: NT_PRPSINFO (prpsinfo structure)
Description data (
0000: 02440000 00000000 04054040 00000000 |.D........@@....|
...
```
57 lines
1.9 KiB
Plaintext
57 lines
1.9 KiB
Plaintext
## Test that note values are interpreted correctly for NetBSD core files.
|
|
# RUN: yaml2obj %s -o %t.o
|
|
# RUN: llvm-readelf --notes %t.o | FileCheck %s --check-prefix=GNU --strict-whitespace
|
|
# RUN: llvm-readobj --notes %t.o | FileCheck %s --check-prefix=LLVM --strict-whitespace
|
|
|
|
--- !ELF
|
|
FileHeader:
|
|
Class: ELFCLASS64
|
|
Data: ELFDATA2LSB
|
|
Type: ET_CORE
|
|
Sections:
|
|
- Name: .note.foo
|
|
Type: SHT_NOTE
|
|
Notes:
|
|
- Name: NetBSD-CORE
|
|
Type: NT_NETBSDCORE_PROCINFO
|
|
- Name: NetBSD-CORE
|
|
Type: NT_NETBSDCORE_AUXV
|
|
- Name: NetBSD-CORE@3615
|
|
Type: NT_NETBSDCORE_LWPSTATUS
|
|
|
|
ProgramHeaders:
|
|
- Type: PT_NOTE
|
|
FirstSec: .note.foo
|
|
LastSec: .note.foo
|
|
|
|
# GNU: Displaying notes found at file offset 0x00000078 with length 0x00000050:
|
|
# GNU-NEXT: Owner Data size Description
|
|
# GNU-NEXT: NetBSD-CORE 0x00000000 NT_NETBSDCORE_PROCINFO (procinfo structure)
|
|
# GNU-NEXT: NetBSD-CORE 0x00000000 NT_NETBSDCORE_AUXV (ELF auxiliary vector data)
|
|
# GNU-NEXT: NetBSD-CORE@3615 0x00000000 PT_LWPSTATUS (ptrace_lwpstatus structure)
|
|
|
|
# LLVM: NoteSections [
|
|
# LLVM-NEXT: NoteSection {
|
|
# LLVM-NEXT: Name: <?>
|
|
# LLVM-NEXT: Offset: 0x78
|
|
# LLVM-NEXT: Size: 0x50
|
|
# LLVM-NEXT: Notes [
|
|
# LLVM-NEXT: {
|
|
# LLVM-NEXT: Owner: NetBSD-CORE
|
|
# LLVM-NEXT: Data size: 0x0
|
|
# LLVM-NEXT: Type: NT_NETBSDCORE_PROCINFO (procinfo structure)
|
|
# LLVM-NEXT: }
|
|
# LLVM-NEXT: {
|
|
# LLVM-NEXT: Owner: NetBSD-CORE
|
|
# LLVM-NEXT: Data size: 0x0
|
|
# LLVM-NEXT: Type: NT_NETBSDCORE_AUXV (ELF auxiliary vector data)
|
|
# LLVM-NEXT: }
|
|
# LLVM-NEXT: {
|
|
# LLVM-NEXT: Owner: NetBSD-CORE@3615
|
|
# LLVM-NEXT: Data size: 0x0
|
|
# LLVM-NEXT: Type: PT_LWPSTATUS (ptrace_lwpstatus structure)
|
|
# LLVM-NEXT: }
|
|
# LLVM-NEXT: ]
|
|
# LLVM-NEXT: }
|
|
# LLVM-NEXT: ]
|