Why am I getting the message "Single-stepping until exit . . . which has no line number information" in GDB?

I've compiled my C program using gcc 4.4.1 using the flag -g, but when I try to step through one of my functions in gdb version 7.0, I get the message:

"Single stepping until exit from function _DictionaryTree_getNodeList, 
which has no line number information."

Can someone tell me why this is happening?


Solution 1:

Just guessing, but is _DictionaryTree_getNodeList in another file that wasn't compiled with -g?

Solution 2:

I had the same problem but in my case adding -g to the compiler wasn't enough so I used -ggdb as suggested by Manav.

Solution 3:

In my case, the problem was version skew between gcc and gdb.

After landing here from search and none of these answers fit my situation, I figured out that (because of aliases / symlinks / Makefile / environment variables) I was accidentally using a newer GCC (4.8.x) and an older GDB (7.2). Stepping up to a newer version of GDB (7.8) fixed the problem. For some reason, using a newer GCC and older GDB didn't work.