I am using GDB to debug my C program.
And since I am handling SIGUSR1
in my program.
So once I run the gdb with my program executable like -
gdb <my_executable>
under the gdb prompt (gdb)
I need to enter -
handle SIGUSR1 nostop noprint pass
since I need to do this every time, I wanted to place this handle
command in the init script.
So after googling, I got to know about the ~/.gdbrc
and ~/.gdbinit
. I tried to place the handle
command in both the files, but still I don't see that handle command is executed once after gdb reads the symbols from the executable.
What could be wrong with this?
Edit: GNU gdb (GDB) 7.2.2
Edit 2: My .gdbrc file content looks like -
echo "hello from gdbrc"
handle SIGUSR1 nostop noprint pass
run 204
Edit 3: Even I tried with GNU gdb (GDB) 8.1.3 Still I'm facing the same issue.
Edit 4: The ~/.gdbrc
and ~/.gdbinit
are given full access permission -
-rwxrwxrwx 1 darshan grp 68 Oct 9 22:14 .gdbint
-rwxrwxrwx 1 darshan grp 67 Oct 9 22:14 .gdbrc
Edit 5: I had named the file wrongly as ".gdbint
" instead of ".gdbinit
".
After renaming, I found with the GDB 8.1.3
, it is being read at the startup. However, with GDB 7.2.2
still I see the problem - .gdbinit
file is not read at the startup.
And ~/.gdbrc
is NOT a right filename to use and won't be recognized by GDB.