[AVR] Recognize the AVR architecture in lldb

This commit adds AVR support to lldb. With this change, it can load a
binary and do basic things like dump a line table.

Not much else has been implemented, that should be done in later
changes.

Differential Revision: https://reviews.llvm.org/D73539
This commit is contained in:
Ayke van Laethem 2020-01-28 11:56:24 +01:00
parent 86aae78268
commit 727ed11b24
No known key found for this signature in database
GPG Key ID: E97FF5335DFDFDED
3 changed files with 36 additions and 0 deletions

View File

@ -188,6 +188,8 @@ public:
eCore_arc, // little endian ARC
eCore_avr,
eCore_wasm32,
kNumCores,

View File

@ -218,6 +218,8 @@ static const CoreDefinition g_core_definitions[] = {
ArchSpec::eCore_uknownMach64, "unknown-mach-64"},
{eByteOrderLittle, 4, 2, 4, llvm::Triple::arc, ArchSpec::eCore_arc, "arc"},
{eByteOrderLittle, 2, 2, 4, llvm::Triple::avr, ArchSpec::eCore_avr, "avr"},
{eByteOrderLittle, 4, 1, 4, llvm::Triple::wasm32, ArchSpec::eCore_wasm32,
"wasm32"},
};
@ -448,6 +450,8 @@ static const ArchDefinitionEntry g_elf_arch_entries[] = {
LLDB_INVALID_CPUTYPE, 0xFFFFFFFFu, 0xFFFFFFFFu}, // HEXAGON
{ArchSpec::eCore_arc, llvm::ELF::EM_ARC_COMPACT2, LLDB_INVALID_CPUTYPE,
0xFFFFFFFFu, 0xFFFFFFFFu}, // ARC
{ArchSpec::eCore_avr, llvm::ELF::EM_AVR, LLDB_INVALID_CPUTYPE,
0xFFFFFFFFu, 0xFFFFFFFFu}, // AVR
};
static const ArchDefinition g_elf_arch_def = {

View File

@ -0,0 +1,30 @@
# RUN: yaml2obj %s > %t
# RUN: lldb-test object-file %t | FileCheck %s
# CHECK: Plugin name: elf
# CHECK: Architecture: avr--
# CHECK: Executable: true
# CHECK: Stripped: false
# CHECK: Type: executable
# CHECK: Strata: user
# CHECK: Name: .text
# CHECK-NEXT: Type: code
# CHECK-NEXT: Permissions: r-x
# CHECK-NEXT: Thread specific: no
# CHECK-NEXT: VM address: 0x0
# CHECK-NEXT: VM size: 4
# CHECK-NEXT: File size: 4
--- !ELF
FileHeader:
Class: ELFCLASS32
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_AVR
Flags: [ EF_AVR_ARCH_AVR1, EF_AVR_ARCH_AVR4 ]
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
AddressAlign: 0x0000000000000001
Content: '0000FECF'
...