Merge branch 'bep-patch-1'
diff --git a/errors.go b/errors.go
index 7421f32..8617bee 100644
--- a/errors.go
+++ b/errors.go
@@ -82,7 +82,7 @@
//
// if err, ok := err.(stackTracer); ok {
// for _, f := range err.StackTrace() {
-// fmt.Printf("%+s:%d", f)
+// fmt.Printf("%+s:%d\n", f, f)
// }
// }
//
diff --git a/stack.go b/stack.go
index cb8024b..23321e9 100644
--- a/stack.go
+++ b/stack.go
@@ -11,10 +11,6 @@
// Frame represents a program counter inside a stack frame.
type Frame runtime.Frame
-// pc returns the program counter for this frame;
-// multiple frames may have the same PC value.
-func (f Frame) pc() uintptr { return runtime.Frame(f).PC }
-
// file returns the full path to the file that contains the
// function for this Frame's pc.
func (f Frame) file() string {
@@ -61,7 +57,7 @@
case 'd':
fmt.Fprintf(s, "%d", f.line())
case 'n':
- name := runtime.FuncForPC(f.pc()).Name()
+ name := runtime.Frame(f).Function
io.WriteString(s, funcname(name))
case 'v':
f.Format(s, 's')
diff --git a/stack_test.go b/stack_test.go
index c444be0..975cb1a 100644
--- a/stack_test.go
+++ b/stack_test.go
@@ -10,12 +10,12 @@
type X struct{}
-//go:noinline
+// val returns a Frame pointing to itself.
func (x X) val() Frame {
return caller()
}
-//go:noinline
+// ptr returns a Frame pointing to itself.
func (x *X) ptr() Frame {
return caller()
}