mirror of
https://github.com/go-delve/delve.git
synced 2025-10-28 04:35:19 +08:00
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:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user