Skip to content

Commit 386dcf4

Browse files
rscgopherbot
authored andcommitted
runtime: revert "traceback: include pc=0x%x for inline frames"
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]>
1 parent 966609a commit 386dcf4

File tree

3 files changed

+6
-269
lines changed

3 files changed

+6
-269
lines changed

src/runtime/crash_test.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"internal/testenv"
1515
tracev2 "internal/trace/v2"
1616
"io"
17-
"log"
1817
"os"
1918
"os/exec"
2019
"path/filepath"
@@ -29,19 +28,7 @@ import (
2928

3029
var toRemove []string
3130

32-
const entrypointVar = "RUNTIME_TEST_ENTRYPOINT"
33-
3431
func TestMain(m *testing.M) {
35-
switch entrypoint := os.Getenv(entrypointVar); entrypoint {
36-
case "crash":
37-
crash()
38-
panic("unreachable")
39-
default:
40-
log.Fatalf("invalid %s: %q", entrypointVar, entrypoint)
41-
case "":
42-
// fall through to normal behavior
43-
}
44-
4532
_, coreErrBefore := os.Stat("core")
4633

4734
status := m.Run()

src/runtime/traceback.go

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -993,24 +993,12 @@ func traceback2(u *unwinder, showRuntime bool, skip, max int) (n, lastN int) {
993993
}
994994
print(")\n")
995995
print("\t", file, ":", line)
996-
// The contract between Callers and CallersFrames uses
997-
// return addresses, which are +1 relative to the CALL
998-
// instruction. Follow that convention.
999-
pc := uf.pc + 1
1000-
if !iu.isInlined(uf) && pc > f.entry() {
1001-
// Func-relative PCs make no sense for inlined
1002-
// frames because there is no actual entry.
1003-
print(" +", hex(pc-f.entry()))
1004-
}
1005-
if gp.m != nil && gp.m.throwing >= throwTypeRuntime && gp == gp.m.curg || level >= 2 {
1006-
if !iu.isInlined(uf) {
1007-
// The stack information makes no sense for inline frames.
1008-
print(" fp=", hex(u.frame.fp), " sp=", hex(u.frame.sp), " pc=", hex(pc))
1009-
} else {
1010-
// The PC for an inlined frame is a special marker NOP,
1011-
// but crash monitoring tools may still parse the PCs
1012-
// and feed them to CallersFrames.
1013-
print(" pc=", hex(pc))
996+
if !iu.isInlined(uf) {
997+
if u.frame.pc > f.entry() {
998+
print(" +", hex(u.frame.pc-f.entry()))
999+
}
1000+
if gp.m != nil && gp.m.throwing >= throwTypeRuntime && gp == gp.m.curg || level >= 2 {
1001+
print(" fp=", hex(u.frame.fp), " sp=", hex(u.frame.sp), " pc=", hex(u.frame.pc))
10141002
}
10151003
}
10161004
print("\n")

src/runtime/traceback_system_test.go

Lines changed: 0 additions & 238 deletions
This file was deleted.

0 commit comments

Comments
 (0)