Launch prog from cli, also exit cleanly

This commit is contained in:
Derek Parker
2014-08-23 08:20:56 -05:00
parent 44dba87c5d
commit 93db6249a0
5 changed files with 184 additions and 28 deletions

View File

@ -5,11 +5,9 @@ package command
import (
"debug/gosym"
"fmt"
"os"
"path/filepath"
"strconv"
"strings"
"syscall"
"github.com/derekparker/dbg/proctl"
)
@ -23,7 +21,6 @@ type Commands struct {
// Returns a Commands struct with default commands defined.
func DebugCommands() *Commands {
cmds := map[string]cmdfunc{
"exit": exitFunc,
"continue": cont,
"next": next,
"break": breakpoint,
@ -66,16 +63,6 @@ func noCmdAvailable(p *proctl.DebuggedProcess, ars ...string) error {
return fmt.Errorf("command not available")
}
func exitFunc(p *proctl.DebuggedProcess, ars ...string) error {
err := syscall.PtraceDetach(p.Pid)
if err != nil {
return err
}
os.Exit(0)
return nil
}
func nullCommand(p *proctl.DebuggedProcess, ars ...string) error {
return nil
}