ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi ,
After this question it will be quite clear that I am Linux newbie.
Mostly I worked in Windows using VS 2005 and 08.
So the Microsoft debugger has a deep impact on my mind,I have heard that gdb is also a powerful debugger.
I tried to generate a core file, I know dump is always generated when there is a fault,does it mean a clean program can't be debug?
If no how?
gdb is indeed a powerful debugger. It can be a bit intimidating when used on the command line.
If you're familiar with symbolic debuggers in an IDE (Integrated Development Environment) such as Visual Studio, you'll probably be more comfortable using an IDE in Linux.
The symbolic debuggers integrated into most Linux IDEs are based on gdb.
It would be inappropriate for me to recommend any one IDE over another in this forum ;-) it is certainly a personal choice.
I recommend searching these forums for opinions regarding the available IDEs in addition to doing a web search for other opinions and options.
If you wish to use gdb on the command line, there are excellent guides available (again, look in these forums and elsewhere on the 'net).
You can set a wide range of breakpoints and data examination details in gdb, so the answer to your question is "no, it does not mean that a program that compiles cleanly cannot be debugged".
You just have to decide how you want to go about it.
Just to add to the post from raconteur, whilst and IDE may be teh solution for you there are standalone GUI frontends for gdb, such as cgdb (curses) KDgb (KDE) ddd (gnome) you may want to try these before selecting your IDE of choice, that way you can start to understand gdb.
Really before using gdb you want to compile your code with the -g switch to generate debugging information.
I tried to generate a core file, I know dump is always generated when there is a fault,does it mean a clean program can't be debug?
You can start gdb with a core file using the 'core' command inside gdb.
Or you attach to your running process (compiled with -g) using 'gdb -p <pid>'
I'm not sure what you mean by 'clean program'.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.