dongrao9454 2018-01-09 15:03 采纳率: 100%
浏览 5

紧急堆栈跟踪:如何将值映射到函数的参数?

Looking at the last line there ".Number(..."

Is it possible to discern the arguments to the method Number() from those hex numbers?

It would be a help, without hitting the debugger too often.

panic: runtime error: index out of range

goroutine 19 [running]:
testing.tRunner.func1(0xc042046340)
    C:/Go/src/testing/testing.go:622 +0x2a4
panic(0x523e20, 0x5df810)
    C:/Go/src/runtime/panic.go:489 +0x2dd
util.(*NumberEngine).Number(0xc042066150, 0xf4698, 0xa, 0xc042b2a870, 0xa)

edit: including the full signature of method

func (fe *NumberEngine) Number(num int) Number {

edit: including the definition of Number

type Power struct{ Prime, Exp int }
type Number []Power
  • 写回答

1条回答 默认 最新

  • dongying9756 2018-01-09 15:21
    关注

    In the "reference" implementation (that one, dubbed gc and available for download at https://golang.org):

    • The first argument to a method is the method's receiver.

      In your case it's a pointer receiver, so 0xc042066150 is the address of that NumberEngine instance in memory.

    • All the arguments are passed on the stack — from left to right.

      • The fields of compound types such as structs appear in the order they are defined in the type.
      • strings and slices are compound types — of two and three fields each, respectively: pointer + length and pointer + length + capacity.

    For more info, we need the signature of the util.(*NumberEngine).Number method, and the definitions of any custom types it uses, if any.

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在node.js中或者java中给wav格式的音频编码成sil格式呢
  • ¥15 不小心不正规的开发公司导致不给我们y码,
  • ¥15 我的代码无法在vc++中运行呀,错误很多
  • ¥50 求一个win系统下运行的可自动抓取arm64架构deb安装包和其依赖包的软件。
  • ¥60 fail to initialize keyboard hotkeys through kernel.0000000000
  • ¥30 ppOCRLabel导出识别结果失败
  • ¥15 Centos7 / PETGEM
  • ¥15 csmar数据进行spss描述性统计分析
  • ¥15 各位请问平行检验趋势图这样要怎么调整?说标准差差异太大了
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题