【发布时间】:2018-03-09 20:46:05
【问题描述】:
我尝试了所有关于安装 gdb 的方法,但仍然无法正常工作。
这是我安装和运行 gdb 的方法:
用
brew install gdb安装gdb-
然后它告诉我执行以下操作
(experiment3.5) ->brew install gdb 正在更新自制... ==> 正在下载https://homebrew.bintray.com/bottles/gdb- 8.0.1.sierra.bottle.tar 已经下载:/Users/Natsume/Library/Caches/Homebrew/gdb- 8.0.1.sierra.bottle.tar.gz ==> 倒 gdb-8.0.1.sierra.bottle.tar.gz ==> 警告 gdb 需要特殊权限才能访问 Mach 端口。 您将需要对二进制文件进行代码签名。有关说明,请参阅:
https://sourceware.org/gdb/wiki/BuildingOnDarwin在 10.12 (Sierra) 或更高版本的 SIP 上,您需要运行以下命令:
echo "set startup-with-shell off" >> ~/.gdbinit 我确实完成了这两个步骤。我按照确切的说明完成了协同设计任务here
- 一切顺利。但是,当我运行以下代码时,我仍然收到相同的错误消息
我跑了gdb python test.py 并收到以下消息
(experiment3.5) ->gdb python signal_test.py
GNU gdb (GDB) 8.0.1
Copyright (C) 2017 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-apple-darwin16.7.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python...
warning: `/Users/travis/miniconda3/conda-bld/python_1494603145199/work/Python-3.5.3/Programs/python.o': can't open to read symbols: No such file or directory.
(no debugging symbols found)...done.
Python Exception <type 'exceptions.ImportError'> No module named libpython:
"/Users/Natsume/Documents/shendusuipian/pytorch/raw_pytorch/60min_intro/signal_test.py" is not a core dump: File format not recognized
- 然后我确实下载了
libpython.py,但我不知道如何处理它。 - 我没有上述警告消息中所述的
/Users/travis/miniconda3/conda-bld/python_1494603145199/work/Python-3.5.3/Programs/python.o'文件夹
更新
我曾尝试关注the steps here,我直接使用通过brew install gdb 下载的gdb8.01.tar.gz,但我收到以下错误消息。
Focus on one: /Users/Natsume/Desktop/src/gdb/8.0.1
->./configure --prefix=$HOME/opt/usr/local
-bash: ./configure: No such file or directory
Focus on one: /Users/Natsume/Desktop/src/gdb/8.0.1
->ls
COPYING README share
ChangeLog bin
INSTALL_RECEIPT.json include
Focus on one: /Users/Natsume/Desktop/src/gdb/8.0.1
->
更新
我从上面的链接运行代码,并安装、配置了 gdb8.0,但是,我没有$HOME/opt/usr/local 的文件夹,而只有/opt/usr/local。所以虽然./configure --prefix=$HOME/opt/usr/local跑通了,但是codesign -f -s "gdb-cert" <gnat_install_prefix>/bin/gdb还是跑不掉,因为没有$HOME/opt/usr/local。
更新
完全按照上面的链接,我可以安装gdb 8.0,但我不能运行gfortran,
(experiment3.5) ->gfortran
-bash: gfortran: command not found
我也不能成功运行gdb python test.py:
(experiment3.5) ->gdb --args python signal_test.py
GNU gdb (GDB) 8.0
Copyright (C) 2017 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-apple-darwin16.7.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python...
warning: `/Users/travis/miniconda3/conda-bld/python_1494603145199/work/Python-3.5.3/Programs/python.o': can't open to read symbols: No such file or directory.
(no debugging symbols found)...done.
Python Exception <type 'exceptions.ImportError'> No module named libpython:
更新
通过this link构建~/.gdbinit可以摆脱No module named libpython的错误解决;但是,警告或更大的问题仍然存在
警告:
/Users/travis/miniconda3/conda-bld/python_1494603145199/work/Python-3.5.3/Programs/python.o': can't open to read symbols: No such file or directory. (no debugging symbols found)...done.
【问题讨论】: