*: Show return values on CLI trace

This patch allows the `trace` CLI subcommand to display return values of
a function. Additionally, it will also display information on where the
function exited, which could also be helpful in determining the path
taken during function execution.

Fixes #388
This commit is contained in:
Derek Parker
2018-10-16 08:49:20 -07:00
committed by Alessandro Arzilli
parent 4db9939845
commit 3129aa7330
12 changed files with 156 additions and 23 deletions

View File

@ -1702,7 +1702,14 @@ func printcontextThread(t *Term, th *api.Thread) {
if th.BreakpointInfo != nil && th.Breakpoint.LoadArgs != nil && *th.Breakpoint.LoadArgs == ShortLoadConfig {
var arg []string
for _, ar := range th.BreakpointInfo.Arguments {
arg = append(arg, ar.SinglelineString())
// For AI compatibility return values are included in the
// argument list. This is a relic of the dark ages when the
// Go debug information did not distinguish between the two.
// Filter them out here instead, so during trace operations
// they are not printed as an argument.
if (ar.Flags & api.VariableArgument) != 0 {
arg = append(arg, ar.SinglelineString())
}
}
args = strings.Join(arg, ", ")
}