tags:

views:

149

answers:

4

Is there any tutorial about using debuggers, when doing C programming on Linux (console mode)?

+5  A: 

GDB tutorial.

Alex B
That's _NOT_ written by Richard Stallman. It's written by Ryan Schmidt. See http://www.unknownroad.com/rms/index.html .
Yktula
@Yktula Are you saying Wikipedia is wrong? IMPOSSIBLE. But seriously, http://www.gnu.org/philosophy/stallman-kth.html Unless the article on the official GNU site with "stallman" in the link name refers to the wrong RMS. Care to elaborate?
Alex B
I don't know what you're trying to say. I searched for "Stallman" in the page you linked to, and it was only found on the footer in a copyright statement. My comment was accurate.
Yktula
@Yktula Sorry I was not specific enough. In the article I linked he says "I developed a debugger which I called GDB". In your article GDB isn't even mentioned. The only thing I see is the same initials (RMS). So therefore I was curious if I was missing anything.
Alex B
You've linked two articles. If you're referring to the speech in Sweden when you say that RMS (Richard Matthew Stallman) wrote GDB, then I will clarify: I'm not disputing that Stallman was the father of GDB. However, the GDB tutorial that you linked to in your answer was written by Ryan Michael Schmidt, who uses the same initials as Stallman and operates the website that hosts the tutorial (See the link in my first comment - the bio of the real author of the tutorial).
Yktula
@Yktula, OK, I see what you mean now. I didn't bother noticing that your link comes from the same site. Corrected.
Alex B
Thanks. There's a broken link on Schmidt's page to the FSF's manual on GDB. There are also a few other links at the bottom of the page that can be helpful. However, in and of itself, Schmidt's tutorial is concise and merits recommendation.
Yktula
+1  A: 

Do you have a particular debugger in mind, or are you just looking for a general introduction to debuggers?

For Linux debugging, Checkers is almost certainly right, you will be using GDB, and that is a good tutorial (but dont let it stop you from googling ;-) http://www.google.com.sg/search?hl=en&source=hp&q=gdb+tutorial

I don't know how you are developing your code, but I would highly recommend using the Eclipse IDE *use CDT plugin, since you are developing C) - http://www.eclipse.org/cdt/

Eclipse is an excellent free IDE and is practically a de facto standard among professionals. You can edit your code and also step through through it in the debugger Eclipse, but Eclipse also supports many, many other plugins which will be of great use to you:

DoxyGen for documenting your code, Splint for static code analysis, catching problems which the compiler does not, CppUnit for automated testing, BugZilla (etc) for problem reporting, CVS, Subversion, etc, for version control ... you get the picture.

Since we are talking of debuggers, I admit that I can't yet get Eclipse to support DDD, and if you don't know why you want DDD, a picture is worth a thousand words .. http://www.gnu.org/software/ddd/all.png

See that lovely picture in the top pane? If you use pointers and linked structures, then DDD is indispensable, IMO.

Don't forget that arguably the best debugging is not done in the debugger, but in code review, static code analysis (http://www.splint.org/ http://sourceforge.net/apps/mediawiki/cppcheck/index.php?title=Main_Page), etc

Mawg
"Eclipse is an excellent free IDE and is practically a de facto standard among professionals".. Do you have a source for this statement?
Andreas Bonini
For C/C++ that's actually a ridiculous statement. There is no "de facto" IDE.
Makis
I beg to differ, taking "de facto" quite literally. Sure, I understand that Windows guys use MSVC and VxWork guys use the Tornado IDE (though I don't see why ;-)And some are married to Vi and I used to be an acolyte for Emacs.All that I was trying to say is that over the last few years, as I moved around from company to company (consulting), I first noticed a few use Eclipse and now almost all doMaybe I am wrong,but I will say that if you don't have a compelling reason (MFC, GUI development,etc) to use another, then Eclipse is IMO the "best" IDE. Ymmv and, seriously, no offence intended.
Mawg
Probably shouldn't have written that. Makis,I am aware of the dangers of sweeping statements (like "de facto" :-), but it's an honest observation and I do think that Eclipse deserves to be the most widely used IDE. I hope that you use it and like it and just objected to my use of "De facto". Have a nice day.
Mawg
+2  A: 

if you want a GUI then try Nemiver it's very nice GUI for GDB

oops !!! sorry i didn't see you have mentioned console mode. Anyway try GDB.

from console type: info gdb will give you more about gdb

lakshmipathi
A: 

Beej's Quick Guide to GDB. There's also Emacs's GUD interface.

Yktula