LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   gdb won't single step thru the function (https://www.linuxquestions.org/questions/programming-9/gdb-wont-single-step-thru-the-function-239339/)

frankie_DJ 10-06-2004 05:16 AM

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.

Frustin 10-06-2004 05:23 AM

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?

frankie_DJ 10-06-2004 05:50 AM

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.