Solved

how to debug

Posted on 2001-07-06
6
221 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
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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 this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now