mirror of
https://github.com/go-delve/delve.git
synced 2025-10-29 17:56:45 +08:00
proc: Update help for new goroutines flags & minor cleanup
This commit is contained in:
@ -487,7 +487,7 @@ func (dbp *Process) GoroutinesInfo() ([]*G, error) {
|
||||
}
|
||||
g.thread = thread
|
||||
// Prefer actual thread location information.
|
||||
g.Current = *loc
|
||||
g.CurrentLoc = *loc
|
||||
}
|
||||
if g.Status != Gdead {
|
||||
allg = append(allg, g)
|
||||
|
||||
@ -73,7 +73,7 @@ type G struct {
|
||||
Status uint64
|
||||
|
||||
// Information on goroutine location
|
||||
Current Location
|
||||
CurrentLoc Location
|
||||
|
||||
// PC of entry to top-most deferred function.
|
||||
DeferPC uint64
|
||||
@ -291,7 +291,7 @@ func parseG(thread *Thread, gaddr uint64, deref bool) (*G, error) {
|
||||
GoPC: gopc,
|
||||
PC: pc,
|
||||
SP: sp,
|
||||
Current: Location{PC: pc, File: f, Line: l, Fn: fn},
|
||||
CurrentLoc: Location{PC: pc, File: f, Line: l, Fn: fn},
|
||||
WaitReason: waitreason,
|
||||
DeferPC: deferPC,
|
||||
Status: atomicStatus,
|
||||
@ -313,7 +313,7 @@ func (g *G) UserCurrent() Location {
|
||||
if g.thread != nil {
|
||||
regs, err := g.thread.Registers()
|
||||
if err != nil {
|
||||
return g.Current
|
||||
return g.CurrentLoc
|
||||
}
|
||||
pc, sp = regs.PC(), regs.SP()
|
||||
}
|
||||
@ -325,7 +325,7 @@ func (g *G) UserCurrent() Location {
|
||||
return frame.Call
|
||||
}
|
||||
}
|
||||
return g.Current
|
||||
return g.CurrentLoc
|
||||
}
|
||||
|
||||
func (g *G) Go() Location {
|
||||
|
||||
@ -82,9 +82,9 @@ func ConvertFunction(fn *gosym.Func) *Function {
|
||||
func ConvertGoroutine(g *proc.G) *Goroutine {
|
||||
return &Goroutine{
|
||||
ID: g.Id,
|
||||
Current: ConvertLocation(g.Current),
|
||||
UserCurrent: ConvertLocation(g.UserCurrent()),
|
||||
Go: ConvertLocation(g.Go()),
|
||||
CurrentLoc: ConvertLocation(g.CurrentLoc),
|
||||
UserCurrentLoc: ConvertLocation(g.UserCurrent()),
|
||||
GoStatementLoc: ConvertLocation(g.Go()),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -115,11 +115,11 @@ type Goroutine struct {
|
||||
// ID is a unique identifier for the goroutine.
|
||||
ID int `json:"id"`
|
||||
// Current location of the goroutine
|
||||
Current Location
|
||||
CurrentLoc Location `json:"currentLoc"`
|
||||
// Current location of the goroutine, excluding calls inside runtime
|
||||
UserCurrent Location
|
||||
UserCurrentLoc Location `json:"userCurrentLoc"`
|
||||
// Location of the go instruction that started this goroutine
|
||||
Go Location
|
||||
GoStatementLoc Location `json:"goStatementLoc"`
|
||||
}
|
||||
|
||||
// DebuggerCommand is a command which changes the debugger's execution state.
|
||||
|
||||
@ -63,7 +63,7 @@ func DebugCommands(client service.Client) *Commands {
|
||||
{aliases: []string{"thread", "tr"}, cmdFn: thread, helpMsg: "Switch to the specified thread."},
|
||||
{aliases: []string{"clear"}, cmdFn: clear, helpMsg: "Deletes breakpoint."},
|
||||
{aliases: []string{"clearall"}, cmdFn: clearAll, helpMsg: "clearall [<linespec>]. Deletes all breakpoints. If <linespec> is provided, only matching breakpoints will be deleted."},
|
||||
{aliases: []string{"goroutines"}, cmdFn: goroutines, helpMsg: "Print out info for every goroutine."},
|
||||
{aliases: []string{"goroutines"}, cmdFn: goroutines, helpMsg: "goroutines [-u (default: user location)|-r (runtime location)|-g (go statement location)] Print out info for every goroutine."},
|
||||
{aliases: []string{"goroutine"}, cmdFn: goroutine, helpMsg: "Sets current goroutine."},
|
||||
{aliases: []string{"breakpoints", "bp"}, cmdFn: breakpoints, helpMsg: "Print out info for active breakpoints."},
|
||||
{aliases: []string{"print", "p"}, cmdFn: g0f0(printVar), helpMsg: "Evaluate a variable."},
|
||||
@ -414,13 +414,13 @@ func formatGoroutine(g *api.Goroutine, fgl formatGoroutineLoc) string {
|
||||
switch fgl {
|
||||
case fglRuntimeCurrent:
|
||||
locname = "Runtime"
|
||||
loc = g.Current
|
||||
loc = g.CurrentLoc
|
||||
case fglUserCurrent:
|
||||
locname = "User"
|
||||
loc = g.UserCurrent
|
||||
loc = g.UserCurrentLoc
|
||||
case fglGo:
|
||||
locname = "Go"
|
||||
loc = g.Go
|
||||
loc = g.GoStatementLoc
|
||||
}
|
||||
return fmt.Sprintf("%d - %s: %s", g.ID, locname, formatLocation(loc))
|
||||
}
|
||||
@ -428,9 +428,9 @@ func formatGoroutine(g *api.Goroutine, fgl formatGoroutineLoc) string {
|
||||
func writeGoroutineLong(w io.Writer, g *api.Goroutine, prefix string) {
|
||||
fmt.Fprintf(w, "%sGoroutine %d:\n%s\tRuntime: %s\n%s\tUser: %s\n%s\tGo: %s\n",
|
||||
prefix, g.ID,
|
||||
prefix, formatLocation(g.Current),
|
||||
prefix, formatLocation(g.UserCurrent),
|
||||
prefix, formatLocation(g.Go))
|
||||
prefix, formatLocation(g.CurrentLoc),
|
||||
prefix, formatLocation(g.UserCurrentLoc),
|
||||
prefix, formatLocation(g.GoStatementLoc))
|
||||
}
|
||||
|
||||
func restart(t *Term, args ...string) error {
|
||||
|
||||
Reference in New Issue
Block a user