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........@@....|
...
```
40 lines
1.1 KiB
Plaintext
40 lines
1.1 KiB
Plaintext
# RUN: yaml2obj %s -o %t
|
|
# RUN: llvm-readelf --notes %t | FileCheck %s --check-prefixes=GNU
|
|
# RUN: llvm-readobj --notes %t | FileCheck %s --check-prefixes=LLVM
|
|
|
|
# GNU: Displaying notes found in: .note.android.unknown
|
|
# GNU-NEXT: Owner Data size Description
|
|
# GNU-NEXT: Android 0x00000005 Unknown note type: (0x00001337)
|
|
# GNU-NEXT: description data: 01 23 45 67 89
|
|
|
|
# LLVM: NoteSections [
|
|
# LLVM-NEXT: NoteSection {
|
|
# LLVM-NEXT: Name: .note.android.unknown
|
|
# LLVM-NEXT: Offset: 0x40
|
|
# LLVM-NEXT: Size: 0x1C
|
|
# LLVM-NEXT: Notes [
|
|
# LLVM-NEXT: {
|
|
# LLVM-NEXT: Owner: Android
|
|
# LLVM-NEXT: Data size: 0x5
|
|
# LLVM-NEXT: Type: Unknown (0x00001337)
|
|
# LLVM-NEXT: Description data (
|
|
# LLVM-NEXT: 0000: 01234567 89
|
|
# LLVM-NEXT: )
|
|
# LLVM-NEXT: }
|
|
# LLVM-NEXT: ]
|
|
# LLVM-NEXT: }
|
|
# LLVM-NEXT: ]
|
|
|
|
--- !ELF
|
|
FileHeader:
|
|
Class: ELFCLASS64
|
|
Data: ELFDATA2LSB
|
|
Type: ET_DYN
|
|
Sections:
|
|
- Name: .note.android.unknown
|
|
Type: SHT_NOTE
|
|
Notes:
|
|
- Name: Android
|
|
Type: 0x1337
|
|
Desc: 0123456789
|