tag:blogger.com,1999:blog-37798047.post7929634783948617357..comments2024-01-16T05:48:33.523-05:00Comments on Errata Security: C programming: you are teaching it wrongDavid Maynorhttp://www.blogger.com/profile/09921229607193067441noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-37798047.post-47853206703268257492014-03-03T18:35:11.804-05:002014-03-03T18:35:11.804-05:00You may have used an older version of GDB. I have...You may have used an older version of GDB. I have used GDB to debug multithreaded programs. It may not be as pretty as Visual Studio, but GDB is a ton better than some other Unix-based debuggers I've used (I'm looking at you, dbx on Solaris!).<br /><br />I also use the printf() method of debugging. Sometimes, it's just easier to use than trying to get the program running under a debugger (one program at work is both multiprocess *and* multithreaded---don't ask). Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-37798047.post-4924698279583707442014-03-03T07:46:41.753-05:002014-03-03T07:46:41.753-05:00GDB is simply worthless if you are doing multithre...GDB is simply worthless if you are doing multithreading programming.<br />I had this issue multiple times and with several versions of UNIX and Linux; I had to port the code to Windows and use Visual Studio to be able to effectively debug the program.<br />GDB simply isn't capable to switch between threads. It is OK for occasional usage, but simply isn't a professional tool.markoerhttps://www.blogger.com/profile/01980676086540587367noreply@blogger.comtag:blogger.com,1999:blog-37798047.post-8585478782230523092014-03-02T18:28:01.420-05:002014-03-02T18:28:01.420-05:00Been writing in C (as in K&Rs white book) sinc...Been writing in C (as in K&Rs white book) since about 1979, my personal copy came from K himself. Back then most of the tools mentioned were nonexistant and the usual process was write sound and complete code, feed it to the compiler, debug the resulting ASM/MACRO code with the machine language debugger. IF you had errant reads or writes there was no hardware to block it (least not till I got to use the PDP-11s and VAX). About 80% of code I wrote back then ran on Z80, unprotected and constrained. C was close to assembler but more like macro-language. Either way <br />if you could be stupid in ASM, likely to could be twice as stupid in C.<br /><br />Now with computing horse power and good debuggers not knowing whats going on inside is unthinkable, and likely common.<br /><br />Eck!Eck!https://www.blogger.com/profile/13890237094647111653noreply@blogger.comtag:blogger.com,1999:blog-37798047.post-17212211730274388702014-03-01T08:54:13.190-05:002014-03-01T08:54:13.190-05:00My main issue with student's depending on the ...My main issue with student's depending on the debugger very early is that it is hard to teach them that what the debugger is displaying is not trustworthy if you your program has already invoked undefined behaviour (writing off the end of an array, or reading/writing freed memory being the two most obvious candidates).Christopher Jeffersonhttps://www.blogger.com/profile/06970328815431727361noreply@blogger.comtag:blogger.com,1999:blog-37798047.post-42429757740083477532014-02-28T20:25:02.342-05:002014-02-28T20:25:02.342-05:00I am in a systems course where all the students ar...I am in a systems course where all the students are pretty much learning C for the first time (juniors/seniors). It is Spring Break starting today, and we have used no tools at all, except the recommendation of gedit and gcc. We are being taught in lab by a pretty great grad student, the prof has taught no coding. We are learning stuff like the pthread library and solving dining philosophers. You have inspired me to move to loading my C code in a proper IDE. I was somewhat under the impression that was looked at as cheating...mateorhttps://www.blogger.com/profile/12769888265699433431noreply@blogger.comtag:blogger.com,1999:blog-37798047.post-66408894815797899162014-02-28T17:10:50.995-05:002014-02-28T17:10:50.995-05:00MJW: I say GDB is not adequate because the people ...MJW: I say GDB is not adequate because the people avoid it. They use GDB as a the last resort to fix bugs, when they should be using the debugger to step through each line of code as they write the code, even when it works.<br /><br />It's simply my observation: programmers using VisualStudio and XCode frequently step through working code, programmers using GDB don't, and use "printf()" in preference to GDB.Robert Grahamhttps://www.blogger.com/profile/09879238874208877740noreply@blogger.comtag:blogger.com,1999:blog-37798047.post-86889422943208372362014-02-28T11:31:00.532-05:002014-02-28T11:31:00.532-05:00I'm not sure how you decided that GDB is not a...I'm not sure how you decided that GDB is not an adequate debugger. As an undergraduate my programming classes were linux based and gdb was my friend. Having since moved on to security and spending a lot of time in Olly/Immdbg and Windbg I can honestly say that gdb isn't bad and at least it doesn't crash.mjwhttps://www.blogger.com/profile/12812104107276442032noreply@blogger.comtag:blogger.com,1999:blog-37798047.post-41956138500702616212014-02-28T09:49:02.279-05:002014-02-28T09:49:02.279-05:00I've been teaching C for a while and I have dr...I've been teaching C for a while and I have drifted towards similar ideas. <br /><br />My current observation is that to "get" the debugger, the student has to have some overview of the architecture of a computer. So how it currently goes is that some compilation basics are taught; then I go to stack/heap examples with some assembly examples and then to debugging and stack smashing. Then some library stuffirvehttps://www.blogger.com/profile/11521878371836844935noreply@blogger.comtag:blogger.com,1999:blog-37798047.post-45780596842849853142014-02-27T23:14:12.783-05:002014-02-27T23:14:12.783-05:00I would've appreciated taking your "cours...I would've appreciated taking your "course" instead of the one I took instead. My CS program (mid to late 90s) thought -- I think -- it was doing us a service by teaching us C on Unix in an "old school manner. They required us to use vi for our editing. I didn't use a debugger till my senior year, and only then because a grad student showed me. And it wasn't a good one...WThttps://www.blogger.com/profile/09617999503899382119noreply@blogger.com