Do not panic on incorrect command arity

This commit is contained in:
Derek Parker
2014-11-12 17:40:44 -06:00
parent 2f91684e7a
commit 2ea8ff1e74

View File

@ -124,6 +124,10 @@ func next(p *proctl.DebuggedProcess, args ...string) error {
} }
func clear(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 ( var (
fn *gosym.Func fn *gosym.Func
pc uint64 pc uint64
@ -167,6 +171,10 @@ func clear(p *proctl.DebuggedProcess, args ...string) error {
} }
func breakpoint(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 ( var (
fn *gosym.Func fn *gosym.Func
pc uint64 pc uint64
@ -211,7 +219,7 @@ func breakpoint(p *proctl.DebuggedProcess, args ...string) error {
func printVar(p *proctl.DebuggedProcess, args ...string) error { func printVar(p *proctl.DebuggedProcess, args ...string) error {
if len(args) == 0 { 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]) val, err := p.EvalSymbol(args[0])