LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-06-2004, 05:16 AM   #1
frankie_DJ
Member
 
Registered: Sep 2004
Location: NorCal
Distribution: slackware 10.1 comfy, Solaris10 learning
Posts: 232

Rep: Reputation: 32
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.
 
Old 10-06-2004, 05:23 AM   #2
Frustin
Member
 
Registered: May 2002
Location: Essex, UK
Distribution: Debian, Redhat, AIX 5L
Posts: 512

Rep: Reputation: 30
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?
 
Old 10-06-2004, 05:50 AM   #3
frankie_DJ
Member
 
Registered: Sep 2004
Location: NorCal
Distribution: slackware 10.1 comfy, Solaris10 learning
Posts: 232

Original Poster
Rep: Reputation: 32
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
unable to step through function in shared object library using gdb markhod Programming 2 01-03-2009 02:00 AM
normal gdb and spec gdb for kgdb Igor007 Programming 1 09-23-2005 04:15 PM
normal gdb and spec gdb for kgdb Igor007 Linux - Newbie 1 09-23-2005 01:41 PM
gdb .. looking for 32 bit gdb.. for ia64 suse.. nkshirsagar SUSE / openSUSE 0 12-09-2004 03:02 AM
my program does not single step with gdb in kdevelop tcma Linux - Software 0 08-12-2004 04:48 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration