feat(debug): multi-architecture debugger support for arm64, riscv64, loong64

Assisted-by: MiMo V2.5 Pro
This commit is contained in:
2026-08-21 00:35:21 +02:00
parent 3acbdd6533
commit de9e211ff1
32 changed files with 2276 additions and 659 deletions
+40
View File
@@ -0,0 +1,40 @@
// Copyright (c) 2026 Petr Balvín <opensource@petrbalvin.org> (https://petrbalvin.org)
// SPDX-License-Identifier: BSD-3-Clause
//go:build linux && loong64
package debug
import "fmt"
func printRegs(regs *Regs, codeBase, funcOff uint64) {
fmt.Printf(" PC = %#016x (func+%#x)\n", regs.R31, regs.R31-codeBase-funcOff)
fmt.Printf(" SP = %#016x FP = %#016x\n", regs.R3, regs.R21)
fmt.Printf(" RA = %#016x\n", regs.R1)
fmt.Printf(" A0 = %#016x A1 = %#016x\n", regs.R4, regs.R5)
fmt.Printf(" A2 = %#016x A3 = %#016x\n", regs.R6, regs.R7)
fmt.Printf(" A4 = %#016x A5 = %#016x\n", regs.R8, regs.R9)
fmt.Printf(" A6 = %#016x A7 = %#016x\n", regs.R10, regs.R11)
fmt.Printf(" T0 = %#016x T1 = %#016x\n", regs.R12, regs.R13)
fmt.Printf(" T2 = %#016x T3 = %#016x\n", regs.R14, regs.R15)
fmt.Printf(" T4 = %#016x T5 = %#016x\n", regs.R16, regs.R17)
fmt.Printf(" T6 = %#016x T7 = %#016x\n", regs.R18, regs.R19)
fmt.Printf(" T8 = %#016x\n", regs.R20)
fmt.Printf(" S0 = %#016x S1 = %#016x\n", regs.R22, regs.R23)
fmt.Printf(" S2 = %#016x S3 = %#016x\n", regs.R24, regs.R25)
fmt.Printf(" S4 = %#016x S5 = %#016x\n", regs.R26, regs.R27)
fmt.Printf(" S6 = %#016x S7 = %#016x\n", regs.R28, regs.R29)
fmt.Printf(" S8 = %#016x\n", regs.R30)
}
func printVectorRegs(v *VectorRegs) {
// No vector registers to display for loong64 yet.
}
// archReturnAddr reads the return address from RA (loong64 convention).
func archReturnAddr(s *Session, regs *Regs) (uint64, error) {
return regs.R1, nil
}
// archSPLabel returns the SP register name for display.
func archSPLabel() string { return "SP" }