系统:
mac osx catalina (10.15.5)
gfortran 9.3.0 (from homebrew)
gdb 9.2 (from homebrew)
我按照以下说明进行了操作:
https://sourceware.org/gdb/wiki/PermissionsDarwin仅仅是为了学习而尝试调试此程序:
! test.f90
program main
integer :: val
val = 1
print *, val
val = 2
print *, val
end program main
使用以下命令进行编译:
gfortran test.f90 -Og -g -o test
然后在终端输入
~/Coding/gdb
> ./test
1
2
~/Coding/gdb $
> gdb test
GNU gdb (GDB) 9.2
Copyright (C) 2020 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-darwin19.4.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 test...
Reading symbols from /Users/a3r7lzz/Coding/gdb/test.dSYM/Contents/Resources/DWARF/test...
(gdb) run
Starting program: /Users/a3r7lzz/Coding/gdb/test
[New Thread 0x1803 of process 3054]
此时没有任何反应...程序卡住了,Ctrl-C也无法结束,必须通过活动监视器(kill gdb)来关闭。想知道我是否在设置上漏掉了什么,或者是否有其他人有任何其他想法,可能是为什么。