LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 09-05-2004, 12:40 AM   #1
indian
Member
 
Registered: Aug 2004
Posts: 137

Rep: Reputation: 15
How to use GDB ?


Ok so I am one of those Unlucky souls in this world who knows that there is something like GDB exist but I don't know how to use it.Can anyone please tell me how to use it and what are the advantages of using it ? With Regards...
 
Old 09-05-2004, 01:57 AM   #2
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
It's for debugging runtime problems with programs. The advantages are...it helps you figure out where the problem is in your code. Telling you "how to use it" would take pages of text. It might be best to just dive in and play with it or to search online for one of the many tutorials.
 
Old 09-05-2004, 09:20 AM   #3
phoenix7
Member
 
Registered: Aug 2004
Distribution: Mandrake 10.2(Mandriva), SuSE 9.3, Slackware 9.1, Xandros 3.1, Knoppix 3.9, FreeBSD 5.3, RedHat9
Posts: 122

Rep: Reputation: 15
THE GDB

Hi

gdb is powerfull linux debugger. one of its advantages is that works in text mode.
for debugging your program you can start
Code:
gdb yourprogramname
then in gdb you type
Code:
r
then gdb executes your program
if your program doesn't exit succesfully, running your program is breaked and you can type
Code:
bt
to see call stack
and
Code:
print variablename
to see variables' name.

you can add breakpoints and etc in running your program.
for furhter assistant you can type

Code:
help
in gdb command line or
see it's manual page
Code:
man gdb
Have a time with linux,
Mohammad
 
Old 09-06-2004, 12:52 AM   #4
cppkid
Member
 
Registered: Jul 2004
Location: Pakistan
Distribution: Ubuntu
Posts: 185

Rep: Reputation: 30
Look if you are new to GDB i recommend you to use DDD or because it have the GUI interface for GDB and also provides the console if you want to use it as normal, So that you can explore it yourself as there is button for each operation of GDB. Like if you have to use "step" command there is a button for that and also when you press the buitton otr put some breakpoint you will see that DDD will write the command in the console so you can see how to use GDB.
 
Old 09-06-2004, 05:11 AM   #5
phoenix7
Member
 
Registered: Aug 2004
Distribution: Mandrake 10.2(Mandriva), SuSE 9.3, Slackware 9.1, Xandros 3.1, Knoppix 3.9, FreeBSD 5.3, RedHat9
Posts: 122

Rep: Reputation: 15
Hi
gdb has an advantage that is founded in almost all linux distribution.
and you work with it when you telnet or ssh or you use remote console login.

Have a good times with Linux,
Mohammad
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
gdb sabeel Programming 2 03-26-2007 07:58 PM
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
gdb vose Programming 1 07-17-2004 11:08 PM

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

All times are GMT -5. The time now is 01:41 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