Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


how to debug

Posted on 2001-07-06
Medium Priority
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 200 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
Quick Start: DOCKER

Sometimes you just need a Quick Start on a topic in order to begin using it.. this is just what you need to know to get up and running with Docker!


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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

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 fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

715 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