how to debug

Posted on 2001-07-06
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?
Question by:nglvinod
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

Accepted Solution

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.
LVL 51

Expert Comment

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

Expert Comment

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
The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.


Expert Comment

ID: 6280572
  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.



Expert Comment

ID: 6614220
Try kdevelop.
You can get it at
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)

Expert Comment

ID: 8275939
Force Accepted

Community Support Moderator @Experts Exchange

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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

623 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