-
Notifications
You must be signed in to change notification settings - Fork 2
问题答疑log‐7:panic:unexpected fault address 0x0
Jakegogo edited this page Jan 17, 2025
·
1 revision
想问下mo### ckerv0.3.7版本,在go1.22环境下跑单测,报的这个错误具体原因是啥呀?
unexpected fault address 0x0
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x80 addr=0x0 pc=0xaba673]
goroutine 16 gp=0xc00032a1c0 m=0 mp=0x11e4fe0 [running]:
runtime.throw({0xc64760?, 0xd43110?})
/root/go/pkg/mod/golang.org/[email protected]/src/runtime/panic.go:1023 +0x5c fp=0xc0000e58b0 sp=0xc0000e5880 pc=0x4479bc
runtime.sigpanic()
/root/go/pkg/mod/golang.org/[email protected]/src/runtime/signal_unix.go:895 +0x1e5 fp=0xc0000e58e0 sp=0xc0000e58b0 pc=0x460d05
git.code.oa.com/goom/mocker/internal/unexports.FindFuncByPtr(0x7f13915bc000)
/root/go/pkg/mod/git.code.oa.com/goom/[email protected]/internal/unexports/unexports.go:74 +0xd3 fp=0xc0000e5968 sp=0xc0000e58e0 pc=0xaba673
git.code.oa.com/goom/mocker/internal/bytecode.PrintInst({0xc669b1, 0x8}, 0x7f13915bc000, 0x1e, 0x5)
/root/go/pkg/mod/git.code.oa.com/goom/[email protected]/internal/bytecode/func.go:88 +0x47 fp=0xc0000e59f8 sp=0xc0000e5968 pc=0xababc7
git.code.oa.com/goom/mocker/internal/iface.MakeMethodCaller(0xcb1c38)
/root/go/pkg/mod/git.code.oa.com/goom/[email protected]/internal/iface/make_method.go:27 +0x85 fp=0xc0000e5a38 sp=0xc0000e59f8 pc=0xac0325
git.code.oa.com/goom/mocker/internal/iface.GenCallableMethod(0xc000013578?, {0xb84580?, 0xcb1c38?}, 0x0?)
/root/go/pkg/mod/git.code.oa.com/goom/[email protected]/internal/iface/make_interface.go:116 +0xdd fp=0xc0000e5a78 sp=0xc0000e5a38 pc=0xac023d
git.code.oa.com/goom/mocker/internal/proxy.Interface({0xb12040, 0xc000273b90}, 0xc000013578, {0xc6375f, 0x2}, {0xb84580, 0xcb1c38}, 0x0)
/root/go/pkg/mod/git.code.oa.com/goom/[email protected]/internal/proxy/interface.go:46 +0x1d1 fp=0xc0000e5bb0 sp=0xc0000e5a78 pc=0xac3071
git.code.oa.com/goom/mocker.(*baseMocker).applyByIFaceMethod(0xc00026e840, 0xc000013578, {0xb12040, 0xc000273b90}, {0xc6375f, 0x2}, {0xb84580, 0xcb1c38}, 0x0)
/root/go/pkg/mod/git.code.oa.com/goom/[email protected]/mocker.go:123 +0x12d fp=0xc0000e5c38 sp=0xc0000e5bb0 pc=0xac60ed
git.code.oa.com/goom/mocker.(*DefaultInterfaceMocker).applyByIFaceMethod(0xc000257ec0, 0xc000013578, {0xb12040, 0xc000273b90}, {0xc6375f, 0x2}, {0xb84580?, 0xcb1c38?}, 0xc000257ec0?)
/root/go/pkg/mod/git.code.oa.com/goom/[email protected]/iface.go:189 +0xa5 fp=0xc0000e5ca8 sp=0xc0000e5c38 pc=0xac5285
git.code.oa.com/goom/mocker.(*DefaultInterfaceMocker).Apply(0xc000013590?, {0xb84580?, 0xcb1c38?})
/root/go/pkg/mod/git.code.oa.com/goom/[email protected]/iface.go:92 +0x49 fp=0xc0000e5d00 sp=0xc0000e5ca8 pc=0xac4b49
git.code.oa.com/ws/co_game/wzry_gamevideo_info/internal/dao.TestUnitGameReportCounter_GetAndSet(0xc000191a00)
升级到最新版本试试看v1.0.4-rc1
主要为了支持打印日志和mock未导出方法,需要获取go的方法名和指针, 采用了一个hack go底层的 方式获取,但是不同版本的runtime.moduledata数据结构会变化。 go1.22之后结构改动比较大,所以出现这个报错
但是1.0.4以上的版本, 切换了实现方式,采用读取符号表(一般结构不会变)。所以后续也不需要每个go版本都做适配了