delve icon indicating copy to clipboard operation
delve copied to clipboard

call function: fatal error: fault

Open xmx opened this issue 10 months ago • 1 comments

dlv version

$ go version
go version go1.24.0 windows/amd64

$ dlv version
Delve Debugger
Version: 1.24.0
Build: 06b95cdd340b02f3e3a9fe5b42c06467e0462434

main.go :

package main

import (
	"fmt"
	"strings"
)

func main() {
	u := Address{Addr: "127.0.0.1"}
	fmt.Println(u) // line 10
}

type Address struct {
	TLS  bool
	Addr string
}

func (a Address) String() string {
	sb := new(strings.Builder)
	sb.WriteString(a.Addr)
	return sb.String()
}
$ dlv debug
(dlv) break main.go:10
Breakpoint 1 set at 0x21dcba for main.main() D:/mypath/main/main.go:10
(dlv) c
> [Breakpoint 1] main.main() D:/mypath/main/main.go:10 (hits goroutine(1):1 total:1) (PC: 0x21dcba)
     5:         "strings"
     6: )
     7:
     8: func main() {
     9:         u := Address{Addr: "127.0.0.1"}
=>  10:         fmt.Println(u)
    11: }
    12:
    13: type Address struct {
    14:         TLS  bool
    15:         Addr string
(dlv) call u.String()
unexpected fault address 0x418141
> [runtime-fatal-throw] runtime.throw() D:/Programs/go/src/runtime/panic.go:1087 (hits goroutine(7):1 total:1) (PC: 0x1cfac4)
Warning: debugging optimized function
  1082: // Do not remove or change the type signature.
  1083: // See go.dev/issue/67401.
  1084: //
  1085: //go:linkname throw
  1086: //go:nosplit
=>1087: func throw(s string) {
  1088:         // Everything throw does should be recursively nosplit so it
  1089:         // can be called even when it's unsafe to grow the stack.
  1090:         systemstack(func() {
  1091:                 print("fatal error: ")
  1092:                 printindented(s) // logically printpanicval(s), but avoids convTstring write barrier
(dlv)

xmx avatar Feb 27 '25 01:02 xmx

Upstream issue: https://github.com/golang/go/issues/72053

aarzilli avatar Mar 01 '25 14:03 aarzilli

Closing, should be fixed upstream.

aarzilli avatar Sep 02 '25 15:09 aarzilli