Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Linux Debugging
Hello,
 
I had created a sample application in c.
For compilation and execution on unix, i created makefile.
I want to debug my c code, when i execute it from Unix.
 
How can I debug my c code on unix platform?
 
Thanks in advance. Blush | :O
Posted 7-Apr-10 22:39pm
Edited 9-Apr-10 8:50am
Moak11.4K
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I would suggest the following:
- Console tool[^]
- GUI tool[^] <- very comfortable Smile | :)
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

As well as Eugen's suggestions, I'd recommend Valgrind[^].
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Nice answers, but Poonamol was asking about Unix, and these are all Linux tools.
Most Unices will include dbx: http://en.wikipedia.org/wiki/Dbx_(debugger)
In some cases you may have to rely on adb: http://en.wikipedia.org/wiki/Absolute_Debugger.
 
Check with the compiler manufacturer. Most compilers will also throw a nice debugger in with the package.
sdb is also an option (C only): http://en.wikipedia.org/wiki/Sdb_(debugger)
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

I am using xlc_r compiler version 8.0 on AIX.
 
To use dbx.
on AIX command prompt I typed:
dbx help
It goes into (dbx) prompt
But after that i do not know what to do to put breakpoints in my program and how to run step by step.
 
Help me out ASAP.
Thanks in advance.
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

you can use a software named gba to debug your program. gba is a useful debuger of c/c++.it can help you to observe the inner structure and the memory of the program.so i suggest you to have a try.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 7

I am not using gcc command to compile code.
 
I had created makefile using cc command.
How can I set the option to enable the dbx?
 
can I pass makefile name to dbx?
 
thanks in advance.
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 8

Hi! It's good that you want to learn the basic debugging tools for the command line (also see tutorial 1[^], tutorial 2[^]), I can only encourage to have some nerdfun and do it! Smile | :)
 
When you develop larger projects you will probably debug from withing the IDE, for example Eclipse. Here are two links that might be interesting:
 
- C/C++ development with the Eclipse Platform[^]
- Accessing gdb with the Eclipse CDT and MI[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

Poonamol wrote:
It goes into (dbx) prompt
But after that i do not know what to do to put breakpoints in my program and how to run step by step.

 
Try to type help in the prompt mode
and see the second example here[^] Smile | :)
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 575
1 Kornfeld Eliyahu Peter 409
2 Maciej Los 369
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,353
1 DamithSL 4,854
2 Maciej Los 4,466
3 Kornfeld Eliyahu Peter 4,058
4 Sergey Alexandrovich Kryukov 3,897


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 9 Apr 2010
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100