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
+47
View File
@@ -0,0 +1,47 @@
// 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"
// WatchpointType selects what triggers the watchpoint.
type WatchpointType int
const (
WatchWrite WatchpointType = 1
WatchRead WatchpointType = 3
)
// wpSlots tracks watchpoint slot occupancy.
var wpSlots [4]bool
func (s *Session) FindFreeWatchpointSlot() int {
for i := 0; i < 4; i++ {
if !wpSlots[i] {
return i
}
}
return -1
}
func (s *Session) IsWatchpointSlotUsed(slot int) bool {
if slot < 0 || slot > 3 {
return false
}
return wpSlots[slot]
}
func (s *Session) SetWatchpoint(slot int, addr uint64, typ WatchpointType, size int) error {
return fmt.Errorf("debug: hardware watchpoints not yet implemented for loong64")
}
func (s *Session) ClearWatchpoint(slot int) error {
return fmt.Errorf("debug: hardware watchpoints not yet implemented for loong64")
}
func (s *Session) ClearAllWatchpoints() error {
return nil
}