[Lldb-commits] [lldb] 727ed11 - [AVR] Recognize the AVR architecture in lldb

Ayke van Laethem via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 30 04:41:48 PST 2020


Author: Ayke van Laethem
Date: 2020-01-30T13:40:31+01:00
New Revision: 727ed11b24c08c84a608886a1716b81c93640d80

URL: https://github.com/llvm/llvm-project/commit/727ed11b24c08c84a608886a1716b81c93640d80
DIFF: https://github.com/llvm/llvm-project/commit/727ed11b24c08c84a608886a1716b81c93640d80.diff

LOG: [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

Added: 
    lldb/test/Shell/ObjectFile/ELF/avr-basic-info.yaml

Modified: 
    lldb/include/lldb/Utility/ArchSpec.h
    lldb/source/Utility/ArchSpec.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Utility/ArchSpec.h b/lldb/include/lldb/Utility/ArchSpec.h
index 6e209dfd2e46..d1a257bedd36 100644
--- a/lldb/include/lldb/Utility/ArchSpec.h
+++ b/lldb/include/lldb/Utility/ArchSpec.h
@@ -188,6 +188,8 @@ class ArchSpec {
 
     eCore_arc, // little endian ARC
 
+    eCore_avr,
+
     eCore_wasm32,
 
     kNumCores,

diff  --git a/lldb/source/Utility/ArchSpec.cpp b/lldb/source/Utility/ArchSpec.cpp
index 08931b58cd2c..bb4771c6488c 100644
--- a/lldb/source/Utility/ArchSpec.cpp
+++ b/lldb/source/Utility/ArchSpec.cpp
@@ -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 = {

diff  --git a/lldb/test/Shell/ObjectFile/ELF/avr-basic-info.yaml b/lldb/test/Shell/ObjectFile/ELF/avr-basic-info.yaml
new file mode 100644
index 000000000000..3326ce66fa5d
--- /dev/null
+++ b/lldb/test/Shell/ObjectFile/ELF/avr-basic-info.yaml
@@ -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'
+...


        


More information about the lldb-commits mailing list