[all-commits] [llvm/llvm-project] e9c346: [LLDB][LoongArch] Add LoongArch ArchSpec and subty...

Lu Weining via All-commits all-commits at lists.llvm.org
Tue Nov 1 02:07:52 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e9c34618c904e0b22b6c9fec1f4a410e7484b8d3
      https://github.com/llvm/llvm-project/commit/e9c34618c904e0b22b6c9fec1f4a410e7484b8d3
  Author: Tiezhu Yang <yangtiezhu at loongson.cn>
  Date:   2022-11-01 (Tue, 01 Nov 2022)

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

  Log Message:
  -----------
  [LLDB][LoongArch] Add LoongArch ArchSpec and subtype detection

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

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
```

Reviewed By: SixWeining, xen0n, DavidSpickett

Differential Revision: https://reviews.llvm.org/D137057




More information about the All-commits mailing list