du0173 2013-05-31 01:09
浏览 68
已采纳

如何解释堆栈跟踪中的负行号

I made some changes to a fairly large project of mine today, and now I'm getting some odd behavior. Because I'm a knucklehead, I can't go back and figure out what I did.

But the main thrust of my question is how I should understand the negative line number in the stack trace that is printed. The -1218 below is the one that I mean.

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x1 pc=0x80501f2]

goroutine 1 [running]:
server.init()              //     vv-------------RIGHT HERE
    /home/.../debugComponent.go:-1218 +0x282
_/home/.../possessions.init()
    /home/.../possessions.go:29 +0x42
_/home/.../pageWrap.init()
    /home/.../pageWrap.go:112 +0x47

main.init()
    /home/.../main.go:0 +0x3c

goroutine 2 [syscall]:

goroutine 3 [runnable]:

The associated debugComponent.go file is pretty non-essential right now, so I removed it to see what would happen, and the file name just gets replaced with a different one, and a different negative number.

I've had to find plenty of bugs while developing this app, but this one has got me stumped.


If it helps, there's the main.go and then several packages in play. The three files listed above are all different packages, and this seems to be happening during the imports.


I hope you've read this far, because here's the strangest part. If I add this declaration to main.go, the error goes away!

var test = func() int { return 1 }() // Everything is fine now!

Very confusing! It doesn't fix it if I do var test = "foobar". It has to be the invoked func.


Any insight is appreciated, but mostly I'm curious about the -1218 in the trace.


Update

I'm trying to get this down to a small example that reproduces the issue. After working on it I reverted back to my original code, and restarted the machine.

The first time I tried to build and run, two new entries were added to the top of the stack trace. But only the first time.

goroutine 1 [syscall]:
syscall.Syscall()
    /usr/local/go/src/pkg/syscall/asm_linux_386.s:14 +0x5
syscall.Mkdir(0x83a2f18, 0x2, 0x2, 0x806255e, 0x83a2f1c, ...)
    /usr/local/go/src/pkg/syscall/zerrors_linux_386.go:2225 +0x80
server.init()

So this would be in line with my main question about interpreting stack trace. The -1218 is still there, but now there are these.

The asm_linux_386.s has this at line 14:

MOVL    4(SP), AX       // syscall entry

I found the zerrors_linux_386.go too, but there's no line 2225. The file stops long before that line.

  • 写回答

2条回答 默认 最新

  • douwen5246 2013-07-10 09:51
    关注

    It's already reported and accepted as Issue 5243.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100