From 2ea8ff1e749d44f6c44caaf16d9e9b7d20714a21 Mon Sep 17 00:00:00 2001 From: Derek Parker Date: Wed, 12 Nov 2014 17:40:44 -0600 Subject: [PATCH] Do not panic on incorrect command arity --- command/command.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/command/command.go b/command/command.go index 3f62cfee..6884b6a2 100644 --- a/command/command.go +++ b/command/command.go @@ -124,6 +124,10 @@ func next(p *proctl.DebuggedProcess, args ...string) error { } func clear(p *proctl.DebuggedProcess, args ...string) error { + if len(args) == 0 { + return fmt.Errorf("not enough arguments") + } + var ( fn *gosym.Func pc uint64 @@ -167,6 +171,10 @@ func clear(p *proctl.DebuggedProcess, args ...string) error { } func breakpoint(p *proctl.DebuggedProcess, args ...string) error { + if len(args) == 0 { + return fmt.Errorf("not enough arguments") + } + var ( fn *gosym.Func pc uint64 @@ -211,7 +219,7 @@ func breakpoint(p *proctl.DebuggedProcess, args ...string) error { func printVar(p *proctl.DebuggedProcess, args ...string) error { if len(args) == 0 { - return fmt.Errorf("Not enough arguments to print command") + return fmt.Errorf("not enough arguments") } val, err := p.EvalSymbol(args[0])