Documentation ¶
Overview ¶
Package debugger provides the ability to start binaries under a debugger.
Index ¶
- Variables
- func FindPreemptiveDebuggerErrors(port int, remoteCommand bool) error
- func ForwardPort(ctx context.Context, sshConn *ssh.Conn, port int) error
- func IsRunningOnDUT() bool
- func PrintWaitingMessage(ctx context.Context, debugPort int)
- func RewriteDebugCommand(debugPort int, env []string, cmd string, args ...string) (newCmd string, newArgs []string)
- type DebugTarget
Constants ¶
This section is empty.
Variables ¶
var DlvDUTEnv = []string{"XDG_CONFIG_HOME=/mnt/stateful_partition/xdg_config"}
DlvDUTEnv is the environment variables required to run dlv on DUTs. Setting XDG_CONFIG_HOME to the stateful partition is required to stop it writing to ~/.config/dlv, which is in a read-only partition.
var DlvHostEnv = []string{}
DlvHostEnv is the environment variables required to run dlv on a host machine.
Functions ¶
func FindPreemptiveDebuggerErrors ¶
FindPreemptiveDebuggerErrors pre-emptively checks potential errors, to ensure better error messages for users.
func ForwardPort ¶
ForwardPort forwards a port from port to the ssh'd machine on the same port for the debugger. The existing SSHConn.ForwardLocalToRemote is unsuitable for our use case because it assumes that both channels will stop writing, and also because it attempts to accept multiple connections.
func IsRunningOnDUT ¶
func IsRunningOnDUT() bool
IsRunningOnDUT returns whether the current process is running on the DUT.
func PrintWaitingMessage ¶
PrintWaitingMessage outputs a "Waiting for debugger" message, if required.
func RewriteDebugCommand ¶
func RewriteDebugCommand(debugPort int, env []string, cmd string, args ...string) (newCmd string, newArgs []string)
RewriteDebugCommand takes a go binary and a set of arguments it takes, and if a debug port was provided, rewrites it as a command that instead runs a debugger and waits on that port before running the binary.
Types ¶
type DebugTarget ¶
type DebugTarget string
A DebugTarget represents a go binary that can be debugged.
const ( LocalBundle DebugTarget = "local" RemoteBundle DebugTarget = "remote" LocalTestRunner DebugTarget = "local-test-runner" RemoteTestRunner DebugTarget = "remote-test-runner" )
Valid DebugTargets are listed below.