[PATCH v2 0/5] gdb: Add basic support for LoongArch
Tiezhu Yang
yangtiezhu@loongson.cn
Thu Jan 20 00:50:06 GMT 2022
In November 2021, my workmate Zhensong Liu submitted a single gdb
patch [1] to support LoongArch which is a new RISC architecture,
thanks Zhensong for his great work.
It seems that the patch is too big to review, a patch series would be
easier to review after internal discussion.
This patchset only adds the minimal changes as simple as possible, the
basic command "run", "break", "continue", "next", "step" and "quit" can
be used to debug.
This is the first step, we will submit other more patches step by step
in the future, these small patches make an easily understood change that
can be verified by reviewers, any comments will be much appreciated.
Here are some test results:
$ make check-gdb TESTS="gdb.base/a2-run.exp"
$ cat gdb/testsuite/gdb.sum
[...]
PASS: gdb.base/a2-run.exp: run "a2-run" with no args
PASS: gdb.base/a2-run.exp: no spurious messages at program exit
PASS: gdb.base/a2-run.exp: run "a2-run" with arg
PASS: gdb.base/a2-run.exp: run "a2-run" again with same args
PASS: gdb.base/a2-run.exp: set args
PASS: gdb.base/a2-run.exp: run after setting args to nil
PASS: gdb.base/a2-run.exp: set args 6
PASS: gdb.base/a2-run.exp: run "a2-run" again after setting args
PASS: gdb.base/a2-run.exp: run "a2-run" with shell
=== gdb Summary ===
# of expected passes 9
[...]
$ make check-gdb TESTS="gdb.base/access-mem-running.exp"
$ cat gdb/testsuite/gdb.sum
[...]
PASS: gdb.base/access-mem-running.exp: all-stop: continuing
PASS: gdb.base/access-mem-running.exp: all-stop: get global_counter once
PASS: gdb.base/access-mem-running.exp: all-stop: get global_counter twice
PASS: gdb.base/access-mem-running.exp: all-stop: value changed
PASS: gdb.base/access-mem-running.exp: all-stop: print global_var before writing
PASS: gdb.base/access-mem-running.exp: all-stop: write to global_var
PASS: gdb.base/access-mem-running.exp: all-stop: print global_var after writing
PASS: gdb.base/access-mem-running.exp: all-stop: write to global_var again
PASS: gdb.base/access-mem-running.exp: all-stop: b maybe_stop_here
PASS: gdb.base/access-mem-running.exp: all-stop: breakpoint hits
PASS: gdb.base/access-mem-running.exp: non-stop: continuing
PASS: gdb.base/access-mem-running.exp: non-stop: get global_counter once
PASS: gdb.base/access-mem-running.exp: non-stop: get global_counter twice
PASS: gdb.base/access-mem-running.exp: non-stop: value changed
PASS: gdb.base/access-mem-running.exp: non-stop: print global_var before writing
PASS: gdb.base/access-mem-running.exp: non-stop: write to global_var
PASS: gdb.base/access-mem-running.exp: non-stop: print global_var after writing
PASS: gdb.base/access-mem-running.exp: non-stop: write to global_var again
PASS: gdb.base/access-mem-running.exp: non-stop: b maybe_stop_here
PASS: gdb.base/access-mem-running.exp: non-stop: breakpoint hits
=== gdb Summary ===
# of expected passes 20
[...]
The v1 of this patchset:
https://sourceware.org/pipermail/gdb-patches/2021-December/184354.html
The LoongArch documents:
https://loongson.github.io/LoongArch-Documentation/README-EN.html
The LoongArch ELF ABI Documents:
https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html
The LoongArch binutils has been merged into trunk:
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=e9a0721f8274
[1] https://sourceware.org/pipermail/gdb-patches/2021-November/183353.html
Tiezhu Yang (5):
gdb: LoongArch: Add initial target description support
gdb: LoongArch: Add initial baremetal support
gdb: LoongArch: Add initial Linux target support
gdb: LoongArch: Add initial native Linux support
gdb: LoongArch: Add Makefile, configure and NEWS
gdb/Makefile.in | 8 +
gdb/NEWS | 4 +
gdb/arch/loongarch.c | 88 +++++++++
gdb/arch/loongarch.h | 73 +++++++
gdb/configure.host | 3 +
gdb/configure.nat | 4 +
gdb/configure.tgt | 11 ++
gdb/doc/gdb.texinfo | 10 +
gdb/features/Makefile | 3 +
gdb/features/loongarch/base32.c | 47 +++++
gdb/features/loongarch/base32.xml | 44 +++++
gdb/features/loongarch/base64.c | 47 +++++
gdb/features/loongarch/base64.xml | 44 +++++
gdb/loongarch-linux-nat.c | 184 +++++++++++++++++
gdb/loongarch-linux-tdep.c | 151 ++++++++++++++
gdb/loongarch-tdep.c | 316 ++++++++++++++++++++++++++++++
gdb/loongarch-tdep.h | 49 +++++
17 files changed, 1086 insertions(+)
create mode 100644 gdb/arch/loongarch.c
create mode 100644 gdb/arch/loongarch.h
create mode 100644 gdb/features/loongarch/base32.c
create mode 100644 gdb/features/loongarch/base32.xml
create mode 100644 gdb/features/loongarch/base64.c
create mode 100644 gdb/features/loongarch/base64.xml
create mode 100644 gdb/loongarch-linux-nat.c
create mode 100644 gdb/loongarch-linux-tdep.c
create mode 100644 gdb/loongarch-tdep.c
create mode 100644 gdb/loongarch-tdep.h
--
2.27.0
More information about the Gdb-patches
mailing list