Solved

how to debug

Posted on 2001-07-06
6
228 Views
Last Modified: 2010-04-21
I want to know how to debug a C program in linux platform. Is there anything similar to "Add Watch", as in Turbo C DOS platform, in Linux?
0
Comment
Question by:nglvinod
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 4

Accepted Solution

by:
Robson earned 50 total points
ID: 6258716
Yes there is, and much more. Standard debugger in Linux is gdb (Gnu debugger, command line driven). If it's too hard, try graphical interfaces to it: ddd (Data Display Debugger), xxgdb and many, many more. If you use one of popular Linux distrubution, you've probably already got them.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6259261
.. and don't forget to compile and link with -g option before using *gdb.
0
 
LVL 5

Expert Comment

by:garboua
ID: 6262697
depending on you distribution, and if you have an X server installed, if you do gnorpm you can see all the debuggers installed on your system.  if you are a beginner, I suggest kdbg it is nice easy to use and as stabe as they get. , yeah and don't forget what ahoffmann said about the -g2 option
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:sunsrigod
ID: 6280572
hi,
  if u have a redhat Linux here is how to debug a c program using the gdb debugger.
  step 1: compile ur c program first.( eg., cc -g -o a.out a.c)

  step 2:now u do gdb with the object file created..
         (eg., gdb a.out)
 
  step 3: now u will be in the debugging mode, where u can do many debugging operations...
  if u want to set a break point in a particular position of ur program then u type
    b position_where_break_point_is_to_be_set
  u can set any number of break points like this...
  then to start running the program u have to type
    r - r will start running the program...
  u have to type n to execute the next line of the program..
  if u like to see what is the value of a variable u can use p command. that is,
  p variable_name - will print the value of the variable..
  to quit the debugger use q command.
  to do the previous operation again then just press the return key.
  u can also use the help availble.

regards,
 Sri

 
0
 

Expert Comment

by:denisc
ID: 6614220
Try kdevelop.
You can get it at http://www.kdevelop.org
It is a nice graphical interface, takes care of the dirty work of writing configure scripts, handles CVS and many other useful things. And debugging :o)
0
 

Expert Comment

by:SpideyMod
ID: 8275939
Force Accepted

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question