Skip to content

Commit

Permalink
runtime: revert "traceback: include pc=0x%x for inline frames"
Browse files Browse the repository at this point in the history
This reverts commit 643d816 (CL 561635).

Reason for revert: This works for telemetry but broke various other
properties of the tracebacks as well as some programs that read
tracebacks. We should figure out a solution that works for all uses,
and in the interim we should not be making telemetry work at the
cost of breaking other, existing valid uses.

See #65761 for details.

Change-Id: I467993ae778887e5bd3cca4c0fb54e9d44802ee1
Reviewed-on: https://go-review.googlesource.com/c/go/+/571797
Auto-Submit: Russ Cox <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Austin Clements <[email protected]>
Reviewed-by: Cherry Mui <[email protected]>
  • Loading branch information
rsc authored and gopherbot committed Mar 14, 2024
1 parent 966609a commit 386dcf4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 269 deletions.
13 changes: 0 additions & 13 deletions src/runtime/crash_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"internal/testenv"
tracev2 "internal/trace/v2"
"io"
"log"
"os"
"os/exec"
"path/filepath"
Expand All @@ -29,19 +28,7 @@ import (

var toRemove []string

const entrypointVar = "RUNTIME_TEST_ENTRYPOINT"

func TestMain(m *testing.M) {
switch entrypoint := os.Getenv(entrypointVar); entrypoint {
case "crash":
crash()
panic("unreachable")
default:
log.Fatalf("invalid %s: %q", entrypointVar, entrypoint)
case "":
// fall through to normal behavior
}

_, coreErrBefore := os.Stat("core")

status := m.Run()
Expand Down
24 changes: 6 additions & 18 deletions src/runtime/traceback.go
Original file line number Diff line number Diff line change
Expand Up @@ -993,24 +993,12 @@ func traceback2(u *unwinder, showRuntime bool, skip, max int) (n, lastN int) {
}
print(")\n")
print("\t", file, ":", line)
// The contract between Callers and CallersFrames uses
// return addresses, which are +1 relative to the CALL
// instruction. Follow that convention.
pc := uf.pc + 1
if !iu.isInlined(uf) && pc > f.entry() {
// Func-relative PCs make no sense for inlined
// frames because there is no actual entry.
print(" +", hex(pc-f.entry()))
}
if gp.m != nil && gp.m.throwing >= throwTypeRuntime && gp == gp.m.curg || level >= 2 {
if !iu.isInlined(uf) {
// The stack information makes no sense for inline frames.
print(" fp=", hex(u.frame.fp), " sp=", hex(u.frame.sp), " pc=", hex(pc))
} else {
// The PC for an inlined frame is a special marker NOP,
// but crash monitoring tools may still parse the PCs
// and feed them to CallersFrames.
print(" pc=", hex(pc))
if !iu.isInlined(uf) {
if u.frame.pc > f.entry() {
print(" +", hex(u.frame.pc-f.entry()))
}
if gp.m != nil && gp.m.throwing >= throwTypeRuntime && gp == gp.m.curg || level >= 2 {
print(" fp=", hex(u.frame.fp), " sp=", hex(u.frame.sp), " pc=", hex(u.frame.pc))
}
}
print("\n")
Expand Down
238 changes: 0 additions & 238 deletions src/runtime/traceback_system_test.go

This file was deleted.

0 comments on commit 386dcf4

Please sign in to comment.