Unverified Commit 727ed11b authored by Ayke van Laethem's avatar Ayke van Laethem
Browse files

[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
parent 86aae782
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -188,6 +188,8 @@ public:

    eCore_arc, // little endian ARC

    eCore_avr,

    eCore_wasm32,

    kNumCores,
+4 −0
Original line number Diff line number Diff line
@@ -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 = {
+30 −0
Original line number Diff line number Diff line
# 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'
...