mirror of
https://github.com/go-delve/delve.git
synced 2025-11-02 21:40:22 +08:00
Remove the -proc option and make it the default
This commit is contained in:
@ -33,7 +33,7 @@ The debugger can be launched in three ways:
|
|||||||
* Provide the name of the program you want to debug, and the debugger will launch it for you.
|
* Provide the name of the program you want to debug, and the debugger will launch it for you.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ dlv -proc path/to/program
|
$ dlv path/to/program
|
||||||
```
|
```
|
||||||
|
|
||||||
* Provide the pid of a currently running process, and the debugger will attach and begin the session.
|
* Provide the pid of a currently running process, and the debugger will attach and begin the session.
|
||||||
|
|||||||
@ -33,7 +33,6 @@ func main() {
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
pid int
|
pid int
|
||||||
proc string
|
|
||||||
run bool
|
run bool
|
||||||
printv bool
|
printv bool
|
||||||
err error
|
err error
|
||||||
@ -43,12 +42,11 @@ func main() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
flag.IntVar(&pid, "pid", 0, "Pid of running process to attach to.")
|
flag.IntVar(&pid, "pid", 0, "Pid of running process to attach to.")
|
||||||
flag.StringVar(&proc, "proc", "", "Path to process to run and debug.")
|
|
||||||
flag.BoolVar(&run, "run", false, "Compile program and begin debug session.")
|
flag.BoolVar(&run, "run", false, "Compile program and begin debug session.")
|
||||||
flag.BoolVar(&printv, "v", false, "Print version number and exit.")
|
flag.BoolVar(&printv, "v", false, "Print version number and exit.")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if flag.NFlag() == 0 {
|
if flag.NFlag() == 0 && len(flag.Args()) == 0 {
|
||||||
flag.Usage()
|
flag.Usage()
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
@ -77,8 +75,8 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
die(1, "Could not attach to process:", err)
|
die(1, "Could not attach to process:", err)
|
||||||
}
|
}
|
||||||
case proc != "":
|
default:
|
||||||
dbgproc, err = proctl.Launch(append([]string{proc}, flag.Args()...))
|
dbgproc, err = proctl.Launch(flag.Args())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
die(1, "Could not launch program:", err)
|
die(1, "Could not launch program:", err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user