*: 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

@ -405,13 +405,13 @@ func (scope *EvalScope) PtrSize() int {
return scope.BinInfo.Arch.PtrSize()
}
// NoGError returned when a G could not be found
// ErrNoGoroutine returned when a G could not be found
// for a specific thread.
type NoGError struct {
type ErrNoGoroutine struct {
tid int
}
func (ng NoGError) Error() string {
func (ng ErrNoGoroutine) Error() string {
return fmt.Sprintf("no G executing on thread %d", ng.tid)
}
@ -433,7 +433,7 @@ func (v *Variable) parseG() (*G, error) {
if thread, ok := mem.(Thread); ok {
id = thread.ThreadID()
}
return nil, NoGError{tid: id}
return nil, ErrNoGoroutine{tid: id}
}
for {
if _, isptr := v.RealType.(*godwarf.PtrType); !isptr {