stack command: -full flag prints local variables and arguments of all the functions on the stack trace

This commit is contained in:
aarzilli
2015-09-17 10:42:34 +02:00
parent 6527f15e4d
commit da39258bec
14 changed files with 276 additions and 74 deletions

View File

@ -65,6 +65,26 @@ type Location struct {
Function *Function `json:"function,omitempty"`
}
type Stackframe struct {
Location
Locals []Variable
Arguments []Variable
}
func (frame *Stackframe) Var(name string) *Variable {
for i := range frame.Locals {
if frame.Locals[i].Name == name {
return &frame.Locals[i]
}
}
for i := range frame.Arguments {
if frame.Arguments[i].Name == name {
return &frame.Arguments[i]
}
}
return nil
}
// Function represents thread-scoped function information.
type Function struct {
// Name is the function name.
@ -114,10 +134,10 @@ type DebuggerCommand struct {
// Informations about the current breakpoint
type BreakpointInfo struct {
Stacktrace []Location `json:"stacktrace,omitempty"`
Goroutine *Goroutine `json:"goroutine,omitempty"`
Variables []Variable `json:"variables,omitempty"`
Arguments []Variable `json:"arguments,omitempty"`
Stacktrace []Stackframe `json:"stacktrace,omitempty"`
Goroutine *Goroutine `json:"goroutine,omitempty"`
Variables []Variable `json:"variables,omitempty"`
Arguments []Variable `json:"arguments,omitempty"`
}
type EvalScope struct {