From d4d4021a419bc8ec6c5fef20d4d89919f45e8a60 Mon Sep 17 00:00:00 2001 From: Derek Parker Date: Sun, 18 Oct 2015 15:02:14 -0700 Subject: [PATCH] proc: Update help for new goroutines flags & minor cleanup --- proc/proc.go | 2 +- proc/variables.go | 8 ++++---- service/api/conversions.go | 8 ++++---- service/api/types.go | 6 +++--- terminal/command.go | 14 +++++++------- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/proc/proc.go b/proc/proc.go index e0e0318b..3e9302cd 100644 --- a/proc/proc.go +++ b/proc/proc.go @@ -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) diff --git a/proc/variables.go b/proc/variables.go index 6afe977f..061aa9b4 100644 --- a/proc/variables.go +++ b/proc/variables.go @@ -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 { diff --git a/service/api/conversions.go b/service/api/conversions.go index d781c760..c66e876a 100644 --- a/service/api/conversions.go +++ b/service/api/conversions.go @@ -81,10 +81,10 @@ func ConvertFunction(fn *gosym.Func) *Function { // convertGoroutine converts an internal Goroutine to an API Goroutine. func ConvertGoroutine(g *proc.G) *Goroutine { return &Goroutine{ - ID: g.Id, - Current: ConvertLocation(g.Current), - UserCurrent: ConvertLocation(g.UserCurrent()), - Go: ConvertLocation(g.Go()), + ID: g.Id, + CurrentLoc: ConvertLocation(g.CurrentLoc), + UserCurrentLoc: ConvertLocation(g.UserCurrent()), + GoStatementLoc: ConvertLocation(g.Go()), } } diff --git a/service/api/types.go b/service/api/types.go index 5c842b89..807e3152 100644 --- a/service/api/types.go +++ b/service/api/types.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. diff --git a/terminal/command.go b/terminal/command.go index 61c3dc5f..4476ef2d 100644 --- a/terminal/command.go +++ b/terminal/command.go @@ -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 []. Deletes all breakpoints. If 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 { -- GitLab