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........@@....|
...
```
72 lines
2.5 KiB
Plaintext
72 lines
2.5 KiB
Plaintext
## Test that note values are interpreted correctly for OpenBSD 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: OpenBSD
|
|
Type: NT_OPENBSD_PROCINFO
|
|
- Name: OpenBSD
|
|
Type: NT_OPENBSD_AUXV
|
|
- Name: OpenBSD
|
|
Type: NT_OPENBSD_WCOOKIE
|
|
- Name: OpenBSD@31337
|
|
Type: NT_OPENBSD_REGS
|
|
- Name: OpenBSD@31337
|
|
Type: NT_OPENBSD_FPREGS
|
|
ProgramHeaders:
|
|
- Type: PT_NOTE
|
|
FirstSec: .note.foo
|
|
LastSec: .note.foo
|
|
|
|
# GNU: Displaying notes found at file offset 0x00000078 with length 0x00000074:
|
|
# GNU-NEXT: Owner Data size Description
|
|
# GNU-NEXT: OpenBSD 0x00000000 NT_OPENBSD_PROCINFO (procinfo structure)
|
|
# GNU-NEXT: OpenBSD 0x00000000 NT_OPENBSD_AUXV (ELF auxiliary vector data)
|
|
# GNU-NEXT: OpenBSD 0x00000000 NT_OPENBSD_WCOOKIE (window cookie)
|
|
# GNU-NEXT: OpenBSD@31337 0x00000000 NT_OPENBSD_REGS (regular registers)
|
|
# GNU-NEXT: OpenBSD@31337 0x00000000 NT_OPENBSD_FPREGS (floating point registers)
|
|
|
|
# LLVM: NoteSections [
|
|
# LLVM-NEXT: NoteSection {
|
|
# LLVM-NEXT: Name: <?>
|
|
# LLVM-NEXT: Offset: 0x78
|
|
# LLVM-NEXT: Size: 0x74
|
|
# LLVM-NEXT: Notes [
|
|
# LLVM-NEXT: {
|
|
# LLVM-NEXT: Owner: OpenBSD
|
|
# LLVM-NEXT: Data size: 0x0
|
|
# LLVM-NEXT: Type: NT_OPENBSD_PROCINFO (procinfo structure)
|
|
# LLVM-NEXT: }
|
|
# LLVM-NEXT: {
|
|
# LLVM-NEXT: Owner: OpenBSD
|
|
# LLVM-NEXT: Data size: 0x0
|
|
# LLVM-NEXT: Type: NT_OPENBSD_AUXV (ELF auxiliary vector data)
|
|
# LLVM-NEXT: }
|
|
# LLVM-NEXT: {
|
|
# LLVM-NEXT: Owner: OpenBSD
|
|
# LLVM-NEXT: Data size: 0x0
|
|
# LLVM-NEXT: Type: NT_OPENBSD_WCOOKIE (window cookie)
|
|
# LLVM-NEXT: }
|
|
# LLVM-NEXT: {
|
|
# LLVM-NEXT: Owner: OpenBSD@31337
|
|
# LLVM-NEXT: Data size: 0x0
|
|
# LLVM-NEXT: Type: NT_OPENBSD_REGS (regular registers)
|
|
# LLVM-NEXT: }
|
|
# LLVM-NEXT: {
|
|
# LLVM-NEXT: Owner: OpenBSD@31337
|
|
# LLVM-NEXT: Data size: 0x0
|
|
# LLVM-NEXT: Type: NT_OPENBSD_FPREGS (floating point registers)
|
|
# LLVM-NEXT: }
|
|
# LLVM-NEXT: ]
|
|
# LLVM-NEXT: }
|
|
# LLVM-NEXT: ]
|