system:
mac osx catalina (10.15.5)
gfortran 9.3.0 (from homebrew)
gdb 9.2 (from homebrew)
went through and followed these instructions: https://sourceware.org/gdb/wiki/PermissionsDarwin
trying to debug on this program just to learn:
! test.f90
program main
integer :: val
val = 1
print *, val
val = 2
print *, val
end program main
compile with:
gfortran test.f90 -Og -g -o test
then at the terminal
~/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]
at this point nothing happens... it just hangs and can't kill it with Ctrl-C, I have to go to the activity monitor to kill gdb. Wondering if I have missed something in my setup, or if anyone has any other ideas why this might be
so before using gdb you have to create a ".gdbinit" file in your home directory. Now every time gdb starts it will execute the commands in this file. ".gdbinit" is a file you can drop in your home directory that gdb will parse when gdb launches, either from the command line or from within Xcode.
echo "set startup-with-shell off" >> ~/.gdbinit
run this command and gdb won't hang when you use run command aur r.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With