Implement 'trace' subcommand

Allows a user to execute `dlv trace [regexp]` and Delve will execute the
program and output information on functions matching [regexp].
This commit is contained in:
Derek Parker
2015-07-12 15:18:14 -05:00
parent c6ca18ff07
commit 3cee10d8bc
8 changed files with 117 additions and 11 deletions

View File

@ -537,11 +537,19 @@ func printcontext(state *api.DebuggerState) error {
var context []string
fn := ""
var fn *api.Function
if state.CurrentThread.Function != nil {
fn = state.CurrentThread.Function.Name
fn = state.CurrentThread.Function
}
if state.Breakpoint != nil && state.Breakpoint.Tracepoint {
var args []string
for _, arg := range state.CurrentThread.Function.Args {
args = append(args, arg.Value)
}
fmt.Printf("%s(%s) %s:%d\n", fn.Name, strings.Join(args, ", "), state.CurrentThread.File, state.CurrentThread.Line)
} else {
fmt.Printf("%s() %s:%d\n", fn.Name, state.CurrentThread.File, state.CurrentThread.Line)
}
fmt.Printf("current loc: %s %s:%d\n", fn, state.CurrentThread.File, state.CurrentThread.Line)
if state.BreakpointInfo != nil {
bpi := state.BreakpointInfo