Add 'help' command

This commit is contained in:
Derek Parker
2014-10-20 12:06:36 -05:00
parent 15da4c2e89
commit 09ff60f1ab
2 changed files with 12 additions and 0 deletions

View File

@ -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 {