dowm41315 2014-01-24 03:03
浏览 109
已采纳

为什么gdb输出致命错误?

I am studying to use gdb to debug Go program. The Go version is 1.2, and runs on linux/amd64.

The Go program is very simple:

package main  
import "fmt"
func main(){
    fmt.Printf("hello, world
");
}  

When using gdb to debug it, the gdb output is

$ gdb hello
GNU gdb (GDB) 7.6
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /data2/home/nanxiao/hello...done.
Loading Go Runtime support.
(gdb) start
Temporary breakpoint 1 at 0x400c00: file /data2/home/nanxiao/hello.go, line 3.
Starting program: /data2/home/nanxiao/hello

Temporary breakpoint 1, main.main () at /data2/home/nanxiao/hello.go:3
3       func main(){
(gdb) n
runtime: pc=0x400c13 0xcc 0xeb 0x48 0x83 0xec
fatal error: runtime: misuse of rewindmorestack

runtime stack:
runtime.throw(0x56325f)
    /data2/soft/go/src/pkg/runtime/panic.c:464 +0x69
runtime.rewindmorestack(0xc210001148)
    /data2/soft/go/src/pkg/runtime/sys_x86.c:41 +0xb4
runtime.newstack()
    /data2/soft/go/src/pkg/runtime/stack.c:230 +0x153
runtime.morestack()
    /data2/soft/go/src/pkg/runtime/asm_amd64.s:225 +0x61  

Per my understanding, after running the "n" command, the gdb should go the next statement, and the output is:

fmt.Printf("hello, world
");  

Why does it output the following "fatal error"?

runtime: pc=0x400c13 0xcc 0xeb 0x48 0x83 0xec
fatal error: runtime: misuse of rewindmorestack  

Thanks very much in advance!

  • 写回答

1条回答 默认 最新

  • duandou8457 2014-03-04 23:30
    关注

    It was an issue with version 1.2. It's fixed in version 1.2.1, you can download it from: https://code.google.com/p/go/downloads/list

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#python#的问题:求帮写python代码
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?