[Lldb-commits] [PATCH] D137057: [LLDB][LoongArch] Add LoongArch ArchSpec and subtype detection

Tiezhu Yang via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 31 00:43:39 PDT 2022


seehearfeel created this revision.
seehearfeel added reviewers: SixWeining, wangleiat, xen0n, xry111, MaskRay, DavidSpickett.
Herald added subscribers: StephenFan, emaste.
Herald added a project: All.
seehearfeel requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Define LoongArch architecture subtypes, add the LoongArch ArchSpec bits,
and inspect the ELF header to detect the right subtype based on ELF class.

Here is a simple test:

  [loongson at linux ~]$ cat hello.c 
  #include <stdio.h>
  
  int main()
  {
  	printf("Hello, World!\n");
  	return 0;
  }
  [loongson at linux ~]$ clang hello.c -g -o hello

Without this patch:

  [loongson at linux ~]$ llvm-project/llvm/build/bin/lldb hello
  (lldb) target create "hello"
  error: '/home/loongson/hello' doesn't contain any 'host' platform architectures: unknown

With this patch:

  [loongson at linux ~]$ llvm-project/llvm/build/bin/lldb hello
  (lldb) target create "hello"
  Current executable set to '/home/loongson/hello' (loongarch64).
  (lldb) run
  Process 735167 launched: '/home/loongson/hello' (loongarch64)
  Hello, World!
  Process 735167 exited with status = 0 (0x00000000) 
  (lldb) quit
  [loongson at linux ~]$ llvm-project/llvm/build/bin/llvm-lit llvm-project/lldb/test/Shell/ObjectFile/ELF/loongarch-arch.yaml
  llvm-lit: /home/loongson/llvm-project/llvm/utils/lit/lit/llvm/config.py:456: note: using clang: /home/loongson/llvm-project/llvm/build/bin/clang
  -- Testing: 1 tests, 1 workers --
  PASS: lldb-shell :: ObjectFile/ELF/loongarch-arch.yaml (1 of 1)
  
  Testing Time: 0.09s
    Passed: 1


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137057

Files:
  lldb/include/lldb/Utility/ArchSpec.h
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/source/Utility/ArchSpec.cpp
  lldb/test/Shell/ObjectFile/ELF/loongarch-arch.yaml

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137057.471911.patch
Type: text/x-patch
Size: 3921 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221031/b97d18fe/attachment-0001.bin>


More information about the lldb-commits mailing list