debug

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2026 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package debug provides interactive protocol debugging with breakpoints.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatHexView

func FormatHexView(data []byte, states []FieldState) string

FormatHexView formats data as annotated hex view.

Types

type Breakpoint

type Breakpoint struct {
	Field     string `json:"field"`
	Condition string `json:"condition,omitempty"` // e.g. "== 4", "> 100"
}

Breakpoint defines a debug breakpoint.

type FieldState

type FieldState struct {
	Name     string `json:"name"`
	Type     string `json:"type"`
	BitWidth int    `json:"bit_width"`
	Offset   int    `json:"offset_bits"`
	Value    any    `json:"value,omitempty"`
	HexView  string `json:"hex_view"`
}

FieldState represents the state of a field during decoding.

type Session

type Session struct {
	// contains filtered or unexported fields
}

Session is an interactive debug session.

func NewSession

func NewSession(s *schema.ProtocolSchema, data []byte) *Session

NewSession creates a new debug session.

func (*Session) AddBreakpoint

func (s *Session) AddBreakpoint(bp Breakpoint)

AddBreakpoint adds a breakpoint.

func (*Session) StepAll

func (s *Session) StepAll() []FieldState

StepAll decodes all fields and returns their states.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL