Skip to content

Commit

Permalink
pkg/terminal: Add function name to return tracepoints (#3712)
Browse files Browse the repository at this point in the history
  • Loading branch information
archanaravindar authored Apr 23, 2024
1 parent baf68e0 commit 8c07c98
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions cmd/dlv/dlv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ func TestDAPCmdWithClient(t *testing.T) {
func TestTrace(t *testing.T) {
dlvbin := getDlvBin(t)

expected := []byte("> goroutine(1): main.foo(99, 9801)\n>> goroutine(1): => (9900)\n")
expected := []byte("> goroutine(1): main.foo(99, 9801)\n>> goroutine(1): main.foo => (9900)\n")

fixtures := protest.FindFixturesDir()
cmd := exec.Command(dlvbin, "trace", "--output", filepath.Join(t.TempDir(), "__debug"), filepath.Join(fixtures, "issue573.go"), "foo")
Expand All @@ -920,7 +920,7 @@ func TestTrace(t *testing.T) {
func TestTrace2(t *testing.T) {
dlvbin := getDlvBin(t)

expected := []byte("> goroutine(1): main.callme(2)\n>> goroutine(1): => (4)\n")
expected := []byte("> goroutine(1): main.callme(2)\n>> goroutine(1): main.callme => (4)\n")

fixtures := protest.FindFixturesDir()
cmd := exec.Command(dlvbin, "trace", "--output", filepath.Join(t.TempDir(), "__debug"), filepath.Join(fixtures, "traceprog.go"), "callme")
Expand Down Expand Up @@ -948,7 +948,7 @@ func TestTraceMultipleGoroutines(t *testing.T) {
// I think a future improvement could be to use regexp captures to match the
// goroutine IDs at function entry and exit.
expected := []byte("main.callme(0, \"five\")\n")
expected2 := []byte("=> (0)\n")
expected2 := []byte("main.callme => (0)\n")

fixtures := protest.FindFixturesDir()
cmd := exec.Command(dlvbin, "trace", "--output", filepath.Join(t.TempDir(), "__debug"), filepath.Join(fixtures, "goroutines-trace.go"), "callme")
Expand Down Expand Up @@ -983,7 +983,7 @@ func TestTracePid(t *testing.T) {

dlvbin := getDlvBin(t)

expected := []byte("goroutine(1): main.A()\n>> goroutine(1): => ()\n")
expected := []byte("goroutine(1): main.A()\n>> goroutine(1): main.A => ()\n")

// make process run
fix := protest.BuildFixture("issue2023", 0)
Expand Down
2 changes: 1 addition & 1 deletion pkg/terminal/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -2930,7 +2930,7 @@ func printTracepoint(t *Term, th *api.Thread, bpname string, fn *api.Function, a
for _, v := range th.ReturnValues {
retVals = append(retVals, v.SinglelineString())
}
fmt.Fprintf(t.stdout, ">> goroutine(%d): => (%s)\n", th.GoroutineID, strings.Join(retVals, ","))
fmt.Fprintf(t.stdout, ">> goroutine(%d): %s => (%s)\n", th.GoroutineID, fn.Name(), strings.Join(retVals, ","))
}
if th.Breakpoint.TraceReturn || !hasReturnValue {
if th.BreakpointInfo != nil && th.BreakpointInfo.Stacktrace != nil {
Expand Down

0 comments on commit 8c07c98

Please sign in to comment.