Ubuntu终端用gdb调试,想试一下刚学到的starti指令,结果显示undefined command
现在,我将使用目标程序位置运行gdb(使用shell替换,“`”,尽管您应该指定完整路径,除非您确定可以使用),并使用核心转储文件:
# gdb `which python` /var/cores/core.python.30520
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
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-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/python...(no debugging symbols found)...done.
warning: core file may not match specified executable file.
[New LWP 30520]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
warning: JITed object file architecture unknown is not compatible with target architecture i386:x86-64.
Core was generated by `python ./cachetop.py'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007f0a37aac40d in doupdate () from /lib/x86_64-linux-gnu/libncursesw.so.5
最后两行特别有趣:它告诉我们这是libncursesw库的doupdate()函数中的分段错误。如果这是一个众所周知的问题,那么值得快速进行网络搜索。我快速浏览了一下,但没有找到一个常见原因。
我已经可以猜出libncursesw是干什么用的,但是如果您不熟悉libncursesw,那么在“ / lib”下并以“ .so。*”结尾表示这是一个共享库,其中可能包含手册页,网站,软件包说明等
# dpkg -l | grep libncursesw
ii libncursesw5:amd64 6.0+20160213-1ubuntu1 amd64
shared libraries for terminal handling (wide character support)
我碰巧正在Ubuntu上调试它,但是Linux发行版对于gdb的使用并不重要。