This commit adds a set of commands to monitor for enabling breakpoint debugger. This is implemented based on the walker utility for step-by-step LLB inspection. For each vertex and breakpoint, monitor calls Solve API so the user can enter to the debugger container on each vertex for inspection. User can enter to the breakpoint debugger mode by --invoke=debug-step flag. Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
39 lines
725 B
Go
39 lines
725 B
Go
package commands
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/docker/buildx/monitor/types"
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
type ClearCmd struct {
|
|
m types.Monitor
|
|
}
|
|
|
|
func NewClearCmd(m types.Monitor) types.Command {
|
|
return &ClearCmd{m}
|
|
}
|
|
|
|
func (cm *ClearCmd) Info() types.CommandInfo {
|
|
return types.CommandInfo{
|
|
Name: "clear",
|
|
HelpMessage: "clears a breakpoint",
|
|
HelpMessageLong: `
|
|
Usage:
|
|
clear KEY
|
|
|
|
KEY is the name of the breakpoint.
|
|
Use "breakpoints" command to list keys of the breakpoints.
|
|
`,
|
|
}
|
|
}
|
|
|
|
func (cm *ClearCmd) Exec(ctx context.Context, args []string) error {
|
|
if len(args) < 2 {
|
|
return errors.Errorf("clear: specify breakpoint key")
|
|
}
|
|
cm.m.GetWalkerController().Breakpoints().Clear(args[1])
|
|
return nil
|
|
}
|