diff --git a/command/command.go b/command/command.go index 8a72d9ec..30c003f2 100644 --- a/command/command.go +++ b/command/command.go @@ -24,6 +24,7 @@ type Commands struct { // Returns a Commands struct with default commands defined. func DebugCommands() *Commands { cmds := map[string]cmdfunc{ + "help": help, "continue": cont, "next": next, "break": breakpoint, @@ -71,6 +72,16 @@ func nullCommand(p *proctl.DebuggedProcess, ars ...string) error { return nil } +func help(p *proctl.DebuggedProcess, ars ...string) error { + fmt.Println(`The following commands are available: + break - Set break point at the entry point of a function, or at a specific file/line. Example: break foo.go:13. + continue - Run until breakpoint or program termination. + step - Single step through program. + next - Step over to next source line. + print $var - Evaluate a variable.`) + + return nil +} func cont(p *proctl.DebuggedProcess, ars ...string) error { err := p.Continue() if err != nil { diff --git a/main.go b/main.go index 6dacf00c..9cc1cd2b 100644 --- a/main.go +++ b/main.go @@ -86,6 +86,7 @@ func main() { } goreadline.LoadHistoryFromFile(historyFile) + fmt.Println("Type 'help' for list of commands.") for { cmdstr, err := t.promptForInput()