Monday, July 27, 2009

How to trace a C program in fedora or red hat linux platform?

If you want to see all the steps it is trying to do. You can try gdb.





you can also try


strace -o %26lt;someoutputfile%26gt; yourprogram





This will log all the calls the program made into the logfile

How to trace a C program in fedora or red hat linux platform?
GDB is the way! It's a highly powerful tool to trace / debug a gnu C prog!
Reply:1# If you want to use an IDE in Linux then use Kdevelop.


Just go to terminal type kdevelop ( make sure KDE development tools are already installed).





2# For compiling you can use G++ compiler.





3# For debugging GDB (it is a command line debugger).





4# IF you need debugger with GUI then go for "Electric fence", or


" ddd ".
Reply:try to find files with .C extension.
Reply:shweta try this link





http://www.google.co.uk/search?hl=en%26amp;q=t...
Reply:Use "lint" to check your code before you compile your code.





If you need to track down runtime errors, use "gdb" The GNU Debugger and "strace" to trace the system calls and signals. Both have their strengths. You can find more information on these in their man pages (at the prompt type "man gdb" and press enter, then space bar to page down or "q" to quit).





Once you have an idea of where the program is going wrong you can insert commands into your code to print the values of your variables to a log file while it is running and then you will find where your algorithm needs to be corrected or improved.





There are lots of tutorials available for free on the web. It is an excellent resource.





Good luck.


No comments:

Post a Comment