请问各位高手我GDB调试go语言程序,怎么看调试信息和代码好像是汇编语言,小弟刚接触go调试,谢谢帮忙回答
[yanwei@M610-252126 examples]$ go build test.go
[yanwei@M610-252126 examples]$ gdb test
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)
Copyright (C) 2010 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-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/yanwei/redis_go/go/goParseRdbTool/src/github.com/cupcake/rdb/examples/test...done.
warning: File "/home/yanwei/app/go/src/runtime/runtime-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "/usr/share/gdb/auto-load:/usr/lib/debug:/usr/bin/mono-gdb.py".
To enable execution of this file add
add-auto-load-safe-path /home/yanwei/app/go/src/runtime/runtime-gdb.py
line to your configuration file "/home/yanwei/.gdbinit".
To completely disable this security protection add
set auto-load safe-path /
line to your configuration file "/home/yanwei/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual. E.g., run from the shell:
info "(gdb)Auto-loading safe path"
(gdb) set args hash_as_ziplist.rdb
(gdb) start
Temporary breakpoint 1 at 0x454ac0: file /home/yanwei/app/go/src/runtime/rt0_linux_amd64.s, line 73.
Starting program: /home/yanwei/redis_go/go/goParseRdbTool/src/github.com/cupcake/rdb/examples/test hash_as_ziplist.rdb
Temporary breakpoint 1, main () at /home/yanwei/app/go/src/runtime/rt0_linux_amd64.s:73
73 MOVQ $runtime·rt0_go(SB), AX
(gdb)
(gdb) list
68 GLOBL _rt0_amd64_linux_lib_argc<>(SB),NOPTR, $8
69 DATA _rt0_amd64_linux_lib_argv<>(SB)/8, $0
70 GLOBL _rt0_amd64_linux_lib_argv<>(SB),NOPTR, $8
71
72 TEXT main(SB),NOSPLIT,$-8
73 MOVQ $runtime·rt0_go(SB), AX
74 JMP AX
(gdb) next
74 JMP AX
(gdb)
runtime.rt0_go () at /home/yanwei/app/go/src/runtime/asm_amd64.s:12
12 MOVQ DI, AX // argc
(gdb)
13 MOVQ SI, BX // argv
(gdb)
14 SUBQ $(4*8+7), SP // 2args 2auto
(gdb)
runtime.rt0_go () at /home/yanwei/app/go/src/runtime/asm_amd64.s:15
15 ANDQ $~15, SP
更多评论
[GDB调试Go程序](http://blog.studygolang.com/2012/12/gdb%E8%B0%83%E8%AF%95go%E7%A8%8B%E5%BA%8F/)
#1