【求助】请问各位高手我GDB调试go语言程序,怎么看调试信息和代码好像是汇编语言,小弟刚接触go调试,谢谢帮忙回答

jimyokl · · 770 次点击 · 开始浏览    置顶
这是一个创建于 的主题,其中的信息可能已经有所发展或是发生改变。

请问各位高手我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

有疑问加站长微信联系(非本文作者)

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

770 次点击  
加入收藏 微博
4 回复  |  直到 2017-09-05 08:48:23
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传