From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id 5D7CC3858D35 for ; Thu, 20 Jan 2022 00:50:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5D7CC3858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn Received: from localhost.localdomain (unknown [111.18.94.40]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9AxuuDIsehhEaoBAA--.6238S2; Thu, 20 Jan 2022 08:50:18 +0800 (CST) From: Tiezhu Yang To: gdb-patches@sourceware.org, Tom Tromey , Andrew Burgess Subject: [PATCH v2 0/5] gdb: Add basic support for LoongArch Date: Thu, 20 Jan 2022 08:50:06 +0800 Message-Id: <20220120005011.4531-1-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf9AxuuDIsehhEaoBAA--.6238S2 X-Coremail-Antispam: 1UD129KBjvJXoW3GF4DGw15Gw4fXrWUtr4fXwb_yoW7Gw4Dpr 4xAFn3Gr42vr97Jrnaqa4aqF90gws3GryjgaySyr1Ykrn0yr17Zr40qF45AF4DJ34rAw12 grnakw1DuF1UAFJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUySb7Iv0xC_Kw4lb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw A2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xII jxv20xvEc7CjxVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVWxJr0_GcWl84ACjcxK6I 8E87Iv6xkF7I0E14v26F4UJVW0owAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC 0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr 1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JMxAIw28IcxkI7VAKI48JMxC2 0s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI 0_JrI_JrWlx4CE17CEb7AF67AKxVWUXVWUAwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE 14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAIw20EY4v20x vaj40_WFyUJVCq3wCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v2 6r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07bOoGdUUUUU= X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SCC_5_SHORT_WORD_LINES, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Jan 2022 00:50:29 -0000 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