gdb won't single step thru the function
I started using gdb and g++ yesterday for the first time. I have been programming in C++ for almost two months now, but on windows platform.
I am trying to debug a C++ program that contains a function with couple of nested loops in it. All I want is to run a single line at a time. I compiled my program with the -g option (g++ -g myprogram). First, I am having a problem making a break point. gdb wouldn't take my line number. I can get around that by specifying the function name. But then...when I 'run', and then 'step' it goes right through my function. What am I doing wrong? Thanks for help. |
its skipping your function? try putting a break point just before hitting the function. are you putting the break point on the function call itself or the function?
|
Never mind. I was just being stupid.
I WENT: g++ myprogram -o output ONCE. THEN I READ SOME POSTS HERE AND REALIZED THE NEED FOR -G OPTION. THEN I GO: g++ -g myprogram, THINKING THAT MY EXECUTABLE GOES TO output WHEN IT ACTUALY GOES TO a.out (BECAUSE I DIDN'T SPECIFY ANYTHING.) SO FOR LAST 3 HOURS I'VE BEEN TRYING TO DEBUGG THE WRONG FILE OVER AND OVER AGAIN. WHAT A LOSER! THANKS FOR THE HELP ANYWAY. |
All times are GMT -5. The time now is 09:34 AM. |