Here's what works for me: Set a breakpoint at main (in speller), run
with your arguments. When it breaks, it has loaded all the code you will need to set breakpoints in dictionary. continue
(c
) will then proceed to the next breakpoint, presumably in dictionary. Here's an additional 1000 words.
user@ide50:~/workspace/2015/pset5 $ gdb ./speller
Reading symbols from ./speller...done.
(gdb) break main
Breakpoint 1 at 0x4009f9: file speller.c, line 28.
(gdb) run test.txt test.txt
Starting program: /home/ubuntu/workspace/2015/pset5/speller test.txt test.txt
Breakpoint 1, main (argc=3, argv=0x7fffffffde88)
at speller.c:28
28 if (argc != 2 && argc != 3)
(gdb) break load
Breakpoint 2 at 0x401306: file dictionary.c, line 72.
(gdb) continue
Continuing.
Breakpoint 2, load (fname=0x7fffffffe2c7 "test.txt")
at dictionary.c:72
72 FILE* inptr = fopen(fname,"r");
(gdb)
Just a note about the difference between 'n' and 's' from (gdb) help next
:
Unlike "step", if the current source line calls a subroutine,
this command does not enter the subroutine, but instead steps over
the call, in effect treating it as a single source line.
Happy debugging!