Slashdot Mirror


How Would You Improve Today's Debugging Tools?

redelvis asks: "I recently came across an article by MIT's Media Lab on 'The Debugging Scandal and What to Do About It'. It's a few years old now, but it really got me thinking about how little the debugging process has improved over the last 5,10 or even 30 years. I have developed applications using modern IDE debuggers such as Borland's JBuilder, Microsoft's Visual C++, as well as standard tools like gdb and jdb. Despite the slick graphical interfaces, nice thread stack traces and local variable browsers, I still make sure I have on hand plenty of notepads, graph paper, pens and pencils so I can try to build up a picture of what state the program is in and to help me play detective in pinpointing what is going wrong with my (or other peoples) programs. Do other developers have similar problems? Do they find modern IDEs and debuggers have shortcomings in helping track down bugs? What would make a better debugger? Why do you think so much effort been invested in areas such as advanced modelling tools but so little in improving debugging tools?"

640 comments

  1. Perhaps.... by foxtrot · · Score: 5, Funny

    Why do you think so much effort been invested in areas such as advanced modelling tools but so little in improving debugging tools?

    Easy. As anyone who's ever tried to use software knows, nobody uses debugging tools anyway.

    -JDF

    1. Re:Perhaps.... by Joseph+Vigneau · · Score: 5, Informative
      As anyone who's ever tried to use software knows, nobody uses debugging tools anyway.

      Although I'm guessing your reply was intended as sarcasm, I don't think it's that far from the truth. Debugging is a slow, laborious process. Much of the server-side world doesn't use traditional debugging tools at all- they use small, well defined functions/methods, which are easy to unit test. That, coupled with configurable logging, eliminates many of the scenarios a debugger would be involved in, with the benefit of automation, reproducibility, and defect histories/log files. In my travels, I've seen as developers gain experience, they rely less and less on interactive debuggers, and more on automated testing and configurable logging.

    2. Re:Perhaps.... by L.+VeGas · · Score: 4, Funny

      Agreed, this is pointless.

      Anyone that's ever been buggered knows that you can never be debuggered.

      It's like the old joke:
      Q--What's the difference between Madonna and a lightbulb?
      A--You can unscrew a lightbulb.

    3. Re:Perhaps.... by Y+Ddraig+Goch · · Score: 2, Insightful

      Let's not confuse testing with debugging. Debugging occurs when a program does not function as planned, whether an error is thrown or a bug is found by a testor or client. In a ideal situation all bugs are located and corrected during the testing cycle of the development process. However, testing is an expensive and time consuming process and a great number of companies settle for finding the big and obvious problems.

      --
      Meddle thou not in the affairs of Dragons, for thou art crunchy and with most anything.
    4. Re:Perhaps.... by cheeseSource · · Score: 1

      Those aren't bugs. Those are Features!!

      --
      (Sponsored by cheeseSource for President 2012)
    5. Re:Perhaps.... by Titusdot+Groan · · Score: 5, Interesting
      I found that as I started using OO languages and techniques (Objective C and Java + MVC and Design Patterns) I almost stopped using debuggers. I almost always know exactly where the bug is as soon as I see the behaviour and can find it by inspection in a few seconds.

      This is also experienced based -- as I get older I use debuggers less and less but my code output has remained constant or improved (even though I don't put in all nighters any more :-)

      I'm finding it really hard to get excited by the fact that there is no effort being put into debuggers where as 10 years ago it would have been a big deal.

      Perhaps that's also part of the problem -- when I evaluate tools etc. I don't spend a lot of time looking at the debugger these days ...

    6. Re:Perhaps.... by Shamanin · · Score: 4, Insightful

      "Much of the server-side world doesn't use traditional debugging tools at all- they use small, well defined functions/methods, which are easy to unit test."

      Well, when you combine enough of your small functions/methods together into one big monolith of a program problems tend to surface. What then?

      Even when using some fully tested COTS library to solve all of your problems the programmer WILL run into integration issues due to unintended use or misunderstanding.

      "I've seen as developers gain experience, they rely less and less on interactive debuggers, and more on automated testing and configurable logging."

      I have been coding for over two decades and have yet to see a reason to abandon debugger use. It is essential, like an x-ray / CT-scan / ultrasound is to a surgeon. Black box and even white box testing will only tell you so much. Sometimes you need to see the cogs in motion.

      --
      come on fhqwhgads
    7. Re:Perhaps.... by gorilla · · Score: 3, Insightful
      Testing and debugging are two seperate activites, and it's important not to try to confuse them.

      Testing is to identify if there is a problem, and hopefully under what conditions they will occur. Debugging is to identify the cause of that problem, and what needs to be done to fix it. One is most definatly not a replacement for the other.

    8. Re:Perhaps.... by jarober61 · · Score: 1

      It all depends on the tools you use. I've been using Smalltalk for 10 years now. I've not once had to whip out paper and pencil to ponder application state; it's right there. In fact, the application isn't dead, it's still running. can change code, either in the debugger or in the code browsers, back up, and start over from any point in the stack. I can set breakpoints, watchpoints, or just interrupt the code. In Smallalk, debugging is actuallt part of development. It's quite common to execute code you know will break in order to get into the debugger and examine running state. Perhaps if the C language designers actually tried to learn from things Lisp and Smalltalk systems did 20 years ago, you wouldn't have o complain. In the meantime, I'll simply enjoy the higher level of productivity...

      --
      Talk Small and Carry a Big Class Library
    9. Re:Perhaps.... by GreyPoopon · · Score: 2
      I have been coding for over two decades and have yet to see a reason to abandon debugger use.

      I stopped relying on debugging tools about 12 years ago when I ran into a bug that disappeared everytime I ran the program in the debugging environment. Yeah, it was "C" and yeah, I was shooting myself in the foot with a pointer. At that time, printf became my best friend. Since then, I've worked in many environments that have no debugging tools whatsoever, so I've had to get creative with debugging output to find problems. I still use a debugger as my first crack at finding a problem, but I'm always ready to add some code to track what's going on in the program.

      --

      GreyPoopon
      --
      Why is it I can write insightful comments but can't come up with a clever signature?

    10. Re:Perhaps.... by GreyPoopon · · Score: 1
      Perhaps if the C language designers actually tried to learn from things Lisp and Smalltalk systems did 20 years ago...

      Smalltalk is interpreted, whereas C normally isn't. One of the powers of interpreted languages is the ability to easily add much more flexible debugging tools. Sure, you could create a debugging environment for C that had similar functionality, but you'd then be running your program on a completely different "platform" from that without a debugger. Along a similar line, I've seen many cases where a compiler was used to turn code in a normally interpreted language into machine code. Frequently, programs that ran just fine through the interpreter had serious problems in the compiled version. It ends up that there were bugs in the program that just didn't show up in the interpreter.

      --

      GreyPoopon
      --
      Why is it I can write insightful comments but can't come up with a clever signature?

    11. Re:Perhaps.... by dubl-u · · Score: 4, Interesting

      Well, when you combine enough of your small functions/methods together into one big monolith of a program problems tend to surface. What then?

      Then you haven't written enough tests. Or you're trying to integrate too much at once.

      If you do test-first development and continuous integration (backed up with good black-box integration testing), then the number of bugs you get should be low. In my experience, that's circa one shipped bug per man-month.

      If I run all the tests frequently as I develop and check in often, I rarely need a debugger. If I break a test, I generally know exactly what the problem is.

      If I forget to run all the tests and check in, then the automated build box will send me email promptly, so it's still pretty easy to find the problem.

      It is essential, like an x-ray / CT-scan / ultrasound is to a surgeon.

      Note that the only time you see a surgeon is when something is pretty seriously wrong. Isn't it much better to make sure that things don't go so far wrong that a surgeon is necessary?

    12. Re:Perhaps.... by Joseph+Vigneau · · Score: 2
      Well, when you combine enough of your small functions/methods together into one big monolith of a program problems tend to surface. What then?

      You write tests to encompass these larger pieces of functionality. In general, debuggers are usually used at the lowest levels: checking variables and references, and sometimes as far as processor registers. At higher levels of abstraction, the debugger becomes less useful, as you're generally not looking for null pointers and the like.

      When unit testing, once you identify a bug, you write a test case that fails, that you would otherwise expect would pass. Fix the bug such that the test passes, and repeat. This works pretty well in the real world, and the proliferation of unit testing tools (both free (JUnit, CppUnit) and commercial (Parasoft)) is a testament to the usefulness of this technique. Many professional developers I work with haven't dusted off the debugger in years...

      [I] have yet to see a reason to abandon debugger use.

      I'm not advocating abandoning debugger use, if you find it truly productive. However, over the course of a project I spend less time writing unit tests than I would if I had to fiddle with a debugger.

      Sometimes you need to see the cogs in motion.

      And this is where configurable logging comes in. It's an automatic process. It's also a lot less painstaking than remembering what watchpoints and breakpoints you had to use when you saw this bug happen last week while fixing somethig else.

    13. Re:Perhaps.... by ba_hiker · · Score: 1

      There are many reasons for this, from a lack of study to inattention on the part of programers. Another reason is change. Code changes unexpected ways and breaks other things. Then there is lack of testing and inadaquate unit test facilites. Or the failure to use these often enough when things change.

      One problem is that IDEs and debuggers are good tools, and often the only one provided with compilers, so we use them. They are not the only kind of tool available. They are not the best tool for all bugs either.

      Other kinds of tools are available, usefull and ignored. Code coverage tools, built in trace facilities and other tools are useful in creating programs with few errors.

      Another issues is that we (as programmers) design fragile facilities. When other things change, these produce wrong results, that show as bugs much latter. Where I work we use raw use counts in several places. Bugs in the code that uses this are very hard to find. With a little thinking this can be made much more robust, and easier to debug.

      This is just an example and there are many other similar opertunities. Opertunities tomake the code more robust and to catch its own errors. Many conventional C/C++ facilities suffer from this. Malloc is a common example, are are points, and other things.

      here are also systemantic issues with the code/ runtime enviornment in various languages. These are large for c/c++ programmers, were these languages make it easy to damage the runtime enviornment. Other languages like Java and basic make it harder.

      In any case, developeres can put defensive features arround the fragil facilities to improve debugging and reliability. These all cost execution time and memory, but as the original poster mentioned, these are more available. IN any case properly designed facilites and dissapear or reduce in production versions.

      Another problem is knowing when and what to test. You can test forever and still have buggy code, if you dont do the right tests. Testing the right code and the right cases is a whole problem in its self. How do you know that you test plan is adaquate? Coverage analysis is a good start, but few developers use it.

    14. Re:Perhaps.... by John+Wharfin · · Score: 4, Insightful

      Agreed. Since changing from C to Java several years ago I find that I never use debuggers anymore, relying instead on verbose logging to understand what my program is doing. I think in C debuggers help more because you can abuse memory in various ways that you don't need to worry about so much in Java. With a debugger it is really easy to see yourself walk off the end of an array, for example. I also observe that my peers who rely strictly on debuggers don't tend to do much logging. So when their software is in production they are mystified when it acts up. I also notice that they don't comment as verbosely either but I can't prove that's because they use a debugger. Maybe they wouldn't comment anyway.

    15. Re:Perhaps.... by __past__ · · Score: 3, Insightful
      I can't speak for smalltalk, but Lisp usually is compiled to native code these days, yet it still has a cool debugging environment, with the full language and program state available and ready to be tweaked. Some Lisps, for example the free CMUCL, even tend be able to give you the source of a form that caused the problem, right next to the asm listing of a compiled function.

      "Interpreted" is not the same as "dynamic". You can have both speed and a productive environment.

    16. Re:Perhaps.... by Anonymous Coward · · Score: 1, Funny

      Nothing has improved in debugging hardware and software since Grace Hopper yanked an electrocuted moth from a stuck relay in a UNIVAC 1.

    17. Re:Perhaps.... by GreyPoopon · · Score: 1

      ...but Lisp usually is compiled to native code these days, yet it still has a cool debugging environment... Not being a Lisp programmer, I'm completely ignorant of the modern state of Lisp. My question on this one is, does the debugging environment get compiled into every Lisp program? If so, you can expect all kinds of advanced debugging features, but also a large executable size. If not, you may find that programs that fail under normal operation run just fine within the debugger. Of course, the Lisp syntax probably makes it much more difficult for these types of "glitches" to occur.

      --

      GreyPoopon
      --
      Why is it I can write insightful comments but can't come up with a clever signature?

    18. Re:Perhaps.... by indian_robyn · · Score: 1

      In the server side world, configurable logging combined with debugging tools has been the best for me. The debugger in Eclipse is pretty good at this. Combined with log4j, it makes a really nifty tool.

    19. Re:Perhaps.... by Shamanin · · Score: 2

      "I ran into a bug that disappeared everytime I ran the program in the debugging environment. Yeah, it was "C" and yeah, I was shooting myself in the foot with a pointer"

      Well, then the debugger was your greatest utility to identifying this stray pointer.

      --
      come on fhqwhgads
    20. Re:Perhaps.... by __past__ · · Score: 4, Informative
      Given that functions like "invoke-debugger" are part of the Common Lisp standard and hence every program can expect to be able to call them whenever it feels like it (although not much about how the debugger is supposed to work is standardized, for obvious reasons), yes, it usually ships with a Lisp app.

      The standard image shipped with CMUCL is about 20 MB on my FreeBSD box. This contains the whole standard library, including the compiler, debugger, profiling and tracing tools, embedded documentation (docstrings attached to functions/variables available programatically, like Python also has now) etc. To that, you add your own code, either as external libraries that get linked at runtime or integrated in the image - you load everything you wrote in a running image, both code and possibly data, and dump its state, so you don't have to re-load it on startup.

      It is possible to get rid of functionality, but I doubt it's frequently used. 20 MB for the runtime system are not too much, compare for example with a Java runtime environment (or a basic Unix system, that could be regarded as Cs runtime).

      Some commercial Lisps, for example Allegro Common Lisp support a more "conventional" way of delivering apps, as standard executables without the need for a runtime. Given that Franz charges higher license fees if you want to include the compiler/debugger in your app, I guess there is a way in ACL to get smaller executables.

      Yet another option is compiling to C, and use standard OS tools like GCC for the final step. Gnu CL and Embeddable CL support this. There is still less difference between the development/production environment than one would think: They also use plain .a/.so libraries to load compiled lisp code when you work interactively.

    21. Re:Perhaps.... by Shamanin · · Score: 3, Interesting

      "Note that the only time you see a surgeon is when something is pretty seriously wrong. Isn't it much better to make sure that things don't go so far wrong that a surgeon is necessary?"

      I would call a bug a serious problem. I made no statement about abandoning unit and integration testing, only that the utility of a debugger is essential for the development process. And, to be precise, I should have said a radiologist rather than a surgeon since this would be a pre-screening before any manipulation is done to the body, I mean code.

      --
      come on fhqwhgads
    22. Re:Perhaps.... by Mannerism · · Score: 2

      Testing and debugging are two seperate activites, and it's important not to try to confuse them.

      I think the two activities are converging. Tools like junit and methodologies like XP are extending testing to the point that when you want to find out what caused a bug, you might consider building tests instead of stepping through your code and watching variables. The resulting test then becomes not only a tool for debugging, but a tool for proactively detecting the bug again should you make a code change that would cause it to resurface.

    23. Re:Perhaps.... by Shamanin · · Score: 2

      "And this is where configurable logging comes in."

      What about when logging is not feasible due such as in some embedded realtime systems? Attaching to target with a debugger is sometimes your only scope into the device.

      On one project I am on, we have no console or flash to printf to. But, using a JTAG device and a gdb server, I am able to step the code and check memory, variables, etc.

      --
      come on fhqwhgads
    24. Re:Perhaps.... by charvolant · · Score: 1
      Smalltalk is interpreted, whereas C normally isn't.

      Smalltalk uses a JIT. The development environment automagically converts between raw instructions/stack frames/contexts and a object-based representation that debuggers and other introspective code can use. Once inspected/modified it can convert back to raw form.

      To a certain extent, C debuggers have the same capabilities, since something like gdb can print you a pretty symbolic stack trace when you type in "where". It must be able to decode the stack. So -- presumably with a few modifications to the way stack frames are handled and with additional information, such as local variable names and types, supplied to the debugger -- there's no particular reason why C development environments can't have the same functionality. It's just that, traditionally, that's not the way things have been done.

      There is a common class of pointer errors in C. There are a number of other tools that can help with memory leaks and rogue pointers. I don't see why a sufficiently sophisitcated debugger can't include that functionality, particularly if you could get more meaningful access to instrumentation from the source code. But, if you're writing application programs at least, you should probably have a good think about why you're choosing to write them in a glorified assembly language intended for systems programming in the first place.

    25. Re:Perhaps.... by OneEyedApe · · Score: 1

      printf() debugging is a time honored tradition, and my prefered method of debugging.

      --
      Life sucks, but death doesn't put out at all....
      --Thomas J. Kopp
    26. Re:Perhaps.... by netsharc · · Score: 2

      I think he meant: when the program was running with a debugger watching it, the bug doesn't show up. It only shows up when the program is run without a debugger.

      Hehe, like the bug that goes away when the tech guy shows up to see about it.

      --
      What time is it/will be over there? Check with my iPhone app!
    27. Re:Perhaps.... by jarober61 · · Score: 1

      No, Smallalk is not interpreted. Like Java (which copied the idea from Smalltalk and Lisp), Smalltalk is implemented on a VM, and runs with a JIT (Just in Time Compiler). This has been the case for well over a decade. It seems to be another area of widespread misunderstanding of Smalltalk. And btw, Smalltalk runs on a JIT in both development and deployment, so there are no runtime surprises.

      --
      Talk Small and Carry a Big Class Library
    28. Re:Perhaps.... by Shamanin · · Score: 2

      I know, but by noticing that the problem only occured when the debugger was attached indicated a memory violation of some sort.

      --
      come on fhqwhgads
    29. Re:Perhaps.... by gli · · Score: 1

      My belief is you should use debuggers, but shouldn't rely on it too much. I tend to read over the code again and again before finally step into the program execution. The biggest help of debuggers is they let you discover your blind spot in your logic, by showing what the program is really doing. If your logic is accurate, other than a few typos the program should run as you expect, and you can predict the program's behavior even without printfs or tracing into it. By debugging over mind logic first you're training yourself for clearer and more accurate thinking, which will make you a programmer.

      Relying too much on debuggers tend to make me mind-lazy. I let the debugger lead me to the problem rather than actively find it myself. Thus I focus less on constructing a clear mental image of the program logic but more on a particular bug. This, IMO is a symptom of being spoiled by good tools. It's the same as people writing unnecessarily inefficient code because CPUs are becoming faster. Tools don't make a good programmer, it's the mind that matters.

    30. Re:Perhaps.... by LonelyKindGuy · · Score: 1

      Partially true, but for our server side product we use the Rational tools purify and quantify. Purify can help identifying all kinds of memory errors. It does this by instrumenting your executable image and you then run the resultant executable. Its found some pretty subtle things, pointer errors, array bounds errors, freed memory usage, etc. I think its one invaluable debugging tool. Quantify is a profiler that can help you identify where your code is spending its time. Its interface is more 1980-ish and procedural oriented, but it works. A better profiler is to be found for Java in OptimizeIt! (now a Borland product), which also shows when individual threads are sleeping and running. How I wish Quantify would map that out. Profiling may be somewhat different than debugging, but in both cases you're getting information about your program. I think debuggers would be better if they took the purify approach of building a debuggable executable that you run as you do your non-debug program, then emit log information of problems as its running. We need more of that in the software developer world.

    31. Re:Perhaps.... by giel · · Score: 4, Informative

      I prefer verbose logging too. I've been working with WebSphere Application Developer during the last year and I've never used the debugger. However verbose logging - IMHO - should be considered as a form of debugging too. Sure, it's not the boring act of step-by-step stumbling through control structures and loops glaring at a huge set off watches, but instead it focuses on what is important in a certain context (if logging is done properly) and is works much faster, because the result simply stays in the form of a log which one can take all the time needed to examine.

      An important pro of verbose logging to traditional debugging is that proper log statements preferably combined with assertions which validate the state of an object at runtime also provide very usefull documentation of a program. The remaining contra is extra code slowing down execution, even dramatically depending on the log format (imagine the time needed to format date/time information for each 5 or so lines of code).

      Comes to my mind the fact that object oriented languages use runtime linkage for virtual methods at great scale. Hence it should be possible to keep two versions of code, one containing debugging code and one that has been cleaned - eg. by a modified class loader for example, whic removes all calls to a classes from a certain package. This should enable switching at runtime from a clean non-logging version to a logging-version, if a certain condition is met. For example during a suspicious error, or simply a flag a user can set at the moment he or she detects a bug. This means that even production versions of software could be equiped with shiploads of logging possibilities having nearly no affection at all to their execution speed.

      --
      giel.y contains 2 shift/reduce conflicts
    32. Re:Perhaps.... by Argon · · Score: 1

      Agreed. But with one difference. I don't use debuggers in Java because Java debuggers are pathetic. jdb is hopeless, the gui debuggers that I used are slow and buggy. Now gdb is good. It is excellent and coupled with emacs it's more than enough for any debugging required with C code. It has an excellent interface, supports threads, watchpoints etc well.

      Ganesan

    33. Re:Perhaps.... by Directrix1 · · Score: 2, Funny

      Well, you can always program using predicate calculus and get error free code from the start. Weeee!

      --
      Occam's razor is the blind faith in the natural selection of least resistance and in universal oversimplification. -- EF
    34. Re:Perhaps.... by scrytch · · Score: 2

      Better known as a heisenbug. Race conditions are notorious for being heisenbugs...

      --
      I've finally had it: until slashdot gets article moderation, I am not coming back.
    35. Re:Perhaps.... by giel · · Score: 2

      That's is exactly why good developers prefer verbose logging instead of debugging.

      If verbose logging is applied in a smart way, errors will show up in such a way you will be able to see where and why the code fails. Then it's up to the developer to find out if either te predicates are wrong or the context to which they apply fails...

      eg. Given this:
      [True] S(); [False]

      It can't get any better, can it? For any X and Y the pre and post conditions apply: X => True and False => Y

      So for any X and Y the following: [X] S(); [Y] is valid.

      But what IF the S() crashes, it does not even reach the post condition? How are you going to find out why?

      Hmm. Well. Perhaps this is a far too complicated subject to discuss over here... Besides it was years ago when I learned to program using predicate logics.

      --
      giel.y contains 2 shift/reduce conflicts
    36. Re:Perhaps.... by Directrix1 · · Score: 1

      Same here.

      --
      Occam's razor is the blind faith in the natural selection of least resistance and in universal oversimplification. -- EF
    37. Re:Perhaps.... by lsdino · · Score: 2, Insightful

      That's is exactly why good developers prefer verbose logging instead of debugging.

      If verbose logging is applied in a smart way, errors will show up in such a way you will be able to see where and why the code fails. Then it's up to the developer to find out if either te predicates are wrong or the context to which they apply fails...
      (emphasis added)

      That's ridiculous! I'd say that good developers use both. And they also use assertions.

      Logging gives you a picture of your program over time. It's a great tool and can help find bugs that are otherwise difficult. You can watch states change, and see method calls, from your hand picked logging statements.

      On the other hand a debugger gives you an instant snapshot of your program, and allows you to inspect the state in detail. Again, another great tool.

      Logging's greatest weakness is it requires an edit-compile cycle to get new messages in. And it's real easy to end up not having messages in the right spots or not displaying enough information (or the right information).

      Whereas with a debugger you can load the program up, set a break point, run, and then step through and see what's happening. No edit, no compile, you're just there. But it's greatest weakness is watching the program state change over a long time.

      So they're both great tools and are good for different things. Good programmers know how to use the tools that are available to them.

    38. Re:Perhaps.... by canadian_right · · Score: 2

      This can also indicate an over zealous optimizer. Generally, the debug build turns of optimizations.

      --
      Anarchists never rule
    39. Re:Perhaps.... by agedman · · Score: 1

      I too use verbose logging as a debugging tool, so I'm curious if anyone has any interesting thoughts on how to do it efficiently.

      In Java, I used AspectJ ( http://www.eclipse.org/aspectj/ ) to instrument my code without modifying it.

      Plus, I try to have my log file in XML format so that I can do different filtering / displaying things to help look for the interesting bits.

      Does anyone have anything other than "Dump everything and use a good wild-card search editor"?

    40. Re:Perhaps.... by refactored · · Score: 2
      Not really.

      You have a bug, what should you do next....

      Write a unit test that triggers the bug. This has two uses....

      1. It allows you to compile/link/debug fast! No long setup times to debug.
      2. It gaurantees that the bug won't silently reappear later.

      How should you fix a bug? Refactor until the code is so simple, that the bug is obvious. Then remove the bug.

      But to refactor safely you need a good suite of unit tests.

      No testing, and debugging are not that far apart...

    41. Re:Perhaps.... by BrittPark · · Score: 1
      Then you haven't written enough tests. Or you're trying to integrate too much at once.

      If you do test-first development [c2.com] and continuous integration [c2.com] (backed up with good black-box integration testing), then the number of bugs you get should be low. In my experience, that's circa one shipped bug per man-month.

      In theory methodologies like this are good. In practice (at least in a startup environment) developers simply don't have time to follow such practice. Yes, you have time to write unit tests for certain complex and central objects but not for everything. You also have time to write (for servers) stress and functionality test clients. In general you just have to rely on smart programmers and frequent code reviews.

    42. Re:Perhaps.... by Anonymous Coward · · Score: 0

      You can print internally to a buffer (something like using sprintf(), if that is supported on your platform) and dump this buffer to your PC later.

    43. Re:Perhaps.... by dubl-u · · Score: 2

      In theory methodologies like this are good. In practice (at least in a startup environment) developers simply don't have time to follow such practice.

      In a startup environment, everything you do will have far-reaching effects in the future. In a startup environment, it's much harder to predict where your company will go, as both investors and your customers will pull you in new directions. In a startup environment, people will be promoted so quickly that you can't assume that in three months they'll be around to support (or even explain) the code they're written. In a startup environment, missing a deadline or delivering buggy software an be fatal.

      More directly: in a startup environment, you don't have time to do it in a half-assed way. Ergo, you should plan to do it right from the beginning.

      And yes, I've just done this in yet another balls-to-the-wall, full-on-stealth-mode startup. The only thing the CEO regrets is that we didn't make him do it better.

    44. Re:Perhaps.... by BlackHawk-666 · · Score: 1

      When you're writing server software then logging is essential and it stays in, even in release code. I write systems that need to function 24/7 and are deployed on servers where having a debugger is strictly forbidden (no compilers or other uneccessary tools). I log all important actions to plain text files, and all exceptions to the event log (and the plain text files) with the class and line of code that raised the exception. This allows me to determine what when wrong in a production system, even days after the fact. It's absolutely vital to the long term health of those systems.

      Conversely, debugging is brilliant at the write and unit test stages. Stepping into the code and ensuring it does what you thought it should can be illuminating. However, I still see these debuggers as a crutch and prefer to read and model the code in my head prior to firing up a debugger.

      Each technique has their place...horses for courses.

      --
      All those moments will be lost in time, like tears in rain.
    45. Re:Perhaps.... by jimfrost · · Score: 2
      Since changing from C to Java several years ago I find that I never use debuggers anymore

      How much of that is because you wouldn't find it useful, versus the fact that there really haven't been any good Java debuggers?

      With program restarts in our Java applications into the ten-plus minute range, a debugger would be a serious time saver versus adding log or println entries.

      I note that with JDK 1.4 the JVM debug interfaces are finally good enough to actually make a working debugger, which will help things a lot.

      --
      jim frost
      jimf@frostbytes.com
    46. Re:Perhaps.... by jimfrost · · Score: 2
      Then you haven't written enough tests. Or you're trying to integrate too much at once.

      Must be nice to work in a world where you have time to write comprehensive supra-unit tests and can rely on all your co-workers to have fully tested their code.

      I'd like to visit that world sometime, because in my world schedules are allocated such that it's rare you have time to do more than just unit testing and they call integrated testing "beta".

      I'm only half joking. Then again, our problem domain scale is probably offset by a couple of orders of magnitude and that will certainly make a difference.

      --
      jim frost
      jimf@frostbytes.com
    47. Re:Perhaps.... by Anonymous Coward · · Score: 0

      That is the big myth: that it takes longer to write the tests. People seriously underestimate all the head-scratching and debugging time in a typical development cycle. Its easy to do after all, it is hard to think about how much time you are wasting when you are focused on figuring out what is going on. But if you watch people, after they start writing tests as they go, you notice a lot less drooling, and blank-stare catatonia at the keyboard.

    48. Re:Perhaps.... by cathouse · · Score: 1

      In the paleolithic of computers, when memory was still core, there was, for several years there was only one language which gave you both power and any degree of control over your own code. That was IBM [360] Assembeler; and that was the context within which I spent a great deal of time working on the problem of why I was so lousy at debugging; why almost everyone else was worse; and why, the better you were at the process, the more you hated doing it!? Several of my realizations point in still useful directions: Competant code tends to mirror the programers' mental process'--as a result, when looking at your own code, [less than perfect??] your analytical process is overwhelmingly likely to closely paralell your origional process and as a direct result will include a paralell error or omission at the same point. [[when process=metaprocess]+\-[real positive integer]level]] This is my worst possible scenario for error detection. Debugging someone elses code is even worse because you have to start by translating code into process, then follow process, in order to find error/omission in code. With the additional dificulty that all except a very small percentage of the very best write lousy, loopy, inefficiant code on their few good days. [exmp-Bill Gates/Windows] I ALWAYS found it to be far faster and less hellish to rewrite the routine from scratch. [at least then it was my own shit that I might find myself writing bad haiku on the walls with] While [[process][scalar][vector]] will always yeild metaprocess; the inverse {which I couldn't generate at 0500 Lima for love or money} will give you one of the lesser orders of infinities of wrong answers as often as it will yeild the single correct answer. Seems like really poor odds to me. ***the preceeding thoughts were chipped out of Germanium bearing flint by a single naked human mind***

      --
      Thelma, I'm not making ANY deals.
    49. Re:Perhaps.... by Anonymous Coward · · Score: 0

      What about when there is something you cannot unit test, like if the hardware works correctly....hmm...

    50. Re:Perhaps.... by dubl-u · · Score: 2
      Then you haven't written enough tests. Or you're trying to integrate too much at once.
      Must be nice to work in a world where you have time to write comprehensive supra-unit tests and can rely on all your co-workers to have fully tested their code. I'd like to visit that world sometime, because in my world schedules are allocated such that it's rare you have time to do more than just unit testing and they call integrated testing "beta".

      If you want to go as fast as possible, then you don't have time not to not keep things clean by writing good tests, integrating continuously, keeping in close touch with your coworkers, and refactoring whenever you see a way to improve the design.

      In the very short term, say a week or two, you can improve your productivity by writing utter crap. But that's just storing up trouble; in effect, you borrow productivity from the future. But it's like borrowing from a loan shark: the interest rate is terrible, and the project ends up with broken kneecaps if you don't pay up pronto. If you're writing code that's only minorly crappy, then you build up cruft at a slower rate, but the problem's still there, and it will eventually lead to critical mass.

      So yes, it is to nice to work in a world like that. And it yields better software faster, so it's great for the suits, too. My advice: either change your organization or change your organization.
    51. Re:Perhaps.... by GreyPoopon · · Score: 1
      I know, but by noticing that the problem only occured when the debugger was attached indicated a memory violation of some sort.

      Of course it was a memory violation. If it had been a simple logic error, I'd have probably been able to track it down just by seeing how the program behaved, no debugger necessary. But finding a memory violation wasn't (at least at that time) as easy as it might seem. You don't know if you accessed a dangling pointer, reference an array with an out-of-bounds index, or some other such nonsense. I knew the problem was a memory violation as soon as the program crashed while running. The debugger didn't help there.

      --

      GreyPoopon
      --
      Why is it I can write insightful comments but can't come up with a clever signature?

    52. Re:Perhaps.... by Anonymous Coward · · Score: 0

      So Smalltalk needs an interpreter to run, and this means it is not interpretted?

    53. Re:Perhaps.... by jarober61 · · Score: 1

      I'm utterly baffled by people who are 'proud' that they haven't used the debugger. That's write, muddle along there with the second rate tools, complacently unaware that better things exist.

      --
      Talk Small and Carry a Big Class Library
    54. Re:Perhaps.... by jarober61 · · Score: 1

      Sigh. JIT = Just In Time Compiler. A JIT != an Interpreter. This is basic stuff....

      --
      Talk Small and Carry a Big Class Library
  2. All your need is a little of this... by jpt.d · · Score: 2

    Project Builder absolutely sucks for debugging on its own. But, I use it for break point management, but from there I use the GDB console it has. I know dick about getting gdb upto that point, but PB does it nicely. Then I can use p for a normal inspection, and po for an object inspection. I like it. If it weren't for the GDB console, PB would really suck debugging. But with it, it rocks!

    --
    What we see depends on mainly what we look for. -- John Lubbock Now search for that bug slave!
  3. Easy solution by stratjakt · · Score: 4, Funny

    Dont debug.

    Eventually someone else will find the bugs and fix them for you at their own expense.

    This is how the Open Source programming model works.

    --
    I don't need no instructions to know how to rock!!!!
  4. I'm sure loads of debuggers have got it... by koali · · Score: 4, Interesting

    But I'd like to be able to create 'conditional' breakpoints (i.e.: stop at this line when i==47).

    Other than that, I'd like generalized hot-swapping of code and 'step back' (which I don't know if it's always factible); or at least be able to view a variable's history.

    Shame that my IDE of choice (Eclipse) doesn't (AFAIK) support those.

    1. Re:I'm sure loads of debuggers have got it... by Khomar · · Score: 1

      I definitely agree with the previous post (no moderation points though *sigh*). I have also had times where having the ability to set a variable value at the time of debug would have been useful in tracking down hard to reproduce bugs by forcing a different code path -- like, for instance, testing an error condition that could be difficult or time consuming to generate (out of memory, locking issues, etc.). When dealing with a customer's complaint in a situation you have never seen before, having the ability to tweak variables to match their situation would be useful.

      Khomar

      --

      I believe in de-evolution. God made the world perfect, man fell, and its been going downhill ever since!

    2. Re:I'm sure loads of debuggers have got it... by MisterFancypants · · Score: 2
      Yeah. Visual Studio .Net does this, and many more things, when it comes to advanced breakpoint support. It is REALLY NICE to go in and tell it to break on any line when a certain variable changes, in those cases where you see a variable is changing at some point but you're not sure exactly where it is happening.

      It pains me greatly to have to use lesser debuggers than the one in Visual Studio when I'm developing code for non-Windows platforms. The extensive breakpoint support, edit and continue, etc seemed a bit like fluff to me when I first started using them, now I find it hard to live without them.

    3. Re:I'm sure loads of debuggers have got it... by technomom · · Score: 1

      IBM's Websphere Application Developer V5.0 (based on Eclipse 2) has watch and also has a general "break the nth time you hit this line" breakpoint.

      JoAnn

    4. Re:I'm sure loads of debuggers have got it... by rvaniwaa · · Score: 5, Informative

      To do this in dbx do:

      "stop at 99 if (x == 17)"

      or in gdb:

      (gdb) break main.C:99

      Breakpoint 1 at 0x8048776

      (gdb) cond 1 (x = 17)

      (gdb)

      --
      main(i){(10-putchar(((25208>>3*(i+=3))&7)+(i ?i-4?100:65:10)))?main(i-4):i;}
    5. Re:I'm sure loads of debuggers have got it... by BadBrainDay · · Score: 1

      Eclipse can do conditional breakpoints (Right click on a Breakpoint and select "Breakpoint Properties..." from the popup. Options include Hit Count, Thread selection and custom conditions). Eclipse also supports Hot Swap if the JDK you're using supports it.

    6. Re:I'm sure loads of debuggers have got it... by IPFreely · · Score: 3, Insightful
      or at least be able to view a variable's history

      That's one I've actually wanted before. I'd like to see something where you could specify a list of "Watch" variables, and snapshot points. then let the program run. It takes snaps of all variables at each point. you can then go back and review what happened. Get a nice grid of variable values by point in time.

      It's a lot faster then setting watches and breakpoints and having to write or remember what happened at each point.

      --
      There is nothing so silly as other peoples traditions, and nothing so sacred as our own.
    7. Re:I'm sure loads of debuggers have got it... by Twanfox · · Score: 1

      Some Debuggers (GDB specifically that I know) do come with 'on the fly' variable editing. It was very handy to debug a network database server when it got caught in an infinate loop. Linked up to the program, gained control, adjust the faulty variable in order to keep the data sane, and detach from it to let it continue running.

    8. Re:I'm sure loads of debuggers have got it... by alannon · · Score: 2

      I'm guessing that main.C:99 is a point in your run-loop, meaning it would only ever be checked once every time through the run loop. I believe a more useful way of doing this in gcc would be as follows:

      1) use 'watch' to set a watch breakpoint on a variable, either on variable change, or variable read, respectively.
      2) set a condition on the watchpoint so that it only breaks when that variable equals a certain value. ...

      I just decided to test this and on 2 different platforms (OSX and linux) gdb does not do this properly. Anybody know why?

    9. Re:I'm sure loads of debuggers have got it... by gandalf013 · · Score: 1


      main(i){(10-putchar(((25208>>3*(i+=3))&7)+( i ?i-4?100:65:10)))?main(i-4):i;}

      The above invokes undefined behaviour, because:
      1) no prototype for putchar()
      2) main either takes two arguments (int, char ** or equivalent), or none. In C99, you would need to declare int main(int argc, char *argv[])
      3) You don't return a value from main()
      4) It assumes ASCII character set.
      There might be others, ask news:comp.lang.c :)

  5. This is no surprise -- It's not PB's job by krog · · Score: 2

    Project Builder is meant to integrate (as you said, through breakpoint control) with GDB. It is not meant to perform debugging on its own.

    It's a wonderful development environment -- Project Builder for the code, Interface Builder for the GUI, and GDB for debugging.

  6. Debugger improvements by exp(pi*sqrt(163)) · · Score: 5, Interesting
    • Reversibility. I'd like to be able to step backwards through code. No, this isn't a joke. Only a small amount of information needs to be stored as each instruction is executed in order to have an emulator go backwards again. You don't necessarily want to run an entire application reversibly. You might want to run a small loop until it crashes and then work backwards to find the cause.
    • Easy plugins I want to easily be able to load my own custom code into the debugger. For example I might want a custom routine to conveniently display a custom datastructure, or even give a graphical representation of some data.
    • Program control. More cooperation with the code itself. I'd like the debugger to provide a library against which I can link my code so that the code being debugged can control things like which variables are being watched and which breakpoints are active. I could then easily have breakpoints that are enabled only under certain conditions. Especially useful when the best way to detect those conditions is for the code itself to figure it out.
    --
    Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
    1. Re:Debugger improvements by p3d0 · · Score: 1
      Forget plug-ins. In gdb, you can just code up whatever debug facilities you want, either as a script (is possible), or even by adding it to the gdb code itself. If you have never tried the latter before, you should--it's remarkably easy.

      Yay for Free software.

      --
      Patrick Doyle
      I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
    2. Re:Debugger improvements by rvaniwaa · · Score: 2


      Reversibility. I'd like to be able to step backwards through code. No, this isn't a joke. Only a small amount of information needs to be stored as each instruction is executed in order to have an emulator go backwards again. You don't necessarily want to run an entire application reversibly. You might want to run a small loop until it crashes and then work backwards to find the cause.


      This is obviously not always possible as many functions (squaring a number, sin of a number, ...) are not reversible

      --
      main(i){(10-putchar(((25208>>3*(i+=3))&7)+(i ?i-4?100:65:10)))?main(i-4):i;}
    3. Re:Debugger improvements by exp(pi*sqrt(163)) · · Score: 2

      You store a log. You'd do this at the machine level. So, for example, if you emulated the x86 instruction add eax,1 you'd need to store a copy of the flags before executing the instruction because some of those will be clobbered irreversibly. Note that you wouldn't need to store the value of eax as that part is reversible. For an instruction like mov eax,[ptr] you'd obviously need to log the value of eax before executing it. You might also need to store some extra flags to deal with branch instructions.

      --
      Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
    4. Re:Debugger improvements by Anonymous Coward · · Score: 0

      Um yeah but you don't need reversable mathematical operations, you could just have it rewind the registers and memory where those things lived.

      In your example, assume x = (0.5 * PI) and y = -99. The program does y = sin(x), after which, y = 1. To "reverse" this operation, the debugger just puts the sin instruction back on the instruction stack and sets y to -99 again. Simple!

    5. Re:Debugger improvements by a7244270 · · Score: 1
      I could add...

      Counted Iterations
      I'd like to be able to say "go through this loop 13056 times and then stop".
      Its pretty easy to work around indexed loops, but if you have something like

      while( ! done ) {
      // code
      }
      then it gets a lot harder.

      Break on value
      Some debuggers have this, but not any I get to use :(. I'd like to be able to say "break when foo ..."

      Better messages
      I'd like better status available to me while debugging, for example what namespace I am in, how much CPU the last instruction took, etc.

      Thread debuggers
      Debugger spawned when threads spawned. I guess this is a pipe dream...

    6. Re:Debugger improvements by Coward+Anonymous · · Score: 3, Interesting

      You might want to add execution history to the list.
      A stack trace gives you the current calls but what were the previous 5 calls made?
      An execution history would tell you what the last N calls were and in what order they occured.
      It would be easy to implement as a series of stack snapshots.

    7. Re:Debugger improvements by Dr.+Evil · · Score: 2

      Stuff like jumping gets hairy, I'm not sure how you could really "run backwards". But you should be able to save a program trace in a circular queue and simulate the behaviour of running backwards. The instructions combined with the changes to the processor state should let you use a core-dump to walk backwards through the changes.

      That is, you store all the changes to the registers, along with the intstruction pointer, any changes in memory, anything done anywhere using the CPU.

      When the app cores, you could then watch it in the debugger like a movie... forwards and backwards. You couldn't make changes to variables or anything fancy since you would be limited as to how much state information you've stored... but I know it would help me from time to time.

      I doubt the CPU could help create such a dump... but an emulator could.

    8. Re:Debugger improvements by Anonymous Coward · · Score: 2, Informative

      - The WATCOM C/C++ debugger has reverse execution support. (No, I am not kidding.)

      - Dumping data structure support is something that you can integrate into your application. That said, the MSVC++ debugger's data structure dumping is not that bad.

      - The plug in idea is a good one. However, I believe that Soft-ICE may have at least some such ability.

      I think perhaps the fact that the above post was moderated so high is evidence of an earlier post -- that nobody actually uses debuggers?

    9. Re:Debugger improvements by lederhosen · · Score: 0

      n (13056 * lines in loop)

    10. Re:Debugger improvements by EvlG · · Score: 2

      Easy plugins I want to easily be able to load my own custom code into the debugger. For example I might want a custom routine to conveniently display a custom datastructure, or even give a graphical representation of some data.

      It's worth nothing that Visual Studio already has this capability, at least to some degree.

    11. Re:Debugger improvements by IanBevan · · Score: 2, Informative
      Reversibility was available with the Borland IDE some years ago. Can't remember how well it worked.

      Plugins is an interesting one. Although it's not a well known feature, the MS Visual Studio IDE allows arbtrary formatting of a datatype (it's specified in a configuration file IIRC). This is only formatting though, so there's no code to be executed and certainly no way of displaying the data graphically.

      As for program control, try
      if (mycondition) { asm int 3; }

      Under Windows
      if (mycondition) { DebugBreak(); }

      The Visual Studio IDE can also set conditional breakpoints. Hit F9 to set a breakpoint, then open the Edit Breakpoints dialog box (Edit|Breakpoints) and hit the Conditional button.
      Since we're here, I would very strongly recommend Jon Robbin's Debbugging Applications book for lots of tricks and traps using Win32/ MS Visual Studio. All of the code there is win32 specific though, so not much use to Linux development. Amazon says it's out of print, but I see it in local nerdy bookshops from time to time.
    12. Re:Debugger improvements by FattyBoeBatty · · Score: 2, Funny

      "...Program control. More cooperation with the code itself. I'd like the debugger to provide a library against which I can link my code so that the code being debugged can control things like which variables are being watched and which breakpoints are active. I could then easily have breakpoints that are enabled only under certain conditions...."

      You know, that's actually a great idea -- and if you think of the logical continuation of it, it would only be a matter of time before you needed a debugger for your debugging code. How cool would that be!

      -Fatty

    13. Re:Debugger improvements by bob_jenkins · · Score: 2

      Reversibility -- for singlethreaded, something just about as good would be to dump the state of the program at some chosen point and be able to reload it at that point. The real gain of reversibility is you don't have to spend the hour setting up the problem.

      The first thing I do already when debugging something is whittle down the testcase to make the overhead of reproducing it as small as possible.

    14. Re:Debugger improvements by Daniel+Serodio · · Score: 1
      "Counted Iterations" and "Break on value" are available and very easy to use in Eclipse.

      If you do Java, try Eclipse. It made me switch from 4+ years of Emacs!!! :) I know Eclipse also supports C++, but I never tried it, so I don't know how good the C++ support is.

    15. Re:Debugger improvements by x01mOiRe10x · · Score: 1

      This is obviously not always possible as many functions (squaring a number, sin of a number, ...) are not reversible

      hogwash.

      x^2=y, then y^1/2 = x. its a square-root!
      if my caluclator from the early 80's can do it....

      --
      "Beer is proof that God loves us and wants us to be happy." --Benjamin Franklin
    16. Re:Debugger improvements by exp(pi*sqrt(163)) · · Score: 2

      Are you talking about that file, whose name I can't remember, where you can give a crude format specifier? It's OK for some stuff, but not great.

      --
      Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
    17. Re:Debugger improvements by Gaijin42 · · Score: 2

      Uh.

      2^2 = 4.

      -2^2 = 4.

      Given 4, x^(1/2) is not reversable, if your original input could include a negative number.

    18. Re:Debugger improvements by exp(pi*sqrt(163)) · · Score: 2

      I've had the Visual C++ debugger crash and kick up another debugger to debug itself many times now...

      --
      Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
    19. Re:Debugger improvements by Anonymous Coward · · Score: 0

      It is probably not easy (or possible), but when you stop at a breakpoint (or watchpoint) in a debugger, the bug has already occured. It would be very useful to be able to step back and see how it get there in the first place without restarting the program.

    20. Re:Debugger improvements by Anonymous Coward · · Score: 0

      # Reversibility. I'd like to be able to step backwards through code. No, this isn't a joke. Only a small amount of information needs to be stored as each instruction is executed in order to have an emulator go backwards again. You don't necessarily want to run an entire application reversibly. You might want to run a small loop until it crashes and then work backwards to find the cause.

      The Watcom debugger steps backward. Works very well, but there are obviously some processes which can't be undone.

    21. Re:Debugger improvements by EvlG · · Score: 2

      There is that, but there is also a plugin interface so that the debugger can call a function to provide a custom representation of the data.

    22. Re:Debugger improvements by martyros · · Score: 1
      I'm actually working on a research project that comes close. We're not working on reversability, but on exact repeatabilty, as many times as you'd like. Roll back to a checkpoint, and run forward again until just one instruction before you stopped last time. It turns out to be easier than you'd think.

      Computers are by nature deterministic; same starting state + same input => same output. So if you can manage to log all the external input to a program and deliver it the same way, it will do exactly the same thing.

      Input comes in two types:

      • External data like keyboard, mouse, and so on
      • Timing like interrupts, signals, or scheduling.
      External data is pretty easy. Interrupts are a bit harder, but possible. In fact, I've done it.

      Right now we're using it for forensic analysis after an intrusion, but there's no reason it couldn't be used for debugging as well.

      --

      TCP: Why the Internet is full of SYN.

    23. Re:Debugger improvements by Anonymous Coward · · Score: 0

      This seems like the right approach. You might need
      to implement checkpointing and rollback, but you could use copy on write to capture updated pages.
      However, doing this changes timing characteristics,
      so synchronization and timing errors would be hard
      to explore using this technique. Since these are
      among the hardest class of software errors to reproduce, and where you might especially want this ability, ht might be a bit limited in application.
      It is also possible to have the compiler assist with the code generation and for the compiler to chose between reverse computation and rollback.

    24. Re:Debugger improvements by Anonymous Coward · · Score: 0

      This is a great list. I would only add one thing:

      Saveable debugger state. Sometimes something happens which forces me to change my current priority bug. If I could save my breakpoints and watch variables away and then start on the next bug, then I could go back to where I left off on the first bug.

      Myrle

    25. Re:Debugger improvements by jimfrost · · Score: 2
      More cooperation with the code itself. I'd like the debugger to provide a library against which I can link my code so that the code being debugged can control things like which variables are being watched and which breakpoints are active.

      In a different posting I talked about Saber-C and some of what we did that was useful, but I totally forgot about this particular feature. We did have the ability to link in debugger control functions like "break now". It was, indeed, quite useful.

      --
      jim frost
      jimf@frostbytes.com
    26. Re:Debugger improvements by hal9000 · · Score: 1

      Regarding your second wish, the UPS C/C++/Fortran debugger allows user code insertion at runtime. I don't know about loading pre-written modules in, tho.

      http://www.concerto.demon.co.uk/UPS/

      It's my favorite.

      --
      Look out honey, 'cause I'm using technology; Ain't got time to make no apology
  7. I've got 4 words for you by blahlemon · · Score: 0, Troll

    Developers, developers, developers, developers.

    --
    It take more faith to believe in evolution than it takes to believe in God
  8. Teach people to use already available tools by rvaniwaa · · Score: 5, Insightful

    One of my biggest problems with people on my current project is the lack of knowledge of how to use even the most basic tools. We program in C++ on Unix and many developers find calling up dbx to be a chore and, even when they get dbx up, have trouble using it. We have many other tools, ddd, other graphical debuggers but people just don't use them, relying on printfs and couts...

    --
    main(i){(10-putchar(((25208>>3*(i+=3))&7)+(i ?i-4?100:65:10)))?main(i-4):i;}
    1. Re:Teach people to use already available tools by Carpathius · · Score: 1

      You make it sounds as if using printf isn't as good as using a debugger.

      On occasion, I've learned debuggers. I've never found that I liked them. I typically *do* use printfas (or their equivilent) to debug my applications. I find that method is usually faster than trying to use a debugger. In my more recent programming experience -- the last four or so years, there was exactly one time when using printfs was not sufficient to figure out how to solve the problem I was seeing.

      If you know the code well enough, then I doubt that using a debugger will speed finding the problem much, if any. Perhaps if you're looking at code you don't know well, then it might help figure out the internal flow.

      Sean.

    2. Re:Teach people to use already available tools by emoeric · · Score: 1
      I am a printf debugger most of the time. My reasons? There is never a new program to learn. In school, i am frequently changing programming environments, and it is far easier to stick with something that i know is not going to change (how to print to screen) than to go learn the current debugger, only to not be able to use it when i get to next semester. Occasionally i'll bust out some gdb, but its more for curiosity than real need.


      Funny, the only time i remember sitting down and really using a debugger was in this old hardcore Borland compiler in high school. The watch window is indeed a wonderful thing.

      --

      |---------------|
      practically an AC
    3. Re:Teach people to use already available tools by rvaniwaa · · Score: 2

      I was probably a bit strong on my opinions on printfs. I use them myself but it is usually only for the initial debugging. When the problem starts to get deeper, it is generally faster to run it in a debugger if only because building the entire application takes too long (half a day or more if you change the wrong file...).

      Also, I am frequently the one called in when someone else's code does not work. Since I don't know the code, as you say, debuggers help greatly in figuring out the flow...

      --
      main(i){(10-putchar(((25208>>3*(i+=3))&7)+(i ?i-4?100:65:10)))?main(i-4):i;}
    4. Re:Teach people to use already available tools by EvlG · · Score: 5, Informative

      You are dead on here.

      How many ppl here are clamoring for conditional breakpoints, when VS.NET can do this already?

      Or clamoring for the ability to see what changed your variable, no matter where it was changed? Breakpoints on memory can do this too. In VS.NET I just set a breakpoint on a given memory address, and anything the address changes, it takes me right to the instruction (or statement, if it has src) that changed it. Absolutely critical feature for tracking down memory corruption.

      But how many people know about these facilities?

    5. Re:Teach people to use already available tools by pyrrho · · Score: 1

      >(i ?i-4?100:65:10)

      that's sick! which I mean as a compliment.

      btw... when it says to me "Geek"... is it saying you are a geek, or is that what I am for compiling someone's sig (thank god it wasn't a virus!)...

      of course, if I were truly geekorific I would have simply read it and the word Geek would have appeared in my head.

      btw, I actually understand people prefering printf over dbx... line oriented debuggers are tedious and you can usually get away with printf-style. But using a graphical debugger is really only tedious if you hate the code and don't want to become familiar with it!

      And of course... tedious is not always a bad word, people should be familiar with whatever debugger they have available as there are some things you will only catch with a debugger.

      --

      -pyrrho

    6. Re:Teach people to use already available tools by Anonymous Coward · · Score: 0

      Totally agree with you. I also wished developers new how to do core file analysis with a debugger. This usually makes those hard to find problems easy. For those impossible problems use valgrind people and remember the kill command is your friend. 8)

    7. Re:Teach people to use already available tools by Anonymous Coward · · Score: 0

      Someone else said this, but I have to agree that traces, are far better, particularly in debugging multithreaded programs where they are less intrusive (albeit not completely nonintrusive). Additionally, traces are generally superior because they let you know when something went wrong after the fact and give you a chance to fix it even if you can't reproduce it.

      Sure, in windows you can set userdump as the default debugger and generate a core dump to debug if it crashes, but what about logical errors that don't cause a crash? the executives aren't usually too happy if you throw exceptions and crash all over the place just to ensure that you have process dumps available, so once again, you're best served by trace statements.

      even for crashes, we just automatically ouput a stack trace (of the offending thread only, admitedly) to the logs when a process crashes, this, combined with the logs are enough to figure out how the process got into such a mess and fix it.

      About the only case I can think of where a debugger is the best choice is in diagnosing a deadlock, amd even then, that's not always an option if it happened at a customer site (they generally need to restart and get back to business rather than wait for you to start a remote debugging session, not to mention MS remote dbg sucks), so you'd better be able to fix it from the logs.

    8. Re:Teach people to use already available tools by irix · · Score: 2

      But how many people know about these facilities?

      Indeed. I don't use VS.NET, but I can tell you that dbx on Solaris can do the same things. It can also check for buffer overruns, memory leaks, and do performance profiling. However, many people seem not to know about these features.

      Somehow I think the "use printf!" crowd here are debugging their university CS assignments, and not any type of complex real-world application.

      --

      Do you even know anything about perl? -- AC Replying to Tom Christiansen post.
    9. Re:Teach people to use already available tools by EvlG · · Score: 2

      I agree 100%. Speaking from my own experience, printf() or other log-based debugging was only effective on projects up to about 3000 lines of code. Beyond that, the debugger was the only way to go (and it is certainly the only way to debug very large systems with 100k+ loc).

      One place I did find logging to be better than the debugger though was in debugging distributed applications. I had a couple of university assignments in a distributed OS class; log files were really the only way to go because of the nature of the interactions between the processes (many of the bugs were time-dependent, and you just couldn't catch them in a debugger).

    10. Re:Teach people to use already available tools by irix · · Score: 2

      One place I did find logging to be better than the debugger though was in debugging distributed applications.

      Actually, I code distributed applications for a living :-) We do some logging that can be turned on and off on the fly so that we can help debug distributed problems both in house and in the field.

      I guess I didn't mean to imply printf() is useless, just that it is just one small tool in debugging a problem. If printf() is the only thing you use, then you either have a simple problem or you are going to have to spend a lot of time debugging. I also get some use of of packet sniffers like Ethereal, and as I said you can do a lot with dbx. This all goes back to the original point - use all of the tools you have available, and learn how to use them well!

      --

      Do you even know anything about perl? -- AC Replying to Tom Christiansen post.
    11. Re:Teach people to use already available tools by Darth_Burrito · · Score: 2

      You make it sounds as if using printf isn't as good as using a debugger

      Well, for a lot of stuff, it really isn't nearly as good as a debugger. Compiling takes a long time. You can't explore a complex data structure in an interactive environment. Can you even use printfs when there is only a gui and half the application is setup so it can run on a remote machine via com+?

      I find that method is usually faster than trying to use a debugger.

      How could it possibly be? With a good debugger you can move to any section of code and instantly check the value of any variable or complex object. With printf, you have to recompile every time you want to add or remove a printf. I suppose you could macro in your debugging code and that way you could automatically generate traces of information... but every time a new problem came up you'd have to set up new debugging code to solve it. And all that compiling.... Am I missing something?

      [RANT] It really bothers me when people ignore good development tools because they think their way is faster. For example, with Interdev and IIS you can debug ASP applications, but you have to do a little work to make sure the debugger will work. The place I work at now doesn't use Option Explicit in vbscript or use strict in perl. They write perl scripts in notepad for gods sake. It's like being asked to run a marathon in flip flops. [/RANT]

    12. Re:Teach people to use already available tools by EvlG · · Score: 2

      I'd be interested to hear what techniques you use to debug your distributed apps, and on what sort of scale you deal with them.

      My apps were relatively small (around 10 nodes) being part of a semester university course and all. I found that the debugger was effective of course for verifying small blocks of code and overall program flow, but I quickly got frustrated with it trying to debug the system as a whole.

      The problem with log files was of course the parsing stage. At one point I toyed with the idea of make a perl script that could verify correctness, but I decided that was more risky than just reading the logs by hand to make sure things were correct or to find out where the problem was.

      What techniques do you use?

    13. Re:Teach people to use already available tools by statusbar · · Score: 2

      I agree with all your points. However I have found debug logging more useful than debuggers on a few occasions. Specifically, to trace the actions of code during a hardware interrupt routine. In this case, a debugger doesn't cut it and if you want something better than prints then you have to get a hadware cpu emulator hooked up - Or a cpu with a JTAG interface.

      Of course, I'm not speaking of normal prints here, I devised a priority level logging system that was efficient enough to call during an ISR, and then only when a specific trigger condition was encountered.

      However, being involved in porting linux 2.4.20 to a custom powerpc board made me REALLY appreciate the power of the JTAG interface connected to a gdb running remotely to do source level debugging of the kernel!

      --jeff++

      --
      ipv6 is my vpn
    14. Re:Teach people to use already available tools by m_pll · · Score: 1
      About the only case I can think of where a debugger is the best choice is in diagnosing a deadlock

      As well as memory corruptions, CPU hogging and various exceptions that can't be debugged given only a stack trace.

      and even then, that's not always an option if it happened at a customer site (they generally need to restart and get back to business rather than wait for you to start a remote debugging session

      They can create a memory dump and send it to you. All they have to do is run ntsd -pv -p [pid] -c ".dump -mfh foo.dmp;q".

      not to mention MS remote dbg sucks

      What exactly sucks? Latest NT debuggers have very good remote debugging capabilities, IMO.

    15. Re:Teach people to use already available tools by irix · · Score: 2

      The application I work on is a 2-node cluster, but it can have dozens of clients.

      Debugging the distributed nature of the problem usually comes down to two things - content of the message (we use our own protocol on top of TCP) and the timing. Our debug logging can log both on the server and client sides, so usualy I just end up looking at the logs (just a visual examination) to see where a problem lies. I can see what messages were sent by whom and when, and what was recieved.

      If the problem gets more complex, I have used perl to parse the logs, especially if we have a problem in the field and we get a lot of data back. As I mentioned before, I have also used Ethereal to examine what is being sent across the wire when some even more bizarre problems surfaced. I have also been using a Linux router running NIST Net to help simulate various network conditions when trying to debug problems.

      --

      Do you even know anything about perl? -- AC Replying to Tom Christiansen post.
    16. Re:Teach people to use already available tools by aled · · Score: 1
      And a little mistake using printf could actually add a bug that wasn't there before. Like:
      int i; printf("%s", i);
      Kinda Heisenberg's Uncertainty Principle :-)

      I agree with you. Most people complain about what they don't care to learn languages, tools, standard libraries, etc. Me? I just don't have time lota work...
      --

      "I think this line is mostly filler"
  9. I'm not a professional developer, but... by reimero · · Score: 5, Insightful

    I'm a total amateur, but I personally find that software tools can ultimately only go so far in debugging. The two most important debugging tools I'm aware of can't be solved with software: a short break from the project to clear your train of thought, and another set of eyes which might better see what you've overlooked.

    --

    ----------

    Something clever
    1. Re:I'm not a professional developer, but... by stratjakt · · Score: 1

      Gah!

      I know you! You're the jackass two offices over who can't give me a moment in peace to work on my own projects!

      Every damn 5 minutes, I swear.. "Hey, come and look at this.", "Hey, what's wrong with this SQL statement?", "Hey, why won't this compile".

      And the answer is always so damn retarded. "You need to put single quotes in the SQL statement, not doubles", "You need an end if statement"

      Gahhhhh.. Once, I swear, he spends 5 hours - more than half a day - debugging some report, and finally calls me. "This should be saying 3, but it says 8". So I tell him "use the zoom tool, it is a 3, it just looks like an 8 because for some stupid reason you have your monitor set to 640x480".

      He hasnt even registered some of the 3rd party controls we use, so I have to compile all of his code for him, else it will build with nag-screens.

      AAAAAAHHHHH The only damn debugging feature I need is a Louisville slugger.

      Damn fool.

      Asking for help is great, but when it crosses the line into 'do it for me', you end up on a a coworkers hitlist.

      --
      I don't need no instructions to know how to rock!!!!
    2. Re:I'm not a professional developer, but... by Natedog · · Score: 1

      The two most important debugging tools I'm aware of can't be solved with software: a short break from the project to clear your train of thought, and another set of eyes which might better see what you've overlooked.

      While this may be true for those few really nasty bugs that require knowledge about areas you aren't familliar with, these are rare. In general, having others look at your code and taking a break every time there's an error isn't productive. Simply looking at a stack trace and the state of stack frames (ie locals) and globals will find the problem 95% of the time. If you don't know how to do this, you should convince your boss that its in the company's best interest to get you some training (ie a class, time allocated for self learning, etc) -- or, if you're not employeed, I would start doing some self study on the topic ASAP.

      --
      \forall code \in C, \frac{\Delta readability(code)}{\Delta t} < 0
  10. what's wrong with debuggers? by Anonymous Coward · · Score: 1, Funny

    No dancing girls!

    Add one or two beautiful dancing girls to every debugger, and they'll sell like hotcakes.

    1. Re:what's wrong with debuggers? by Anonymous Coward · · Score: 0

      No hot cakes!

      A debugger, a couple of dancing girls, and a stack of hot cakes with butter and syrup....now that's a party!

    2. Re:what's wrong with debuggers? by Anonymous Coward · · Score: 0

      I think a few new menu items would help too:

      Step in...(F7)
      Step out... (F8)
      Step out of Windows...(F9)
      Purchase Mac G4 on EBay... (F10)

      I think this tool would fly off the shelves...

  11. Problem Solving Skills by kvn299 · · Score: 2, Interesting

    Debugging is essentially problem solving and if you don't have well developed skills doing that, then it's not going to be very easy to do. However, every person thinks differently and hence approaches to problem solving varies. It seems to me that although computers can help narrow down the scope of this issue, in the end, it's the brain that is the most powerful tool.

    Remember those high school days of comparing the green text on your TRS-80 monitor to the print in your Softside magazine. Now that was fun... har har.

  12. Visual Basic debugger.. by mumblestheclown · · Score: 3, Interesting

    As much as everybody here likes to make fun of Visual Basic, I encourage all to have a look at VB's debugger. While there are a few improvements here and there that could be made, in general it far, far surpasses anything else that I have seen out there. (I have yet to play with VB.net--I am referring here to VB6).

    1. Re:Visual Basic debugger.. by stratjakt · · Score: 3, Interesting

      I use it every day, and take it for granted sometimes. I miss it when I'm using another language and lacks its features.

      The call stack is at your fingertips, I add/remove conditional watches with a couple keystrokes, stepping into, out of, and over functions, and the immediate pane makes a great scratchpad/interface to the internals of the program. You can break on all errors, unhandled errors, or arbitrarily.

      It wouldnt be nearly as easily to quickly put together apps in VB without it's debugger. It truly turns a half-assed language into a really good tool for rapid prototyping.

      --
      I don't need no instructions to know how to rock!!!!
    2. Re:Visual Basic debugger.. by Anonymous Coward · · Score: 0

      the VB IDE/debugger is much better than a lot of other commercial products today.

      But it is crap compared to what smalltalk or some common lisp environments were doing 20 FSKING YEARS AGO.

      This is truly depressing. Perhaps what is needed is not so much `new' ideas, as to actually follow what *good* ideas have been used before.

      The commercial programming community is amazingly ignorant of what has been done before. Laughable claims of 'innovation' come out every year, and the whole teach-yourself-something-simple-in-21-days crowd keep lapping it up.

      bah.

    3. Re:Visual Basic debugger.. by MisterFancypants · · Score: 3, Informative
      For the C/C++ people out there, try checking out the debugging facilities in Visual Studio .Net in general. The debugger for C++ is great as well. Edit & Continue support allows you to recompile code and keep debugging a running process in memory. Tons of options for conditional breakpoints (break anywhere if variable x changes). Support for automatic buffer overflow checking. Interactive variable watch that you can even call functions in (eg. you can set a watch on strlen(myString), it will display the result of the strlen call (and that's just one example, works with any function/method/data).

      Whatever you think of Microsoft, the debugging support in Visual Studio .Net is very top notch and well supported in all languages (C#/VB/C++ (both managed and unmanaged)).

    4. Re:Visual Basic debugger.. by leecho · · Score: 1

      I can't see anything that VB's debugger has that Eclipse doesn't, and Eclipse's got one of the best Java debuggers I've ever used, despite some bugs with recursive data structures that I hope that get fixed soon (create a List and add itself to it, go to the variables and press '*' to unfold the whole tree, and *boom*).

    5. Re:Visual Basic debugger.. by Anonymous Coward · · Score: 0

      The difference: people use VB.

    6. Re:Visual Basic debugger.. by Anonymous Coward · · Score: 0

      Yes. People use VB, and it is your parent poster's fault.

      If he had written "Teach yourself Smalltalk in 21 days" he wouldn't have that problem.

    7. Re:Visual Basic debugger.. by Anonymous Coward · · Score: 0

      IBM's VisualAge products exceed any of the MS Visual crap. Too bad IBM couldn't sell water in the desert and of course most of them are discontinued or on their way there.

    8. Re:Visual Basic debugger.. by Chris+Burke · · Score: 2

      Interactive variable watch that you can even call functions in (eg. you can set a watch on strlen(myString), it will display the result of the strlen call (and that's just one example, works with any function/method/data).

      Ah, that's cool they finally got that. I greatly missed the ability to call functions and execute code from the debugger when I had to go from gdb to VS 6-something. I was becoming one of the "printf() crowd" until I learned about this feature. :)

      --

      The enemies of Democracy are
    9. Re:Visual Basic debugger.. by Bert+Peers · · Score: 1

      Strange that you mention this.. The first thing I did after installing .Net was testing its debugger by writing a C# Forms program that would simply hook up a paint event handler, and go deliberately out of bounds. I got a break alright, but with some sort of gigantic stacktrace that dumped me somewhere in a bunch of assembler/IL. About all that told me was that something went wrong, somewhere, during CLR's handling of WM_PAINT. I can't imagine debugging a complicated modern GUI app with only that kind of info, so I kinda gave up.. Sounds like something could be wrong with my setup then.

  13. Debuggers cause problems, and are IDE-dependent. by $$$$$exyGal · · Score: 1
    I know this sounds cliche. But don't many many developers hate debuggers with a passion? They can be extremely useful at times, but they can definitely get in the way. There has been at least 3-4 times in my career when a debugger was actually causing problems to happen! That ain't right.

    Also, using a debugger often requires learning a new IDE. The best ones are usually integrated with some IDE that I otherwise hate. I understand why that would be the case, but I still hate it. I don't want to learn a new IDE!

    --naked

    --
    Very popular slashdot journal for adul
  14. Maybe they don't really need improvement by elsegundo · · Score: 1

    All I want from a debugger is to be able to step through code and see values of my variables at certain points and verify program flow.

    Most often I'll use it as a tool alongside using printf's or println's and (gasp!!!) just sitting down and reading the code in question.

    Debuggers are useful, but I see too many freshouts using them exclusively to fix code, rather than just looking at the code to analyze the design.

    --


    The revolution will be televised. Blackout restrictions apply.
  15. Real Men Don't Use Debuggers by dilute · · Score: 3, Redundant

    Strategically embedded print statements - the time-honored way to find bugs.

    That plus printing out and actually READING the code. Amazing what you can find by walking out of range of the screen and keyboard and just reading through the stuff.

    1. Re:Real Men Don't Use Debuggers by patter · · Score: 1

      Debugging without an interactive debugger is much more fun.. you get to see such gems as:

      printf("I'm in the fscking DoStuffRightThisTime() function!!");

      I've yet to see a function in MSVC++ that lets me curse when I'm frustrated by something not doing what I thought it should be ;). If I'm really frustrated I can always loop a few hundred times with my favorite expletives :P.

      --
      -- If at first you do succeed, try to hide your astonishment. -- Harry F. Banks
    2. Re:Real Men Don't Use Debuggers by Anonymous Coward · · Score: 0

      You got balls to admit that. I wouldn't but I agree. If you understand the software you are working with then a series of print statements with an editor that has a undo feature and you have all tahe debugger you ever need. However, there are times working a multitasking real-time program that a debugger is useful to understand the timing relationships between the tasks.

    3. Re:Real Men Don't Use Debuggers by hyperturbopete · · Score: 1

      what about when you're trying to discover what goes on inside some piece of other people's code, or library code

    4. Re:Real Men Don't Use Debuggers by Pinball+Wizard · · Score: 3, Insightful
      Strategically embedded print statements - the time-honored way to find bugs.


      Doesn't work very well with recursive functions. Especially recursive functions that call other recursive functions. Ever tried to write a recursive descent parser? Next to impossible without a good debugger. You need to be able to step through the code line by line and watch variables as they are loaded on to(and popped off) the stack. No way are print statements going to be nearly as helpful.

      --

      No, Thursday's out. How about never - is never good for you?

    5. Re:Real Men Don't Use Debuggers by lakeland · · Score: 2

      I don't entirely disagree with your point, but print statements can debug recursive functions. Just print a number of spaces equal to the recursion depth at the start of the line.

    6. Re:Real Men Don't Use Debuggers by beebware · · Score: 1

      I usually have a debug function in my program which uses a global variable to keep track of it's "depth". Other functions call it with things like debug(enterfunction,"function name") or debug(variable,"change x to 53") and the global variable helps every become nicely indented in the output. Skim down to the bottom of the output and work your way backup and you get to see where the problem is, under what conditions etc.

      Add in a few more parameters to the debug function and you can then start to specify whether it produces a debug log or not (yes on development machines, no on others), what items to put in the log etc etc.

    7. Re:Real Men Don't Use Debuggers by sholden · · Score: 2
      I don't entirely disagree with your point, but print statements can debug recursive functions. Just print a number of spaces equal to the recursion depth at the start of the line.

      How do you know the recursion depth?

      Adding a global/static/whatever_the_language_uses variable and the code to increment and decrement it is not just adding print statements after all.

      Way back when I did CS2 all of us (other than the wussy Engineers) had to write a recursive descent parser for a pascal like language, to generate MIPS assembler. 99% of the student didn't use a debugger aside from using gdb to get a stack trace from a core file (ie. not running the code in the debugger at all). Most of us managed to get it working using fprintf(stderr,"How the fsck did it get here") statements...

    8. Re:Real Men Don't Use Debuggers by Anonymous Coward · · Score: 0

      How true this is. As for the recursive functions preventing a proper use of print debugging you are just plain wrong. What is even better then using print statements to debug and reading the code is 'GASP' commenting it when you write it NOT after. it is amazing how well commented code debugs it's self

    9. Re:Real Men Don't Use Debuggers by Matts · · Score: 2

      I wrote perl's XML::SAX::PurePerl - a pure perl recursive descent parser entirely with the aid of print statements. I never use a debugger - I can't recall the last time I used one except for getting a stack trace.

      However I used to use debuggers. I just find that the more mature a programmer I become the more I know almost exactly where the bug is as soon as its described.

      --

      Matt. Want XML + Apache + Stylesheets? Get AxKit.
    10. Re:Real Men Don't Use Debuggers by Anonymous Coward · · Score: 0

      I belive you are ovelooking the usage of debuggers as a post-mortem examination tool (this is pretty much how I almost always use it). Printing isn't that helpful when you have half a million lines of code that dumps core after 3 days. As an integrator I can't possibly know all of someone else's code. Another aspect is somekinda blind debugging (foo gets corrupted; shove in a watchpoint for foo and get the culprit). The list goes on ... Basically there are people who need to debug but can't really know the code.

    11. Re:Real Men Don't Use Debuggers by ctr2sprt · · Score: 2

      Then you're doomed to use truss or strace or whatever, because a normal debugger won't help you there anyway.

    12. Re:Real Men Don't Use Debuggers by Pinball+Wizard · · Score: 2
      Way back when I did CS2...99% of the student didn't use a debugger

      Well, being a somewhat experienced programmer who decided to go back to school and finish my degree - I agree with you, most students haven't bothered to learn how to use a debugger.

      BUT...I did a few programming projects with some friends of mine and I showed them how much easier it was to follow what was going on with a debugger. It was like a light turned on for them. And they were thankful for the hours of work it saved them.

      I'd have to believe that if nothing else learning how to debug would save lots of hair being pulled out by CS students. Especially those little errors like a variable going out of scope or a line or two of code that is in the wrong place - a debugger will help you catch those types of things immediately, whereas even with the print statements you still might take a while before you catch those types of things.

      --

      No, Thursday's out. How about never - is never good for you?

    13. Re:Real Men Don't Use Debuggers by Anonymous Coward · · Score: 0

      That's a very neat point. For immediate problems and when all the code I write is my own I don't worry about things nearly as much. Usually however when my program dumps core after three days I should have caught it in pretesting. Special cases usually only happen to the greedy guy down the hall who wants the app to do this plus that, while he/she only has time for that.

    14. Re:Real Men Don't Use Debuggers by etedronai · · Score: 1

      Don't you think that you are missing the whole point of the article. The point was that strategically embedded print statements are the lowest common denominator for debugging and have been used for thrity years while the rest of the computing industry has advanced. How come the debugging tools haven't advanced at the same pace? There must be a better way of doing debugging, just as programming methodologies have advance debugging methodologies must also advance(in parallel where possible). I personally believe that debugging methodlogies will not advance without language design at least taking into consideration that programs will be written in a language and that those programs will need to be debugged. Without this consideration all that developers will ever have is strategically placed print statements(which is all that breakpoints and watches are anyway though in a slightly different form). For debugging to easier debugging has to be more automated and less done by hand. The only way that I can see this being accomplished is if there is some more advanced way to call out what the intent of a section of code is and have a debugger available that can help debug intent. Otherwise debugging will just continue to be print statements.

  16. println debugging by kisrael · · Score: 4, Interesting

    I don't know if it's my greatest failing or greatest success as a developer, but I tend to be a println debugger all the way.

    Recently I remember seeing some justification/defenses of this technique, I think it's sometimes called "logging based debugging".

    When something goes wrong I figure out the related assumptions I'm making, and then test 'em by output to STDOUT or STDERR or a file. It avoids some of the "Heizenbug" problems debuggers can bring on (so long as dumping output can be reasonably expected to be reliable w/o bringing on crossproblems) and by thinking of your assumptions, you're tying into principles similar to "write tests first", part of XP practices.

    One set of things this doesn't handle well is memory leaks and bottlenecks and looking out for runaway object creation and the like, but garden variety debuggers usually don't cover that too well either, you need special profiling tools anyway.

    --
    SO YOU'RE GOING TO DIE: The Comic for Dealing with Death
    1. Re:println debugging by William+Tanksley · · Score: 2

      Logging based debugging is excellent, and with a slight refinement can give HUGE benefits. Specifically, every time you want to log some debug information in a function, instead refactor the function to make all the information available via an API, and test that API in your unit tests.

      As a result, your unit tests grow to express how you think your software should work; thus, later changes can be made without having to worry about violating implicit assumptions (because all the assumptions you know about are explicitly and automatically tested).

      As a bonus, you don't wind up inserting print statements into the control flow, and therefore you can catch more bugs in more situations.

      This has worked for me for quite a while. It gives you superb testing almost for free -- and it also has the nice side effect of teaching you better API design, since when you make a bad API you'll have to correct it later in order to debug it. (This effect isn't as nice as it is in Test Driven Design, where you can't code a bad API because your design was implemented to satisfy and already-written test).

      -Billy

    2. Re:println debugging by chown · · Score: 1

      I don't know if it's my greatest failing or greatest success as a developer, but I tend to be a println debugger all the way.

      I'm working on a project at the moment where this is the ONLY way to debug things. And yes, this is usually the first thing I do in any case, but good lord I really wish we had a "real" debugger.

      It's very time consuming to use logging-based debugging to examine complicated interrelationships in your code. If all you need to know is "What was the value of variable xyz at this point in the code?" then anything other than println's is probably overkill.

    3. Re:println debugging by jgerman · · Score: 2

      I believe that all methods of debugging are useful at some point. But I tend to use the print debugging first. Not only does it do the things you said, but it also tells you very quickly if you're assumptions are wrong, giving you a clear idea of the correctness of the program very quickly.

      --
      I'm the big fish in the big pond bitch.
    4. Re:println debugging by Synn · · Score: 2

      I do this with PHP all the time. I write up some code and certain classes a few levels down don't call or work like I expected, so I toss in some print "made is this far" lines here and there and I can see where it's making it or not making it.

      Then I use prints to inspect values to see where I'm messing something up.

      It's worked for 5 years, though I supposed I should use some sort of "real" debugger or something.

    5. Re:println debugging by kisrael · · Score: 1

      Heh, javascript is where I really need those 'made it this far' messages, given its tendency to kind of quietly abort in some cases if there's a big error.

      --
      SO YOU'RE GOING TO DIE: The Comic for Dealing with Death
    6. Re:println debugging by kisrael · · Score: 2

      It's very time consuming to use logging-based debugging to examine complicated interrelationships in your code. If all you need to know is "What was the value of variable xyz at this point in the code?" then anything other than println's is probably overkill.

      I'm not sure how I'd use a regular debugger to examine a complicated interrelationship, honestly. (which probably says something about my debuggerability (eww, that sounds gross)) Could you or someone come up with some example of the kind of view a good debugger provides, that moves beyond the "value of variable xyz", and would be helpful in seeing the relationship side? (This isn't a rhetorical point I'm trying to make, I'm just not smart enough to think of an example myself.)

      --
      SO YOU'RE GOING TO DIE: The Comic for Dealing with Death
    7. Re:println debugging by DraconPern · · Score: 1

      printing to a file for debuging doesn't work too well for multithreaded applications because the printing can and will affect how your resources are locked and unlocked.

    8. Re:println debugging by yoriknme · · Score: 1

      Microsoft gives away their .Net framework- or you can buy the CD for a nominal fee. Now, if you want the IDE and debugger, that might cost you 600 bucks or whatever. Println statements are ok, some great programmers use em, but theres nothing like waving a mouse over a variable to see whats in it. Especially if a boss wants to walk thru the code with you. Or youre in a hurry. I just cant imagine not using a debugger. Added features in a C++ debugger might be seeing more template code.

  17. Debuggers are mostly useless by Julian+Morrison · · Score: 2

    Real debugging uses (1) printf calls to trace execution path, dump variables, and detect the crash point down to the nearest few lines (2) eyeballs and brain to spot the goof now its position is locked down. Debuggers are just for the wierdass bugs, and mostly they break differently in those cases anyway, because they're singlestepping not running full tilt.

    A good debugger for those cases whern one's needed is DDD.

  18. Durr by mao+che+minh · · Score: 2
    "How Would You Improve Today's Debugging Tools?"

    Make them work better at debugging. What a pointless story/question this is.

    1. Re:Durr by blahlemon · · Score: 1
      Actually I think that they were looking for something a little more constructive then stating the obvious! lol. Something like "Have debuggers understand how to program independantly so they can parse through the code and identify the errors for you"

      You know, like In Soviet Russia your code debugs YOU!

      --
      It take more faith to believe in evolution than it takes to believe in God
    2. Re:Durr by Anonvmous+Coward · · Score: 2
      "How Would You Improve Today's Debugging Tools?"
      Make them work better at debugging. What a pointless story/question this is."


      "What is the cause of most plane crashes?"

      "What a dumb question. It's gravity!"
  19. Eclipse debugger by LadyLucky · · Score: 2

    Is miles in advance of earlier versions of debuggers. Change code at runtime, you sexy beast.

    --
    dominionrd.blogspot.com - Restaurants on
    1. Re:Eclipse debugger by Anonymous Coward · · Score: 0

      JBuilder has had this ability for a looong time. Its been a step ahead of Eclipse (on the Java side).

      Personal version is also free.

    2. Re:Eclipse debugger by _Swank · · Score: 1

      well, i believe visualage for java had java hot code replace before jbuilder and (ever so loosely of course) vaj was the precursor to eclipse (ok, they're completely different apps, but from a ibm product standpoint...anyway i'll shut up now).

      however, eclipse didn't have hot code replace until 2.0 and it only has it for 1.4 jvms as it's theoretically trying to go with standards rather than do some fancy trickery.

    3. Re:Eclipse debugger by Anonymous Coward · · Score: 0

      Riiiight....I've been changing code on the fly in IBM VisualAge Java for years.

  20. some ideas on why debuggers are in this state by Shaleh · · Score: 5, Interesting

    a) it is hard to make money on debuggers

    b) making a good debugger is definately not easy

    c) many developers prefer puzzling out the code on pen and paper then walking it in a debugger. Quite a few I have talked to believe that they make better code if they can solve the problem without resorting to debuggers. This BTW is why Linus does not like kernel debuggers.

    d) most of the debuggers are good enough and as we all know from open source, a good enough solution will live forever. The existence of a debugger that mostly works gives most people a reason to spend their time elsewhere.

    In my experience I have truly benefited more from programs like Purify or Insure (and now the great valgrind) than I have from a debugger.

    1. Re:some ideas on why debuggers are in this state by yakovlev · · Score: 1

      I agree with you with respect to Purify and the like. This seems to really be where most of the innovation is happening in debugging tools.

      They're less general purpose, but they tend to catch things that are substantially more difficult to debug with a normal debugger.

    2. Re:some ideas on why debuggers are in this state by Anonymous Coward · · Score: 0

      You left out some other major reasons.

      1. Most programmers do not know how to use/properly use a debugger.

      -- Debugging using printf's and #if's is poor programming practice but the tool most programmers use.

      2. Compilers provide support for debuggers (i.e. symbol information) but programmers cannot. They can only interact with the debuggger.

      -- How many compiler/debuggers do you know that let a programmer provide debugging information from within the program. This is typically done using cumbersome calls that in turn require #if's to get rid of the debugging code.

    3. Re:some ideas on why debuggers are in this state by anshil · · Score: 2

      -- Debugging using printf's and #if's is poor programming practice but the tool most programmers use.

      Why can you say is it poor programming practice? Any proofs on that, or just a postultate. It's experience after the years we learned how to find a bug quickest, most expirienced programmers tried both ways, using a debugger, using printfs, using debug() macros etc. We will use the ones we find out which work fastest, and honestly most times I find bugs in highlevel applications the fasted way using printf's. Why? First using a debugger can significantly change the behaviour of a program, not all programs can be stepped, when in example the application talks to hardware, talks network protocols, uses GUIs, you get timeouts other timing behaviour, or often when the bug results out of reading undefined memory, it's often different in a debugger environemnt. The bug just isn't there then. Second reason is printf you get on stdout very quick an overview whats happening where, while in a debugger you have to step into evey point. Honestly there are error that can be found quicker with and ones that can be fount quicker without a debugger. Experience should tell you when to use which.

      --

      --
      Karma 50, and all I got was this lousy T-Shirt.
    4. Re:some ideas on why debuggers are in this state by iabervon · · Score: 2

      Purify and valgrind (an open-source memory debugger) are debuggers; I just wish that valgrind had the features of ddd and would show you the contents of memory (or had gdb-like features, so ddd could connect to it). In particular, it would be really helpful for finding memory leaks where you're still holding references but will never drop them (a problem that occurs even in garbage-collected languages like Java).

      But it's really great to be able to debug UMRs, FMRs, and FMWs, which generally cause rare unpredictable behaviour or crashes at a random location later in the program (usually in malloc). I just wish there were also checks for "this pointer, which started out pointing to this chunk of memory, now points to a location in a different chunk of memory due to arithmatic not involving the two addresses", which would catch buffer overflows. I recently fixed about a dozen memory leaks and UMRs in a few evenings in a large program with a straightforward application of valgrind.

      I also think there's a lot of progress in static debuggers, which are more similar to the pen and paper method, but without the programmer's possibly incorrect expectations. Of course, the program (the Stanford checker) hasn't yet been released to the public, but they say they will eventually.

  21. VB has one of those debuggers by sdjunky · · Score: 5, Informative

    Visual Basic supports a "watch" that allows you to break on condition such as when a variable changes at all or if a variable is set to a certain value. This is beautiful when trying to figure out how the currency value you just had disappeared. Add the watch saying when the currency = 0 and run the app so it breaks at ANY MODULE at ANY TIME.

    This saves me time by not having to go into each module and watch the code to see if the value changes.

    As for wanted features ( so as to not be totally off topic ) I really can't think of any that I would need per se. Since my favorite language is VB ( watch the flames poor in on that statement ) I have many tools for debugging that are perfect.
    From the immediate window so I can run small snippits of code in break mode to the stack and watch windows.

    1. Re:VB has one of those debuggers by Anonymous Coward · · Score: 0

      Since my favorite language is VB...

      Someone has karma to burn! :)

    2. Re:VB has one of those debuggers by Anonvmous+Coward · · Score: 4, Insightful

      "Since my favorite language is VB ( watch the flames poor in on that statement )..."

      I don't really understand Slashdot's attitude about VB. I don't consider myself a programmer, but I've been able to use it to automate some stuff in Windows. I think it's great, especially when it comes to creating GUIs.

      Every language has its strengths. Making of of VB because it doesn't do something another language does is like making fun of cars because they can't fly. Nobody's going to use a 747 to take a trip to 7-11.

    3. Re:VB has one of those debuggers by The+Bungi · · Score: 1
      The VB debugger is the absolute best I've ever worked with, possibly followed by the VC++ graphical debugger and WinDbg. Edit and continue is definitely an impressive feat of software engineering.

      But it promotes crappy code. It lets you "play" with your code until "it works" instead of it being just a tool to find problems. There are waaay too many VB programmers out there that graduated from the "edit and continue" school.

      The managed .NET debugger is (IMO) nothing to write home about. It's too slow right now. The Everett (RC1) version is a bit better and has less bugs, but it's still a bit slow for my taste.

    4. Re:VB has one of those debuggers by fredrikj · · Score: 3, Insightful

      Since my favorite language is VB

      Personally, I think of VB as a scripting interface for Windows GUI work rather than an actual programming language, but that is also its strength. There is no perfect programming language - they all have their pros and cons, and while VB is slow compared to C++ for calculations, VB is extremely handy for operating a GUI - an area where C++ is tricker.

      One shouldn't try to drive a screw with a hammer just because the hammer is more 'elite' - use the right tool for the job.

    5. Re:VB has one of those debuggers by Iamthefallen · · Score: 1

      Uhm, but that's not the tools fault, that's the fault of bad programmers. The reason VB has such a bad rep is because so many inexperienced people use it, which in turn is because it is so easy to learn and use.

      --
      Wax-Museum Fire Results In Hundreds Of New Danny DeVito Statues
    6. Re:VB has one of those debuggers by vadim_t · · Score: 4, Insightful

      Ah, but here's the problem. People fail to understand the purpose of VB far too often.

      VB is great for writing small apps. If say, you want to write a program that takes photos at an interval and automatically saves them in /images/yyyy/mm/dd/hh_mm_ss.jpg then it's a wonderful thing. Add a webcam component, then another for jpg (VB can only save BMP), and in a few minutes it will be done.

      Now, the problem begins when this little program grows. If you try to write big apps with VB you'll fairly soon start hitting its limitations, writing workarounds, having to put up with completely idiotic bugs like project files that break by themselves... and you end with a complete piece of crap.

      Also, pretty much anything that can be done with VB can be done in Linux with Perl and PerlQt, perhaps with some help from other apps. Pretty much the only thing I couldn't find a replacement for is such a great debugger.

    7. Re:VB has one of those debuggers by cowbird · · Score: 0, Offtopic

      The attitude is easy to explain: VB sucks ass.

    8. Re:VB has one of those debuggers by Otter · · Score: 1
      I don't really understand Slashdot's attitude about VB. I don't consider myself a programmer, but I've been able to use it to automate some stuff in Windows.

      And the people yapping mindlessly about VB know how to type ./configure && make and compile linux kernels and therefore do consider themselves programmers. I wouldn't take anything they say seriously.

      (Not that there aren't some knowledgeable posters making valid criticisms, as well..)

    9. Re:VB has one of those debuggers by stratjakt · · Score: 1

      It's a tool - it all depends how you use it.

      I edit and continue all the time, if I'm stepping through something and see an obvious typo.

      The problem isn't the VB programmers from the "edit and continue" school, it's the ones from absolutely no schooling at all when it comes to program design and implementation.

      --
      I don't need no instructions to know how to rock!!!!
    10. Re:VB has one of those debuggers by The+Bungi · · Score: 1
      Right, and that's my point - the best debugger in the world will not help you if you happen to suck at writing code to begin with. And it's not very helpful if the tool itself promotes the bad habits, though of course that's not the tool's fault, as you say.

      A debugger should be the last thing you use when you're writing your application - it shouldn't be integrated into your coding strategy and it shouldn't be the thing you use to figure out that you happen to suck at writing code =)

    11. Re:VB has one of those debuggers by nother_nix_hacker · · Score: 1

      Every language has its strengths. Making of of VB because it doesn't do something another language does is like making fun of cars because they can't fly.

      I would take the piss out of a car if it defaulted to a 16 bit integer.

    12. Re:VB has one of those debuggers by BigMattG · · Score: 1

      Since my favorite language is VB ( watch the flames poor in on that statement)

      I think you probably mean "pour," though there's not likely to be much meat left for the
      grammer Nazis after that VB remark. :)

    13. Re:VB has one of those debuggers by sqlrob · · Score: 2

      Not completely.

      Where's threads?

    14. Re:VB has one of those debuggers by NanoGator · · Score: 2

      "Making of of VB because it doesn't do something another language does is like making fun of cars because they can't fly. Nobody's going to use a 747 to take a trip to 7-11."

      A friend of mine ran across a porn site that gave away 10 free images a day. He got sick of manually saving and renaming all of the images from that site at a given interval. One evening I wrote him a little VB app where he could plug in URLs to the JPGs, then set the interval, then set the destination folder so he could automatically download and save the images with incremental file names.

      I didn't have to do anything fancy to do this. Most of the hard work (like opening a URL and downloading the images, or the Save As dialog, etc) was already written and ready to go. I just needed to tie it all together with a UI. It's not something I'd want to give away, but for this guy it did exactly what he wanted.

      Personally, I think VB'd have a nice little market if it came with Windows. For doing quick little hack jobs it's great. It's hard to justify the price tag it has today.

      --
      "Derp de derp."
    15. Re:VB has one of those debuggers by mark_lybarger · · Score: 1

      while it's probably true that many inexperienced people use vb, i wouldn't asertain (sp?) that is the reason it has a bad rap.

      experienced developers will throw a few screens together for a prototype to show management/customers and bam, that's the final product. "polish it up in a week or so", says mgmt, "and we'll be good to go". that's how vb got a bad rap.

      someone else mentioned QT, and qt can also do rapid prototyping (is there a designer for windows?), even just knowing the classes you can throw together a screen look fairly quickly. the positive is that you're now using an oo C++ layer which can be sub-classed till you're blue in the face if that's what you need. you also have a lot more flexability in the control of the app than with VB.

      so, once again, the root problem isn't developers, but rather management. management who wants a prototype tomorrow, then insists that it looks soo good that we'll just turn it into the final product for launch next weekend. if only those management folks could code any thing more than a little COBOL or a little HTML (mostly using MS Word save as feature) we could stick them with maintaining the prototype junk and see how long before a rewrite is in order.

    16. Re:VB has one of those debuggers by Anonvmous+Coward · · Score: 4, Funny

      "The attitude is easy to explain: VB sucks ass."

      Whoah, I'm glad you showed up! My opinion of VB has completely changed now that you've tuned me in to that little fact. I didn't fully realize the scope of the problem until I realized that my ass would be sucked!

    17. Re:VB has one of those debuggers by Anonymous Coward · · Score: 0

      Or the grammar Nazis, for that matter.

    18. Re:VB has one of those debuggers by sdjunky · · Score: 2

      Spell checking the post would have been a good idea.

      Good job on catching me on that one.

    19. Re:VB has one of those debuggers by Anonymous Coward · · Score: 0

      Grammar, not grammer. Yeah...

    20. Re:VB has one of those debuggers by arf_barf · · Score: 1

      It depends on how organized the project is. I have worked on VB apps that had > 650.000 lines of code and they were fast and easy to work with. But, I also have seen apps with 1000 lines of code that were absolute crap.

      In the end it depends on the programers and their tools if the project is succesful. VB gives me most of the tools, now all I have to show is some discipline and a lot of project design skill....

      As for debuggers, one of the biggest issues I find in most IDE is poor error trapping support. It's so easy to NOT to write error traping code...and it would be nice to have that chore taken from our hands.

      Btw, you cant compare debugging tools of script langauges (VB or Python) to debugging tools of C or C++, because the former are script languages and give a lot of lexibility when debugging apps.

    21. Re:VB has one of those debuggers by GigsVT · · Score: 1

      For doing quick little hack jobs it's great. It's hard to justify the price tag it has today.

      Especially since a 10 line Bash script in cron would do the same thing.

      --
      I've had enough abrasive sigs. Kittens are cute and fuzzy.
    22. Re:VB has one of those debuggers by Iamthefallen · · Score: 2

      Where are the buttons in assembly code?

      While threads and multithreading surely is nice, the typical VB app can easily live without them. VB is hardly the language to use for heavy number crunching. You use VB to present a frontend to the user and do lighter processing on the user end, if you need to, you use C/C++ behind it to get the heavy stuff done.

      --
      Wax-Museum Fire Results In Hundreds Of New Danny DeVito Statues
    23. Re:VB has one of those debuggers by SocietyoftheFist · · Score: 1

      A watch you say??? Holy cow, somebody should incorporate something like that into every other debugger out there... wait a minute, every debugger I've ever used has had watch points. I can only assume you are naive or were trying to go for a laugh.

    24. Re:VB has one of those debuggers by dillon_rinker · · Score: 2

      I like VB; it does well what it does well, like any tool. When misused, of course it's problematice (ever drive a screw with a hammer?) VB is not an application development language. It is a scripting language that was originally conceived as a GUI prototyping tool. You could quickly and easily find out where your users liked where you'd placed OK and Cancel in dialog boxes. You can write usable apps with it if they're not too large, and, quite frankly, most business apps that VB is suitable for are better implemented as standalone Access databases. Where it shines is in Windows administration (which is how I pay the bills).

      It's seen wide usage in application development because the PHBs of the world have realized they can hire a kid with two semesters of VB programming under his belt and watch him and churn out commercially acceptable results. Ask yourself this...would you design a commercial airliner that was powered by a lawnmower engine? Would you build a skscraper out of wood? Would you write a 100,000-user database in VB?

      Note that in the early days of flight, airplanes were run by small engines, early commercial buildings were built out of wood. Large business apps are currently written in VB. Eventually there will be some sort of licensing or regulation for programmers and the situation will change dramatically. (We can't have large numbers of buggy programs installed on the National Information Infrastructure, after all...*cough* Windows *cough*...somebody could zombie them and DOS the internet out of existence!)

      Shrug. Do what works for you. But remember that the makers of VB are the people who, before the release of VB5, hyped at EVERY VB conference that there would be NO VBRUN50.DLL! (instead there was a MSVBVM50.DLL - same problem, different name)

    25. Re:VB has one of those debuggers by dubl-u · · Score: 5, Insightful

      Now, the problem begins when this little program grows. If you try to write big apps with VB you'll fairly soon start hitting its limitations, writing workarounds, having to put up with completely idiotic bugs like project files that break by themselves... and you end with a complete piece of crap.

      Amen. If people knew that whenever they needed write a program longer than a page that they should switch away from VB, I'd have no complaints with it. Instead, it is marketed in such a way that it gives amateurs the notion that they're just as good as any professional programmer. It's as if people thought that buying a Tinkertoy kit made them able to build houses.

      I don't know how many projects I've seen where someone has knocked together a prototype in some half-baked language like VB. Then people want another feature and another, and nobody is willing to say: "Stop! We must throw this crap out and start again using appropriate tools."

      (For the record, I hear that VB.NET is a big improvement over the execrable VB6. Of course, given that all .NET languages seem to be minor syntax variations on Java, maybe that's not too surprising.)

    26. Re:VB has one of those debuggers by Iamthefallen · · Score: 2

      Ah, I read your other post and I see what you mean, and I agree to some extent. A while ago I was taking some MS certification classes, and it was not an uncommon thing to see the behaviour you speak of. Well, that, and various other weird stuff...

      Not because of the way VB itself works, but because at times it seems some of the bad practices out there are promoted by MS marketing staff writing technical documents.

      --
      Wax-Museum Fire Results In Hundreds Of New Danny DeVito Statues
    27. Re:VB has one of those debuggers by blincoln · · Score: 2

      Personally, I think VB'd have a nice little market if it came with Windows. For doing quick little hack jobs it's great. It's hard to justify the price tag it has today.

      You can write VB scripts without any additional tools. Your pr0n process would (IMO) be easy to set up as a vbs file.

      --
      "...always new atoms but always doing the same dance, remembering what the dance was yesterday." -Richard Feynman
    28. Re:VB has one of those debuggers by rmdyer · · Score: 1

      Yea, but VB had these features 10 years ago.

      Come back down and live with us.

    29. Re:VB has one of those debuggers by Dalcius · · Score: 1

      I'll echo the other reply to your post. I'm a huge perl fan (where it's applicable of course).

      I've written some stuff for VB. The most complex thing I wrote was a server/client chat program. To give you the scope, it had public and private (shown or not shown) chatrooms, each with or without a password, server querying, news functions, away messages, sleep mode (a la ICQ), logging, server info posted to a website, user accounts, and custom graphics, icons and sounds. Compared to C/C++, etc., VB was an excellent choice for this because it was a program to be used by a small, loose organization. It didn't take me long at all to get this up and running.

      However, when dealing with variable casting, what was, IMO, a poor look and feel and poor resolution scaling, APIs that were often poorly documented, etc., I found that VB just wasn't worth the hassle. For what it did, the chat program ran quite slow.

      Now, whenever I have to do a small task, I usually just script it in Perl. I've written a handful of utilities for myself, and I've written a good number for the company I work for. Most of them involve servicing any number of our ~50 client sites. It's astounding how easy it is to automate tasks with Perl or other similar languages, especially in a *NIX environment. Most folks who use VB won't understand that and will likely blow off "that *NIX crap", but I think most folks would be surprised.

      [/ramble]

      --
      ~Dalcius
      Rome wasn't burnt in a day.
    30. Re:VB has one of those debuggers by xswl0931 · · Score: 1

      VBA and VBS can be thought of as scripting languages, but VB itself is compiled code. Personally, C# works well for writing Windows GUI apps, the simplicity of VB and the power of C++.

    31. Re:VB has one of those debuggers by Anonymous Coward · · Score: 0

      ( watch the flames poor in on that statement )

      I'm always amused by the poor spelling abilities of coders... especially when they're talking about the problems they have with debugging.

    32. Re:VB has one of those debuggers by Anonymous Coward · · Score: 0

      and you have places like PG&E (Pacific Gas and Electric) using VB. You have places like the California Energy Market using it! (oh, now they use Delphi)... let's just say that No One that uses VB seems to understand this.

      Java is VB done right... and even it cannot free itself from a certain amount of suckage.

    33. Re:VB has one of those debuggers by Dalcius · · Score: 1

      School doesn't always help either.

      School is the best way for most folks to learn data structures, etc. But when you have plenty of time and everything is so nice and clean-cut as it is in school, doing things as the instructor tells you and just hopping from project to project comes naturally.

      It's when you go back and debug that code that you realize the benefit of good code. And it's when you have a manager over your shoulder screaming "FINISH IT! FINISH IT!" that you realize the pressures to write bad code.

      When you get out into the real world, the requirements aren't clean cut: you have to implement something and say, "How's this?", after which you get another list of features to add. After time, it all becomes one gigantic hack.

      When you debug a codebase that's 20+ years in the making and founded in Fortran, that's when you realize the importance of good code and that's when you start putting more pressure on bad management to have a clue about what they want, and even moreso, to give you a little more time to turn a hack job into something with some decent abstraction and modularity. You have to make them understand that *everyone* will pay for it (both literally and figuratively) later if you don't take some time to make the code semi-clean and semi-possible to modify.

      I learned good habits before I went to school by gradually developing a semi-complex, dynamic website written in Perl. After so many times of going back and dealing with bad code, you develop good habits.

      --
      ~Dalcius
      Rome wasn't burnt in a day.
    34. Re:VB has one of those debuggers by MrResistor · · Score: 2

      My problem with VB is the same problem I have with all MS products: features are more important to the developers than stability or consistency. It's the little braindead things like (in VB.NET) 'Dim MyArray(4)' creates a 4 element array (0-3), but 'ReDim MyArray(4)' gives a 5 element array (0-4), that make me hate VB. There were similar stupid things in VB6, but thankfully it's been long enough since I've used it that I can't think of an example off the top of my head.

      This is only aggravated by the fact that VB seems to actively encourage unorganized source code, which makes VB source much more difficult to work with.

      Anyway, those are my own dislikes about it. I hope that gives you some insight into the general feeling on /.

      --
      Under capitalism man exploits man. Under communism it's the other way around.
    35. Re:VB has one of those debuggers by Anonymous Coward · · Score: 0

      I think some people like that.

    36. Re:VB has one of those debuggers by pyrrho · · Score: 1

      concept nazi comment:

      that's speeling nazi you are thinking of, not grammar nazi of.

      --

      -pyrrho

    37. Re:VB has one of those debuggers by Anonymous Coward · · Score: 0

      Or spelling nazi, for that matter.

    38. Re:VB has one of those debuggers by Anonymous Coward · · Score: 0

      "Also, pretty much anything that can be done with VB can be done in Linux with Perl and PerlQt"

      But aren't you getting into the same problem again? Perl is great for small things, but not for large applications.

    39. Re:VB has one of those debuggers by smallpaul · · Score: 2

      VB is a good tool. It is a great environment. But it is a terrible, terrible programming language. Slashdotters flame VB because it offends us that such a horrible language could rise to widespread popularity because it happens to be wrapped in a very productive GUI development environment.

    40. Re:VB has one of those debuggers by Anonvmous+Coward · · Score: 2

      "Anyway, those are my own dislikes about it. I hope that gives you some insight into the general feeling on /."

      Not really. Thing is, you've used it. It's obvious you've used it, and you have legitimate complaints about it. I don't normally see that here when I see anti-MS sentiment here. It's usually "MS is completely incompetant, it's a totaly mystery to me why they're so used so much. Everybody must be stupid"

      Believe me, I wouldn't be complaining if I heard more comments like yours instead of the FUD crap I normally hear.

    41. Re:VB has one of those debuggers by mrlpz · · Score: 1

      No project of that size is THAT organized. You can throw SourceSafe, PVCS ( heck, even CVS ) at managing code changes. You can have a "On High" venerable architect that could debug paper tape programs, when you were still in your diapers, and STILL you cannot escape the thrillsome threesome, BLOAT, OVER_CODING, and NEAT_HACKS. VB HAS to have so many tools, because it is so hard to do some things that "generalized object supporting languages" like C++ and object-based languages like Java do inherently. You want to create classes and object in these other languages, you just do it. You want collection objects, fine they're there. Good GOD ALMIGHTY if I never have to do a REDIM (blurb) PRESERVE again, I will be a happy man. And help you if you have to actually talk to the API. You've got to import this, and declare that. Heaven help you man, don't you understand that VB was the thought of some weanie ( three guesses who )who thought he could remove people from having access to the precious Windows API itself, (Gee I wonder why you wouldn't want to publish System API's, Hmmm ?? No matter, let the courts sort it out right ?). Then people actually decided they really needed to access certain things in the system. Ooops, we better give'm a way to access the API, fellas. Get off of it. Ever try to declare a public structure and share it among modules in VB ? In C/C++ all it takes it ONE little word "extern". That's it. VB..a programming language ?! Bah-Humbug !

    42. Re:VB has one of those debuggers by SocietyoftheFist · · Score: 1

      and it appeared in debuggers long before that.

    43. Re:VB has one of those debuggers by vadim_t · · Score: 1

      Well, not really. First, Perl is a much more stable and debugged language. VB wouldn't be so bad if it didn't have some horrible bugs that tend to appear in the most inconvenient moment. Also Perl lets you access pretty much all the system stuff, at least in Unix, has lots of free modules for almost everything.

      Now, VB. First of all, the access to most system stuff is hidden. So if you say, wanted to write a task manager app like the one in NT and Win2K, your program would end full of WinAPI calls. At that point probably it wouldn't cost much to just write it in C, since the VB code would be almost inexistent...

      Classes. While in Perl OO isn't wonderful, at least it has inheritance. Oh, I almost forgot about the way of getting "inheritance" in VB6 by writing a class full of one line functions that call the original one.

      Binary files associated to forms. Doesn't work well with source control tools.

      ActiveX. Major pain in the arse. For some reason references to ActiveX objects that work just fine on one computer might disappear if you move the source to another.

      Syntax. A few examples:
      foo = function(1,2)
      do_something 1,2
      Line (0,0) - (10,10), 1, BF 'You can't write a function with this syntax
      if IsNull(Variable) then
      if Variable Is Nothing Then
      if Variable Is Null Then 'The IDE makes 'Is Null' capitalized as if this worked, but it actually doesn't.

      And that's not even half of the stuff you'll have to deal with...

    44. Re:VB has one of those debuggers by crazyphilman · · Score: 3, Insightful

      Wow, you really hate VB. Before I answer your post, let me say that I hate VB's syntax, the fact that it's not truly object oriented, and the weird, back-asswards way it does things. So I'm not totally against you on this. I'd rather be working in C++ or even C, so take the following in context, ok?

      VB *CAN* be used for relatively larger projects, BUT, it depends on what kind of programmer is involved. I've inherited some semi-large VB projects, including a three-tier client-server setup built from VB programs, MTS dlls, ASP pages, and a pretty big database, with a lot of lines of code (not just a page). Luckily for me, the original programmer had an engineering background, so his code was pretty tight and the project was in pretty good shape. I made beaucoup changes to it, updating it to account for a number of policy changes. I had to totally redesign chunks of it because of changes in the way a number of pieces of data were going to be handled in the future, etc, and of course I had a great deal of bug-hunting to do. But, overall, despite the fact that this was a big, complex project, it all went pretty well. We're now moving into a phase where the system's going to be expanded again, to add features. It's growing, in other words -- bigger and bigger. And, it's not giving us that much trouble in the process.

      I think where large projects run into trouble with VB is when they are run by people who do NOT have a solid computer science background. All too often, a secretary or clerk is sent off to a VB class, baptized as a programmer, and handed a copy of VB, Professional Edition. Then this clueless person is expected to be able to handle a large project. No knowledge of data or file structures, no knowledge of relational database design or algorithms, but they're given the tools and admin access to a test database, plus a big project. Naturally, the person A) shits his pants and runs to Border's to buy a VB picture-cook-book with lots of yummy recipes in it, B) makes a good faith effort and totally fucks it up, and C) doesn't know what the hell hit him when the project implodes the day before the deadline (or am I being too harsh here?).

      But don't blame VB for it; blame the manager who's too stupid to know that computer programming is an engineering task requiring more than a six-week VB course to learn how to do properly. I feel sorry for the poor noob who gets flattered into thinking he's a programmer; he's the one that takes it in the shorts, generally.

      Sorry for the elitist rant, but...

      --
      Farewell! It's been a fine buncha years!
    45. Re:VB has one of those debuggers by crazyphilman · · Score: 2

      Vadem_t said: "ActiveX. Major pain in the arse. For some reason references to ActiveX objects that work just fine on one computer might disappear if you move the source to another."

      I've run into something like this, and I found that in my case, it was because the libraries weren't installed on the target computer, but they HAD been installed on MY computer because I'm a developer and had Visual Studio. This is actually a giant pain in the ass not limited to Active X, because you can't really predict what's going to be available on the target machine when your company (like mine) has people running some machines so old they have IE 3.3 on them (really!).

      Microsoft put out an extension to Visual Studio called Visual Studio Installer, which you can download from their site (I don't remember the URL, but you can search the site). Basically, it works almost like an interdev project and it creates a windows installer (msi) file which covers all your dependencies. You can see which files are being brought in to handle dependencies, where you might have a conflict, etc. It's kind of neat. It might help you; it helped me with my problem, at least.

      FYI... ;)

      --
      Farewell! It's been a fine buncha years!
    46. Re:VB has one of those debuggers by Anonymous Coward · · Score: 0

      Btw, you cant compare debugging tools of script langauges (VB or Python) to debugging tools of C or C++, because the former are script languages and give a lot of lexibility when debugging apps.
      Ack!!! That's one of the advantages of a scripting language. Of course you can compare it. That's the whole point

    47. Re:VB has one of those debuggers by Anonymous Coward · · Score: 0

      Try using Python, PyQt and Eric. Eric is a pretty nice debugger that can enter the qt event loop.

    48. Re:VB has one of those debuggers by OneEyedApe · · Score: 1
      Anyone who can learn to use a command line can learn to ./configure && make && make install. Compiling a linux kernel does take some knowledge of hardware and how the OS works. But it would take a programmer to go in and fix a random file when something goes wrong.

      Most of my time is spent using a ./configure && etc bit, occasionally, I scribble out some code in Emacs (I use vi for config files). But I have used VB for somethings. VB does have its uses, like everything else (Just not under linux)

      --
      Life sucks, but death doesn't put out at all....
      --Thomas J. Kopp
    49. Re:VB has one of those debuggers by vadim_t · · Score: 1

      Oh, we use the installer. The problem is different.

      At work:
      Win2K Pro, SP3, VB6 SP5. I open my project, with a reference to my own DLL (source in same CVS repository). It works. Now, save, commit to CVS

      At home:
      Same configuration, checkout project. Suddenly the reference to the DLL disappears. If it's a .OCX file then it's worse. VB can't load the project properly as if the OCX was missing, when it's actually there! Okay, I open the references dialog and add it. But now the darn reference disappears at work!

    50. Re:VB has one of those debuggers by sqlrob · · Score: 2
      Where are the buttons in assembly code?

      Same place they are in C

      VB is hardly the language to use for heavy number crunching

      No, but it's still nice to have something running in the background that's interruptible. I'd rather the thread management for this occur in the UI, since that's what's effected by having something blocking, But because of VB's limitation, it's in the backend component, where, IMHO, it doesn't belong.

    51. Re:VB has one of those debuggers by pheede · · Score: 1
      .NET languages all target the same runtime, they are just different kinds of syntactic sugar.

      VB.NET is the VB syntax we know and hate, with lot's of the worst parts fixed:
      • Assignment is now simply identifier = expr. No more Set for objects or other such nonsense.
      • All calls to functions and subs (sorry, procedures) must include parantheses. Thank God.
      • Integer is now 32 bit.
      • Dim i, j, k As Integer makes all of the variables integers instead of i and j as Variants.
      • The Variant type is a thing of the past.
      Et cetera.. Basically all of the things from the 'Thirteen Ways to Loathe VB' link. See Language Changes in Visual Basic at MSDN.

      There is a lot of other changes and additions. Frankly, I don't see why anyone would use VB.NET in favor of C#, J# or even Managed C++. It's great for upgrading old VB6 projects to better performing and more stable .NET components though.
    52. Re:VB has one of those debuggers by Jamesie · · Score: 1

      Just tried that (in VB.NET) and it gives a 5 element array (0 to 4) each time. I checked both with assignment to each element and the bounds functions (lbound & ubound).

      So it looks like you owe VB.NET an apology young man!

    53. Re:VB has one of those debuggers by Anonymous Coward · · Score: 0

      You need to maintain project compatibility between the ActiveX DLL that you compiled at work and that you compiled at home, so that they will have the same GUID. What I did was to set aside a compiled ActiveX DLL just for compatibility sake. Whenever you make changes to your DLL source, you have to set your project properties setting so that it will be project-compatible to that ActiveX DLL which has been set aside earlier. In short, every time you compile, you need to ensure project compatibility with that reference ActiveX DLL. Of course, each of your ActiveX Projects should have its own reference ActiveX DLL (which can just be a DLL which you compile successfully the first time).

    54. Re:VB has one of those debuggers by Anonymous Coward · · Score: 0

      "Ever try to declare a public structure and share it among modules in VB ? In C/C++ all it takes it ONE little word "extern"."

      In VB the word is "public." I'm sorry it was so hard for you to figure out

    55. Re:VB has one of those debuggers by MrResistor · · Score: 2

      Dim or ReDim?

      Sorry, but I know for a fact that Dim works the same as in C, meaning Dim MyArray(4) gives a 4 element array. This is the correct behavior, IMNSHO. ReDim MyArray(4) gives a 5 element array, basically the old VB 1-based array plus a 0 element since VB.NET arrays are 0-based.

      In fact, I had to prove it in front of my class for a point on one of my tests.

      If they released a fix in the last month that makes Dim act the same way then that's even more braindead, since the change to 0-based arrays was for compatability with the C-style languages that are part of the .NET framework, and in any C-style language declaring myArray(4) gives a 4 element array (0-3).

      So, VB.NET will be getting no appology from me.

      --
      Under capitalism man exploits man. Under communism it's the other way around.
    56. Re:VB has one of those debuggers by x3ro · · Score: 1

      it gives amateurs the notion that they're just as good as any professional programmer

      i thoroughly agree. in fact its worse than that .. it blurs the distinction between the user and the developer. if the IDE and the language are perceived to run together (as in VB), the control is not there, you become a user of a product, rather than the technology simply giving you tools to get something done.

      i actually find the VB IDE bewildering .. its much harder to follow whats going on when the code is stuck onto this or that visual element in the application. it encourages bad programming style .. unlike perl, it makes the easy things brainless, and the hard things completely impossible.

      --
      [ UNSIGNED NOT NULL ]
    57. Re:VB has one of those debuggers by dubl-u · · Score: 2

      Wow, you really hate VB. [...] I'd rather be working in C++ or even C, so take the following in context, ok? [...]VB *CAN* be used for relatively larger projects [...]

      Oh, I agree. Any language that is Turing-complete (and some that aren't) can be productively used by a programmer who is sufficiently smart, careful, disciplined, and intensely aware of both the big picture and those who follow in his footsteps.

      So if we were all omniscient, self-programming robots, I'd say that assembler was for sissies, that real programmers only had two keys on their keyboards: zero and one. And fuck the backspace.

      Alas, programming is done by real humans, ambulatory sacks of meat, albeit with occasional fits of brilliance. Good toolsmiths know this, and make appropriate tools. People who make bad tools (like VB) are either fools or inhumanly cruel. I can never decide which explanation I prefer.

    58. Re:VB has one of those debuggers by Anonymous Coward · · Score: 0

      Actually, all of VB's "Windows GUI" form stuff runs interpreted, and that's where the real strength of the tool lies.

    59. Re:VB has one of those debuggers by Jamesie · · Score: 1

      I use Visual Studio Enterprise and have not upgraded recently.
      I used the following code with no errors and both msgbox's reporting "0 4 4". Perhaps you have an old beta version?

      Dim myArray(4) As Integer

      myArray(0) = 0
      myArray(1) = 1
      myArray(2) = 2
      myArray(3) = 3
      myArray(4) = 4

      MsgBox("After Dim " & LBound(myArray) & Chr(32) & UBound(myArray) & Chr(32) & myArray(4))

      ReDim myArray(4)

      myArray(0) = 0
      myArray(1) = 1
      myArray(2) = 2
      myArray(3) = 3
      myArray(4) = 4

      MsgBox("After ReDim " & LBound(myArray) & Chr(32) & UBound(myArray) & Chr(32) & myArray(4))

    60. Re:VB has one of those debuggers by Anonymous Coward · · Score: 0

      However, if you use C/C++ and extern you can refer
      to the variable as "x" rather than Class::x, or instance.x or whatever. In VB the variables will be refered to as Module.x. I don't know, maybe that isn't what he was talking about.

      It's been ages since I've done any programming, other than very very tiny stuff, so I'm not brushed up on things. However, my experiences with VB are not fondly looked back on, nor when I use it for the tiny tiny tiny stuff nowadays do I much enjoy it.

      This is *my* opinions, yours may vary.

      *VB has horrible syntax.
      such as when a call to a function/subroutine has to have () or not. it should always have to! it makes it so much easier to understand! and the _ to go to the next line in code as if it were the same line is just dumb (in my opinion). I guess it makes it difficult of VB to know when the statement is actually finished since it doesn't use an indicator, like ; but it still is annoying.
      Now, from what I hear VB.Net is much better, but really VB.Net is just another face given to the CLR, it's not a completely different language like it used to be, and since it's really the CLR it can't to boneheaded things like:
      dim a, b, c as Integer where a and b are really of the variant type and only c is an integer.

      *VB uses GoTo.
      Ok, so a lot of languages have goto, and it can be used and actually does work, but it makes things difficult to follow. The main gripe I have though is that the use of goto is advocated throughout books and classes on VB. The other languages I have books on and taken classes for tell you to NOT use goto. Well...I use what works, but having to use goto is very seldom necessary. If the error-handling of VB were good then I supposed the use of goto would be out the door, but it isn't. error-handling in VB is aweful, which is stupid because VB has a wonderful debugger (which was the ORIGINAL point to all this? right? the debugger?)

      *Operators should serve different functions
      the = operator should be "assignment," however VB decides that if the = operator is used in a compare then it is to check for equality, rather than using ==. Now, I understand part of the logic behind that...VB doesn't want you accidentally assigning a value to your lvar when you really want to compare the value or the lvar to the rvar, but I personally (and this is all a matter of personal taste) think that it should bring up a warning if you use = rather than ==, as opposed to getting rid of == and making = act differently than it normally would anywhere else in the code body.

      *EndThis EndThat...
      Ok, a lot of languages do this, but I have a gripe with the syntax in this particular area in those languages too. End If, End With, End Loop (or is it just Loop to end? if so, that's even worse because it's another consistency problem) is just too wordy. And, honestly, it doesn't really make it clearer to me (by much) as to what I'm ending. Granted, I know I'm ending an if, or a while, or whatever, but if I have multiple ifs or multiple whiles then it means nothing. Just do it the way that Java and C and C++ and Perl, etc. do it and use a {} pair and then put a comment after the } to show what is being ended. like in C you can have if (x) { blah } /* if (x) */

      *Why separate functions/subroutines?
      Do it the way it's done in other type-safe-languages, tell the compiler this function returns integer, or float, or NOTHING. I think it would be retarded if in C I had to type something like:
      Function blah1(I As Integer) As Integer
      Sub blah2(I As Integer)
      and I think it's retarded to do that in VB.
      It's much easier to know what the functions name is and what it returns too when you do it the C-way:
      int blah1(int i);
      void blah2(int i);

      Is it just me or does VB seem more prone to bugs than most languages? I wrote a tiny program...keep in mind this thing is small, only a few hundred lines of code that works like it's supposed to on my machine the VAST majority of the time, but on my mothers computer, it almost NEVER works correctly...she has to re-type things a time or two. I've checked the code handfuls of times and run it through the debugger repeatedly and it works 100% of the time when being debugged. It's as it there's bugs in the underlying Microsoft code that has intermittent errors.

    61. Re:VB has one of those debuggers by p944 · · Score: 1
      Any language that is Turing-complete

      I thought that intercal was Turing-complete? Like to see you write some code productively in that ;-)

    62. Re:VB has one of those debuggers by RogerWilco · · Score: 1

      Like for example Borland's TurboPascal...
      That's before VB even existed I think.

      Adriaan

      --
      RogerWilco the Adventurous Janitor
    63. Re:VB has one of those debuggers by RogerWilco · · Score: 1

      Have you ever tried the Borland C++ Builder for GUI C++ work?
      Or the Kylix C++ version on linux?
      I have worked with VC++ 5, 6, BCB 3, 4, 5, and find the Borland products very easy for GUI design compared to the MicroSoft products.
      I have no experience with .Net yet.
      I have no connection with Borland, I just use their product sometimes.

      Adriaan.

      --
      RogerWilco the Adventurous Janitor
    64. Re:VB has one of those debuggers by crazyphilman · · Score: 2

      dubl-u said: "Alas, programming is done by real humans, ambulatory sacks of meat, albeit with occasional fits of brilliance. Good toolsmiths know this, and make appropriate tools. People who make bad tools (like VB) are either fools or inhumanly cruel. I can never decide which explanation I prefer."

      Yes, but are you saying that given two idiots of equal stupidity, one with VB and one with gcc, the idiot armed with VB will do a worse job? I submit to you my theory that neither idiot will create anything functional, BUT, the idiot armed with gcc will be unlikely to even figure out how to run the compiler. The idiot armed with VB will probably at least have a weird little form built while the idiot armed with gcc is stuck wondering whether to use vi, emacs, or pico. This may be a Good Thing.

      My point is: no tool can save an idiot, or even make him useful. Therefore, complaining about VB because there are idiots in the world isn't fair. ;)

      --
      Farewell! It's been a fine buncha years!
    65. Re:VB has one of those debuggers by crazyphilman · · Score: 2

      Ah... Sorry, I should have realized you'd have that covered. I was trying to look for a potential cause of your problem when someone posted something amazingly informative about it -- but he posted as an A/C so I can't be his fan (what a drag). It's a great post though. I wish I could mod it up.

      --
      Farewell! It's been a fine buncha years!
    66. Re:VB has one of those debuggers by Anonymous Coward · · Score: 0

      Long before... it's a funny thing when your first computer is an Intel machine running Windows you sometimes think that Intel and Microsoft single handedly created and developed all the innovations.

    67. Re:VB has one of those debuggers by MrResistor · · Score: 2

      Perhaps you have an old beta version?

      Doubtful. I don't own it myself, I was using the school lab machines. I don't know what version it was but I would be extremely surprised if my school rated a beta version. The admins were pretty prompt about applying updates, too.

      I still say that behavior you're seeing is wrong, though. (Re)Dim myArray(4) should give an array of 4 elements, 0-based. Anything else breaks the compatability that is supposed to be the guiding princilpal of .NET

      Out of curiosity what do you get with this?

      Dim myArray(4) As Integer
      MsgBox("After Dim " & LBound(myArray) & Chr(32) & UBound(myArray))

      Basically, I'm wondering if assigning a value to myArray(4) creates that element as if one used a ReDim. I have no way of checking it on my own, and I don't remember trying such a thing.

      --
      Under capitalism man exploits man. Under communism it's the other way around.
    68. Re:VB has one of those debuggers by Jamesie · · Score: 1

      Out of curiosity what do you get with this?

      Dim myArray(4) As Integer
      MsgBox("After Dim " & LBound(myArray) & Chr(32) & UBound(myArray))


      Running the above code I get "After Dim 0 4".
      This excerpt from "VB.NET in a nutshell" confirms that arrays are 0 to N containing N+1 elements.

      This is what it says in VB.NET help.

      Array Bound Changes in Visual Basic

      Visual Basic .NET updates the declaration of array bounds to provide interoperability with arrays in other programming languages.

      Visual Basic 6.0

      In Visual Basic 6.0, the default lower bound of every dimension of an array is 0. You can change this to 1 with the Option Base statement. You can also override the default lower bound in individual array declarations.
      If you leave the default at 0, the number of elements in the array is equal to the upper bound plus one. The following declaration reserves 21 elements for the array Weight:

      Dim Weight(20) As Single

      Visual Basic .NET

      In Visual Basic .NET, the lower bound of every array dimension is 0, and you cannot declare it to be otherwise. The Option Base statement is not supported. The number you specify for each dimension in the declaration is the upper bound, and the initial element count is equal to the upper bound plus one. The declaration in the preceding example reserves 21 elements for Weight, with subscripts 0 through 20.

    69. Re:VB has one of those debuggers by Anonymous Coward · · Score: 0

      I love VB drag-n-drop and click-click paste coding
      MFC is a nice piece of crapt
      MFC team should have talk to VB team

      Solution: use C++ builder - VCL library

      click-click, drag-n-drop, powerful C++

    70. Re:VB has one of those debuggers by dubl-u · · Score: 2

      Therefore, complaining about VB because there are idiots in the world isn't fair. ;)

      Actually, I'm saying something a little different.

      I'm saying that people are all idiots. The tools we build should reflect that.

      One swell example is from years ago: a Chevette that a friend of mine drove. The car was a crappy, lightweight econobox. If you got into an accident at high speed, you'd be strawberry jam. That's fine; there's a place for low-budget cars in the world.

      If you took this car at anything above 60 mph, it felt like the car could come apart at any moment. It felt dangerous. And, IMHO, that's exactly how the car should feel. It kept foolish teens like myself from going too fast.

      Now compare that with many of the modern SUVs. These cars are designed to feel big and tough. But it turns out that they're just as dangerous to the drivers as your average mid-size (and even many of the small cars). And worse, they're twice as dangerous to the people you hit. But since the don't feel that way, people don't drive them as carefully as they should.

      So VB is (or at least was last I used it) like a golf cart inflated to SUV size. It is really only safe for tooling around your subdivision, but it sure looks like it should be able to handle the autobahns.

    71. Re:VB has one of those debuggers by Anonymous Coward · · Score: 0
      Whoah, I'm glad you showed up! My opinion of VB has completely changed now that you've tuned me in to that little fact. I didn't fully realize the scope of the problem until I realized that my ass would be sucked!

      It's a feature, not a bug!

    72. Re:VB has one of those debuggers by crazyphilman · · Score: 2

      Hmm... Taking a few of your points one at a time:

      You said: "Actually, I'm saying something a little different. I'm saying that people are all idiots. The tools we build should reflect that."

      You're wrong here: all people are not idiots, and tools should NOT reflect this way of thinking. I think there is a clear spectrum between complete idiots and true geniuses. No matter what type of compiler you build, or how well you build it, sooner or later an idiot is going to get his hands on it and hurt himself. You can't do anything about that, and anyway, it's the idiot's problem, not yours. It's better to build a compiler for the brilliant people who will be able to make the best use out of it, and the competent people who will be able to make good use out of it -- empower THESE people, and don't put arbitrary limitations on what they can do with your tool. Build for the wise, in other words. And, let managers who think they can drag Sophia in from the steno pool for a quick VB class and a promotion, get hoist on their own petard.

      "...So VB is (or at least was last I used it) like a golf cart inflated to SUV size. It is really only safe for tooling around your subdivision, but it sure looks like it should be able to handle the autobahns."

      I disagree. VB6 is capable of very serious development. However, you have to use it where it makes sense. It's an applications programming language. It's good for applications programming. Database frontends, transactional dlls, stuff like that. Banks, government agencies, etc, all make very good use of VB. Would you write a game engine in it? Of course not. The very idea is ridiculous. But a large, distributed client-server application turns out just fine (I maintain a couple of them myself).

      As far as your car analogy goes, well, I don't think it fits. However, I agree with you about cars. I think it comes down to the fact that most students don't take physics, and don't understand what happens in a crash. An SUV will protect you from injuries due to the crushing of the vehicle -- because the vehicle probably won't crush easily. However, if you flip it, or you slam into something like a tree, the car's coming to a sudden stop, and YOU are NOT. Seatbelts and airbags only go so far, and it's SO easy to break your neck, or slam your head into the window or side pillar...

      --
      Farewell! It's been a fine buncha years!
    73. Re:VB has one of those debuggers by MrResistor · · Score: 2

      All I can say is that I was able to prove otherwise in front of about 15 witnesses, and without using any special tricks. Why you aren't seeing the same behavior, I don't know.

      However, if the new behavior is to create an array of N+1 elements, I still say that's wrong. Every other language I've used has had arrays of N elements, 0 to N-1. At the very least N+1 element arrays break compatability with C/C++, and I think we can agree that C/C++ is still important enough that compatability with them is essential for any language claiming compatability with other languages.

      --
      Under capitalism man exploits man. Under communism it's the other way around.
  22. Don't carry just one knife... by ivrcti · · Score: 1

    I work with a variety of IDE's and tools so my debuggers range in quality from acceptable to non-existant.

    Therefore, I make every effort not to depend entirely on my debugger. I use a combination of assertions, exceptions and logging to make sure that when something goes out of bounds, the reasons and the states are there in black and white.

    Yes, it takes a bit longer to code, but it makes testing, debugging and especially exception path fixes much, much faster.

  23. Ignore the MIT Media Lab by timeOday · · Score: 2

    Every time I hear something from the MIT Media Lab, it's a searing indictment of something terribly wrong software engineering or computer science, and how they are here to fix it with avatars or wearable computers or something. And then you never hear about the idea again.

  24. Official Rant! by Anonymous Coward · · Score: 0

    Well howto improve debugging tools.... simply hand them over to the GNOME developers, they know what they are doing first of all the default configuration mechanism get replaced with GConf (Windows Registry) System and then If it's a GUI client, we change the Button Ordering to make the application suck as much as even possible.

  25. ddd by Anonymous Coward · · Score: 1, Insightful

    ddd's visualization capabilities are terrific. You might be able to get rid of the graph paper.

  26. Why? by stagmeister · · Score: 1

    Why should I have to pay for a debugging tool, or write a debugging tool? I've had the best debugging tool with me all along -- my brain.

    --
    http://www.virtualvillagesquare.com/ Online Communities: The Next Generation
    1. Re:Why? by Anonymous Coward · · Score: 0

      Why should I have to pay for a translating tool, or write a translating tool? I can keep track of all those ones and zeros, and what they mean with the best translating tool of them all -- my brain.

  27. Good ol' command line. by grahamlee · · Score: 2
    Why do you think so much effort been invested in areas such as advanced modelling tools but so little in improving debugging tools?

    I think that very few people use them often enough to justify spending lots of R+D hours+$$$ on the debugging tools. How often do you see "-DDEBUG" in Makefiles? You'd think that if debuggers were so useful, you wouldn't need to switch in debugging code in the app. But many programmers feel more at home locating the bug using printfs or similar, then just reading through the code. Pencil and paper often helps too.

    Something I learnt from my BASIC days, which I still use in *sh/Python code is the use of the interactive interpreter (a.k.a. "command line" :-). This is especially helpful when trying to debug someone else's code - you can enter it line-at-a-time and see what happens. Yeah, so gdb can do that. But you think more about the code if you're typing it in yourself than you do repeatedly pressing the "step" key.

    I have used debuggers such as disassemblers and monitors as well as gdb, the Delphi debugger etc. While they have uses I just don't find they do anything sufficiently different from manual debugging to make them worthwhile.

    There's my £1E-2 :-)

    1. Re:Good ol' command line. by Anonymous Coward · · Score: 0

      why even use a computer? just do it in your head

    2. Re:Good ol' command line. by grahamlee · · Score: 2

      While I believe (out of kindness :-) that you're being sarcastic, this is exactly what I would do. I recently undertook a project that needed LISP, Perl and Pascal. Well I know a little Perl, it's been ages since I did Pascal and all I knew about LISP was that it's that scary thing with all the brackets in it. When I got stuck I found it easier to "debug" my code by printing it out, and sitting in the pub with a cup of coffee poring over the listing than I did by staring at the code on the screen. Of course, YMMV.

      Aeroflot, where the plane flies you.

  28. The debugger is half the story by The+Bungi · · Score: 1
    If your application is badly designed, debugging it is going to be crappy anyway. A good application design has to incorporate things like unit testing (instrumented or not) and a decent state machine management infrastructure.

    If you're using a language like VB or Delphi debugging is simple and almost inviting. I think that has always promoted bad application design. "Oh, that didn't work. OK, let's try this. Oh, that didn't work. OK, maybe this will work" and so on.

    If you're writing applications in C or C++, and especially as you get closer to the system, you learn to be more careful about what your application does because it's very difficult to change direction in mid-flight. It also forces you to think about what you're doing a lot more. I.e., you have to know what you're doing. Impressive concept, but frequently lost on today's "programmers".

    IMO, something like the "edit and continue" feature found in modern integrated IDEs like VB is a bad idea.

  29. Fix the programmer, not the program by doi · · Score: 3, Interesting
    A debugger does nothing to improve software, commercial, professional, or otherwise. All you have to do is look at Bugtraq to prove it.

    The best way to learn how to write bug-free code is to NOT use a debugger at all. Every programmer should begin writing code in Notepad or some other basic, no-frills text editor. Just like everyone should learn how to type on a typewriter and not a computer. It forces you to NOT make mistakes, instead of correcting them (you don't have to "debug" a program if you don't put the bugs in in the first place!) It forces you to slow down and think about what you're doing, instead of blasting through a procedure and then run the debugger on it. If everyone programmed for at least a year without ever using a debugger, the quality of their code will improve far greater than any fancy IDE debugger will improve it.

    --
    A man's reach must exceed his grasp, or what's an erection for?
    1. Re:Fix the programmer, not the program by MarcoAtWork · · Score: 5, Insightful

      the best way to build a skyscraper is not to use CAD programs at all, but a slide rule and pen'n'paper, which force you to think about what you're doing instead of making mistakes and 'correcting them later'.

      come on! You can't tell me that to be a Real Programmer one has to forgo color syntax highlighting, automatic indentation, automatic code formatting, automatic brace insertion, etags, man-on-symbol-at-point, folding, autodoc of functions, gcc -Wall -Weverything-but-the-kitchen-sink etc. etc. etc.

      Personally I believe that being able to isolate myself to having to indent manually the next line and similar stuff makes me a better programmer, as I'm able to think about structure & what I want the function to be doing vs why the %##*%^ editor doesn't do what I want.

      I'd also like to see you 'not put the bugs in in the first place' if you're adding a complex piece of functionality to a 2,000,000 lines program: I can write perfect 'hello world' code on a napkin, but considering doing it for real work is ludicrous.

      Debugging is also an art, and I don't think I've ever found a bug I wasn't able to trace via judicious use of the tools currently available on the market right now, which are (from less to most esoteric):

      - compile with as many warnings on as you can
      - reading the docs/code comments (some bugs are really features ;)
      - the mighty printf/cout/cerr
      - find/grep
      - vanilla breakpoints in your debugger of choice
      - tcpdump/openssl s_client/telnet/other packet monitoring stuff
      - purify/ad-hoc malloc library
      - hardware watchpoints in gdb (saved me a few times)
      - sleeping on it/going for a walk (let your subconscious do its thing)

      Only thing I'd like that current debuggers on unix don't have is what you can do in windows by inserting a certain line in your code that when is reached it automagically halts and pops up the debugger: when debugging multithreaded/multiprocess stuff that has bugs only when not running singleprocess/singlethread it's invaluable: anybody knows how to do that in unix?

      --
      -- the cake is a lie
    2. Re:Fix the programmer, not the program by Anonymous Coward · · Score: 0

      Bull**** I have programmed in some of the WORST enviroments possible in the "old days" and in the embedded world. My job, for much of career has been bringing up tools on new cores. Try debugging with a broken assembler output, a deep pipeline, and logic analyzer. It sucks. Give me the best tool you can find. Better tools make better programmers. I know there is a great macho appeal in saying I did it all with a rusty knife and some chewing gum but that's wrong. I grew up punching cards and running batches. Try only getting one or two runs a day.

      Second you seem to not know that most "real world" programming involves finding other's bugs in 100KLOC+ projects. Come back and say this when you get out of school. I have done that by inspection as well give a me debugger, and come back after you have left school.

    3. Re:Fix the programmer, not the program by xenocide2 · · Score: 2

      So what do Grown Men do when their powers imbued by a spartan interface fail them? Not every bug is a matter of misplaced semicolons or bad spelling. Easiest way to fix that is to use a higher level language that has a method of including low level languages when needed.
      A good example: writing an interpreter in OCaml. The language is very well written and with emacs its damned near impossible to fuck up the syntax. But that doesn't mean it works right. Once you've got your initial infrastructure set down in the first five minutes the hard part starts. The interactive environment saved me countless hours on Programming Languages assignments.

      Sometimes the bottom line is that the line of code you wrote doesn't do what you thought it would. I find this happens far less often in OCaml than C++, although theoretically my C++ are multithreaded capable which would easily explain my entire comment away =)

      --
      I Browse at +4 Flamebait

      Open Source Sysadmin

    4. Re:Fix the programmer, not the program by clem.dickey · · Score: 2

      People will use the tools which are convenient. If the debugger is most convenient, code gets fixed via the debugger. Unfortunately, those fixes are expensive. (The cost to fix a bug goes up an order of magnitude with each development step.) So spending money developing good debuggers turns out to be counter-productive!

      Better to put the money into front-end tools (HLLs, lint, etc.) so you will have fewer items to debug.

    5. Re:Fix the programmer, not the program by dubl-u · · Score: 1

      I'd also like to see you 'not put the bugs in in the first place' if you're adding a complex piece of functionality to a 2,000,000 lines program: I can write perfect 'hello world' code on a napkin, but considering doing it for real work is ludicrous.

      If the 2 Mline program already has good unit and functional tests, then it's pretty easy to not put the bugs in, just as long as you do test-driven development for your new code.

      Massive debugging efforts are a sign that something is seriously wrong with the development process.

    6. Re:Fix the programmer, not the program by Anonymous Coward · · Score: 0
      Very bad advice. A good debugger makes debugging go much more quickly. While scattering printf's in your code has its place the ability to set watch points, break points, step through code and look at ALL the varibles is a huge step forward. No writes buggy code on purpose, so any non-trivial program will require debugging, so it makes sense to use the best tools available.


      Some people complain that the debugger broke my code. It worked with the debugger, but failed on the release mode. In this case it is likely the optimizer that is at fault. Most debuggers turn off all optimizations to simplify the debugging.


      While a good debugger helps, a few simple programming tricks also help. If I open a file (or other resource) I put in the code to free/close that resource BEFORE writing the code between the open and the close. If your debugger doesn't use some sort of technique to detect memory overruns in malloc'ed mem, then write some home-grown malloc routines that do! You should be able to detect memory leaks also, eg walk the heap on program exit and make sure its empty.


      The best debugger these days are very good. Back in 1989 I was working on a graphics intesive project, so we put an mda card in the computer for a second monitor and wrote a custom printf that wrote to the mda. Had hot keys that did mem dumps, a malloc replacement that allowed you to NAME memory so you could do easier debugging, and checked for memory over-runs via hot-key. All of these techniques are now available out of the box with the top end dev systems.

    7. Re:Fix the programmer, not the program by Anonymous Coward · · Score: 1, Interesting

      Spending money on a good debugger is well worth it. The same is true for a good compiler, lint, tracer, profiler, etc. but like all good tools you need to use them and use them well. Lint will find some problems a debugger will not and vice versa and most programmers generate all kinds of bugs at one time or another. The problem is always to find the bug and fix it. It may require thought and a redesign but if you make the changes, improve the program but do not fix the bug then you still have a buggy program.

    8. Re:Fix the programmer, not the program by MarcoAtWork · · Score: 2

      doing test-driven development = finding bugs via unit testing, the poster I was replying to advocated that if code was written on paper (rock + chisel, ed, whatever) bugs aren't going to be created thus making debugging unnecessary.

      Test-driven development = debugging your own code if you see that you broke something, and to do that you do need debugging tools...

      --
      -- the cake is a lie
    9. Re:Fix the programmer, not the program by dubl-u · · Score: 2

      poster I was replying to advocated that if code was written on paper (rock + chisel, ed, whatever) bugs aren't going to be created thus making debugging unnecessary.

      If that were what he said, you'd have a point. But really, he never said, "never use a debugger,' just that programmers who learn to do without them are better programmers.

      In my experience, he's right.

      Test-driven development = debugging your own code if you see that you broke something, and to do that you do need debugging tools...

      For you, perhaps. I ocassionally find a debugger convenient, but only slightly more convenient than inserting the occasional printf. Many experts in test-driven development say the same thing.

      My point, though, is that spending much time in a debugger is a sign that there's something wrong elsewhere in your process. If you need to use a debugger, that means there's a problem and you don't know where it is. That, in turn, means that your test suite has got some pretty big holes in it.

      Rather than wandering through in the debugger, you should add tests until you find one that is broken. Then not only do you find the bug, but you also make it so that the bug can never return.

    10. Re:Fix the programmer, not the program by seaan · · Score: 2

      I basically agree with the idea that overuse of a debugger can be bad. But in 20+ years of programming I recall times when debuggers really made a difference! My favorite two examples (actually since they were embedded systems I used ICE not software debuggers, but same basic concept):

      1) We were doing real-time analog-to-digital conversions in a data logger, but an intermittent bug was really bothering us. We were using an Orion which is more of a logic-analyzer than an in-circuit-emulator - important difference is that Orion does not replace the CPU with its own pod unlike a normal ICE. Finally after much debugging, it turned out that our version of the 64180 had a mask error (known to the manufacturer naturally), which occasionally caused interrupt routines to not meets specs. There was no way studying code was going to tell us what was wrong here. Even a normal ICE might have had problems.

      2) We had a device with memory backed-RAM which became "unstable" after an extensive code change - becoming "unstable" was intermittent and only occurred after a long period of use. After lots of code inspection, I started examining memory dumps of returned units. After looking at about 20 units, I finally got lucky, and found a device in the "early" part of being unstable. The code area of the device was being overwritten by a recognizable pattern. Turns out the new code made an existing feature optional, but missed a part of the code that expected it to be there. The rogue code was trying to update a non-existent global variable (all this was complicated by the MMU, and the fact that the device had several features like code checksums that were supposed to detect this kind of problem - but obviously didn't).

      Two extreme examples I'll confess, but I can think of other situations where debuggers have saved days of debugging time. Debuggers do have their uses.

    11. Re:Fix the programmer, not the program by MarcoAtWork · · Score: 2

      it's my turn to ask you to read my post ;) obviously I'm not gonna fire up gdb to debug code I wrote an hour ago or for trivial stuff that's covered by printfs...

      On occasion, though, it does happen that functionality that you add breaks the product in interesting ways, due to long-existing bugs that just weren't triggered before: it's in these cases that having a debugger is invaluable.

      I can't really relate to 'programmers who learn to do without a debugger are better programmers', because when I learned how to code (in pascal/assembly on a very niche Z80-based computer in the early 80s) the only debugger was really printf, and having an infinite loop meant resetting the computer: the above poster, though, was saying that people program better when writing on paper or using a 'no-frills' editor like notepad vs an ide like VC/Emacs, and I still strongly disagree with that...

      --
      -- the cake is a lie
    12. Re:Fix the programmer, not the program by mitch0 · · Score: 1


      Only thing I'd like that current debuggers on unix don't have is what you can do in windows by inserting a certain line in your code that when is reached it automagically halts and pops up the debugger: when debugging multithreaded/multiprocess stuff that has bugs only when not running singleprocess/singlethread it's invaluable: anybody knows how to do that in unix?


      Ok, not exactly your answer, but you can do this with linux/i386/gcc at least. maybe that helps:

      void debugBreak()
      {
      asm (" int $3 ");
      }

      cheers,
      mitch

      --
      // "If human beings don't keep exercising their lips,
      // their brains start working." -- Ford Prefect
    13. Re:Fix the programmer, not the program by tony_gardner · · Score: 2

      " the best way to build a skyscraper is not to use CAD programs at all, but a slide rule and pen'n'paper, which force you to think about what you're doing instead of making mistakes and 'correcting them later'."

      Except that using a CAD program forces yyou to draw to scale. I've seen a surprising number of hand drawings which have two bolts intersecting.

      Using tools is supposed to prevent stupid mistakes, allowing you to concentrate on preventing smart mistakes. If your debugger doesn't fall into this category, then something needs to be fixed.

    14. Re:Fix the programmer, not the program by MarcoAtWork · · Score: 1

      exactly what I needed! thanks!!!

      --
      -- the cake is a lie
  30. How would I improve todays debugging tools? by Anonymous Coward · · Score: 0

    I'd make them totally automagic. All you'd have to do is click the icon and it would debug your code. It would fix mistakes without even prompting. It would modify and streamline the code to make it fast and efficient. It would cure all buffer overflows, memory leaks, heap corruptions, everything. It would document the code, line by line in english your mother could understand. It would have a super cool GUI that was easy to understand and showed you a porn slide show while it was churning through the code.

    It would be so totally awesome that Microsoft would beg me to sell it to them. But, it would be licensed under the GPLv3, which would be just like a BSD license but, include a clause excluding Microsoft and their affiliates from even looking at the code, much less using it.

    It would be the most awesome debugger the planet has ever seen. Yep. That's how I would improve it. Why, what were you thinking?

  31. Debugging? by grub · · Score: 1


    What's that? I trust Microsoft to run the show!
    /sarcasm

    --
    Trolling is a art,
  32. I'd get rid of them by greechneb · · Score: 2

    Too many people were dependant on them when I took programming classes in college. They'd write code carelessly, and then run it through the debugger, and do exactly what it said, instead of learning to code properly.

  33. Current debuggers do the job. by Java+Pimp · · Score: 2

    It's been my experience that current tools like Visual Studio are just fine. Once in a while maybe a kernel level debugger. Most often bugs are the result of some logic error in some algorithm you just know should be working. And with a little tracing and memory dumps you can find the problem.

    However, if the error is such that cannot be tracked down within a reasonable amount of time and isn't confined to a small section of code then I wouldn't consider it a bug but a flaw in the design. A good design would eliminate such difficult bugs and then the smaller ones only need the simpler tools we currently have to track them down.

    In my opinion, the advances in modeling tools help reduce the number of potential problems so there isn't as much of a need for advanced debuggers.

    I'm sure some will disagree but this has been my experience. I've redesigned sections of code to eliminate an elusive bug and it's made for a more solid application.

    --
    Ascalante: Your bride is over 3,000 years old.
    Kull: She told me she was 19!
  34. Debugging tools only help so far by russx2 · · Score: 1

    Of course, the problem is, debugging tools will only help you track down bugs that you are looking for - and hence bugs that you know exist.

    It is not the case that software companies and the like intentionally release software with no known bugs (cue: microsoft puns) it is they do not know they exist. No amount of debugging tools will help you find these bugs.
    The general methodology for many programmers (from amateur to supposedly professional) is to write some code and do a few quick tests. Perhaps throwing in a few -1's and out of range values to check for error checking. The caveat here of course is that these checks don't always apply to a real world bug which the programmer hasn't even contemplated. It is poor planning and bad design that inevitably leads to the bugs - as the author of this post suggests, maybe we should all spend more time with our graph paper and pencils before writing the code.

    A debugging tool is there to help fix bugs that you know exist - unfortunately it is often the userbase that has the job of finding them.

  35. Reversable debugger by mahlen · · Score: 3, Interesting
    For Java coding, take a look at RetroVue, which indeed lets you wind back the clock and see exactly HOW that reference became null (among other things).

    mahlen

    1. Re:Reversable debugger by dcuny · · Score: 2, Interesting
      Years ago, I programmed in a Forth shop, and there was a "mysterious" problem somewhere in the code that was bringing the system to a halt.

      Being the junior member of the programming team, I was naturally the primary suspect. And my boss was quite vocal about it.

      Finally, he broke down and brought in a logic analyzer. It only had something like 32K memory, so by the trap triggered, the error was typically out of the buffer. And each time, my boss would again loudly complain about my poor coding skills, and how much money it was costing him because of some bug in my code.

      After many attempts, he finally trapped the bug. It turned out to be a trivial error in his code, of course - we were working with zero based arrays, and he allocated n slots. So when message number n came along, it offset just beyond the jump table and grabbed some random address.

      Of course, he never apologized for the weeks of insults - just changed the n to n+1, and went back to his office.

      The moral: a good debugger is worth its weight in gold.

    2. Re:Reversable debugger by afidel · · Score: 1

      Almost all good quality lab equipment is in that range. Heck thats a bargain compared to some of the top of the line scopes the guys in the lab use (when analyzing things happening at 5Ghz you need a damn good scope). The thing is if every day slipped in reaching production costs over a million dollars having good equipment seems like a bargain. Besides paying a hardware engineer six figure saleries and then giving them inferior equipment is kind of backwards, no?

      --
      There are 4 boxes to use in the defense of liberty: soap, ballot, jury, ammo. Use in that order. Starting now.
    3. Re:Reversable debugger by james_pb · · Score: 1

      CodeTEST had a trace capability that was pretty nice (disclaimer - I worked on that project), and I believe the price point was more like $20k rather than 80. Applied Microsytems went under late last year, but it looks like Metrowerks picked up the CodeTEST product line.

      I don't know what the pricing was on the software version of CodeTEST, but it could do trace as well.

    4. Re:Reversable debugger by Anonymous Coward · · Score: 0

      n-1?

    5. Re:Reversable debugger by jimfrost · · Score: 2
      Back in the early 90s there was a group at Boeing whose entire job was trying to find this one bug in their avionics code. It was nasty and subtle enough that they hadn't been able to find it for years.

      They got a demo copy of ObjectCenter (formerly Saber-C), a superdebugger I used to work on which performed a lot of runtime error checking. They loaded the code, ran it, and it pointed out the error for them. Their job finished, the group was disbanded.

      I don't know if we got the product sale :-) but certainly they shared your opinion. I do, too, although the near total lack of functional debuggers in Java (until 1.4, which unfortunately I still can't use) has kept me in printlns. Thank God that Java incorporates runtime checking and dumps stack traces on error or we'd never get anything written.

      --
      jim frost
      jimf@frostbytes.com
  36. Debugging Tools by Anonymous Coward · · Score: 0

    If you used a Smalltalk debugger, you wouldn't be complaining so much. Give it a try sometime.

  37. It's a deep complex issue by Jack+Wagner · · Score: 1, Interesting

    I think we will come full cycle on this and start to have success when we are able to peel away the abstract levels of encapsulation and stop attempting to hide the data away by using high level constructs.

    I've seen that most of the high level languages (java, Visual Basic, c#) promote RAD via lack of formal trainging. Thus the real problems start to show up when someone who has learned the syntax but knows nothing about how IPv6 packets handle little endian sockets tries to debug a complext multi threaded app and spend all their time basically guessing instead of analytically and systematically debugging the application.

    Fred Brooks in the "Mythical Man Month" stated that unless a language is written in the same language that you increase the time to debug it by Olog(n) and that's true today when you look at java (not written in java) or perl or c# as opposed to languages like C and Fortran that are optimzed for debugging by being written in C and Fortran. Much of what Fred wrote about is not pertinat any more that this one still stands the test of time.

    Basically it's a low level problem and not a "debugging tool" problem as I see it.

    Warmest regards,
    --Jack

    --


    Wagner LLC Consulting Co. - Getting it right the first time
  38. Interactive development by Anonymous Coward · · Score: 0

    Having a more interactive development environment makes debuggers much less necessary.

    When building the project is expensive, then debuggers really help because it's "cheaper" to fight a debugger than it is add a "printf" into the code.

    But when the turn around is very quick, then "printf" and simple functional tests make things MUCH easier.

    I haven't used a debugger is years.

  39. Best way to debug : Better Code by Viking+Coder · · Score: 3, Insightful

    The real problem is that the majority of software that is written is fairly lousy. People often code to moving requirements, push code in directions it was never intended to go in, and work with designs that are in desperate need of landing on the compost heap.

    Honest debugging is most useful when something is being developed in the first place. Domain knowledge is what is most useful when ancient and decrepit software is being modified to do something it shouldn't.

    Software applications should be thought of as prarie lands. From time to time, lightning strikes, and burns out a huge chunk, which is all replaced by newer and healthier stuff. You need talented people to make sure the new code will work well with what's already there - but the end result is that the application will be healthier if frequent refactoring is done intelligently.

    --
    Education is the silver bullet.
  40. Easy--use Visual Studio .NET more by mattc58 · · Score: 0, Flamebait

    Best IDE and debugger around, bar none. To be honest, one of the first debuggers which actually works all the way through. You can debug from a POST event on a web page, through the code-behind code, through the middle tiers, and all the way into the stored procedures. Nice.

    1. Re:Easy--use Visual Studio .NET more by yuiop · · Score: 0

      Exactly how the FUCK is this flamebait? It's (a) true and (b) relevant, if that's provocative then I despair.

  41. Debuggers:The red-headed step child of development by Azar · · Score: 3, Informative

    Debuggers aren't flashy or glamorous. I don't know anybody that thinks debuggers are cool. The tools and pieces of a development environment that are going to catch a programmers eye first are what's focused on most. You look at a nicely developed IDE that's polished and slick, and you'll be impressed. It's eye candy that sells products more than anything else.

    Sadly, most -programmers- even look at a development environment's debugger as an afterthought. IMHO, it's one of the single most important tools (if not THE most important) and it's what I check out first.

    Have you ever used the Gnu Visual Debugger at the GNAT Libre software developers' site? It's a multi-platform (Linux/Unix/Windows), open-source debugger with a "different view" of the world. Check it out, you may be pleasantly suprised.

  42. My Dream Debugger by Rary · · Score: 5, Interesting
    Some of these features exist in current debuggers, and some do not. What I want is all of them.

    1) The ability to set conditional breakpoints.
    2) The ability to see not only a variable's current value, but a stack of all of its previous values.
    3) The ability to select a variable's previous value and jump to the line of code that set it to that.
    4) The ability to change the value of a variable at any point.
    5) The ability to add/change code on the fly.
    6) The ability to jump into the debugger at any point in the program, even when I hadn't planned to before running it.
    7) Auto-logging of method calls and (optionally) variable values, to be started and stopped as I see fit either while stepping through code or running it.

    That's all that comes to mind off the top of my head.

    --

    "You cannot simultaneously prevent and prepare for war." -- Albert Einstein

    1. Re:My Dream Debugger by Doctor+Memory · · Score: 1

      6) The ability to jump into the debugger at any point in the program, even when I hadn't planned to before running it.

      I used to do this under VMS. Hit ^C at some point during the execution of your code, then type "debug". It would pop up the debugger and load your source and position it at the current execution point.

      This could be especially handy when working with third-party apps. You wouldn't have the source, of course, but you could often get a stack trace and you could always slip into assembler mode and examine the instructions and registers directly, and single-step an instruction at a time if you needed.

      --
      Just junk food for thought...
    2. Re:My Dream Debugger by Anonymous Coward · · Score: 0

      the solaris c++ debugger had the ability to add/change code on the fly, recompile, step backwards, and continue execution by relinking in ram (faster by skiping writing the executable). Any other debuggers can do this ?

    3. Re:My Dream Debugger by Anonymous Coward · · Score: 0

      also memory leak detectors like purify are more important, take you to the code when a memory leak is detected ex not null terminating a string

    4. Re:My Dream Debugger by NaugaHunter · · Score: 1

      Exactly what language would you like this magical debugger work for? Most of these points are, well, let's say unfeasable:
      2) Where would this stack of previous values go? What if it's the control for a loop? A buffer variable that updates every second?
      3) Same point, just makes the stack bigger. Should it cross reference all variables so you can see what that all were at that point?
      6) So the debugger should be able to wrestle a process away from the processor without previously having linked into it, and then map memory locations to variables and procedures? That would be impressive.
      7) While stepping this would be relatively easy, but if you mean while running outside the debugger see 6).

      I think more reasonable wants would be, many of which many do do:
      1) Find all errors at once. {If anyone knows how to get VB6 how to do this, I would love to hear. And I don't mean simple syntax errors that turn red.} {Don't ask, it's a job.}
      2) Recognize and issue warnings about possible semantic problems. e.g. Using uninitialized variables, = instead of ==, etc.

      Asking a debugger to do more turns it into a crutch. If you want to know the history of a variable, add a dump window/file/database and send it there. MSSQL stored procedures have no debugger, but they aren't undebuggable. {Again, don't ask.}

      Out of the thousands of problems I've debugged in a dozen languages, all code problems have boiled into basically two types: semantic/typos, which are simply carelessness, or poor logic. Having a variable tracking system may help with carelessness, though so would the semantics checker I refered to. But without tracing through the code manually to see where it goes bad, how can you possibly fix poor logic?

      --
      R: That voice. Where have I heard that voice before? B: In about 365 other episodes. But I don't know who it is either.
    5. Re:My Dream Debugger by mav[LAG] · · Score: 2

      I've browsed quite far down all comments and have yet to see someone mention the Data Display Debugger. I find it an absolutely indispensible tool for debugging anything longer than a small utility. Off the top of my head, it supports all but one of your requirements (the exception is #6 which I think is unreasonable for compiled code but I can see why you like the possibility). Hmmm - not sure about #3 mainly because I've never tried it. Don't see why not though - set a watchpoint to stop whenever the variable's value changes and then go back a frame. And yes #7 is supported if gdb is your inferior debugger through user-defined commands.

      While I was RTFA, I was intoning "DDD" to just about every complaint the author brought up. Quite apart from its support for Python, Perl and Java, its visual display of data structures is unique. Array getting mangled? Display it as a graph and see exactly how and where it gets clobbered. Threads getting you down? Display the data that needs to be mutexed and attach to process.

      --
      --- Hot Shot City is particularly good.
    6. Re:My Dream Debugger by DoseKapital · · Score: 1

      MS VC++ 6.0 supports this with thier dynamic linking. However, I'm not sure what you mean by stepping backwards. In VC++, you could set the next instruction to a previous instruction, but it wouldn't save the variable states for the last 100 instructions (if that's what you're talking about).

    7. Re:My Dream Debugger by oolon · · Score: 2

      I would also like to be able to turn off traversal of code (black boxing) some libraries.. step finish is so boring particularly when they have no symbols for the code anyway! Likewise to mark some functions within my code like that step whoops not interested in this bit, not go into this function again sort of thing.

      And someway to display encasulated data which has been repeatedly encapulated with void * as it get passed into sub functions. It may be oops but its a pain to debug.

      James

    8. Re:My Dream Debugger by dserpell · · Score: 1

      Some of those can be done in GDB:
      1) The ability to set conditional breakpoints. See 'help condition'
      2) The ability to see not only a variable's current value, but a stack of all of its previous values.
      This is very difficult with compiled code, but can be emulated in GDB using "watch" breakpoints that run a user defined function.
      3) The ability to select a variable's previous value and jump to the line of code that set it to that.
      See (2)
      4) The ability to change the value of a variable at any point.
      Trivial in GDB.
      5) The ability to add/change code on the fly.
      Also difficult with compiled code, but you can assemble in GDB if you want.
      6) The ability to jump into the debugger at any point in the program, even when I hadn't planned to before running it.
      Well, joust press "Control+Z" and then attach GDB to the PID.
      7) Auto-logging of method calls and (optionally) variable values, to be started and stopped as I see fit either while stepping through code or running it.
      Also possible, but difficult.

    9. Re:My Dream Debugger by antv · · Score: 1

      Just a nitpick, but actually DDD does #6 - you could attach to running process, even if you started it outside debugger.

      --
      Obama 2012: our incompetent asshole is slightly less of an incompetent asshole than the other incompetent asshole !
    10. Re:My Dream Debugger by mav[LAG] · · Score: 2

      Doh! Of course you can - not thinking straight today ...

      --
      --- Hot Shot City is particularly good.
    11. Re:My Dream Debugger by Anonymous Coward · · Score: 0

      Look for a previous post regarding the Data Display Debugger (DDD). Basically all these things are already possible.

      It's ever better for Java with the RetroVue debugger than can actually step backwards in "time".

      As for a debugger being a crutch, all I can say is that you are seriously confused. Is a compiler a crutch for people too lazy to manually compile their own code? I don't think so.

      If the debugger can track and show me the kinds of information I'm likely to want to see, then why would I want to waste time coding printf()s to dump the same information and then waste more time recompiling and rerunning the program?

    12. Re:My Dream Debugger by Rary · · Score: 1
      Exactly what language would you like this magical debugger work for?

      How about, for example, Java?

      I can see where you're coming from. As other replies have pointed out, you're thinking primarily in terms of compiled code. I'm focused primarily on Java these days.

      Also, I said this was my "Dream Debugger". I didn't say it was necessarily possible, just that these are the things that I would love to see in a debugger. However, as others have pointed out, these are not only possible, but do exist in some debuggers.

      Asking a debugger to do more turns it into a crutch.

      Bullshit. It turns it into a more useful tool. A tool only becomes a crutch if you let it.

      2) Recognize and issue warnings about possible semantic problems. e.g. Using uninitialized variables, = instead of ==, etc.

      I agree with that one. Of course, I'm used to that already, since my Java IDE does that for me right now. :)

      --

      "You cannot simultaneously prevent and prepare for war." -- Albert Einstein

  43. I asked my boss.. by Anonvmous+Coward · · Score: 3, Funny

    ... about Debugging Tools. He felt that engineers should just learn to write software without bugs in it.

  44. I wouldn't let the retards at microsoft by aroundsomewhere · · Score: 1, Funny

    I wouldn't let the retards at microsoft work on any more code for the IDE. Then at least it wouln't get any worse.

    1. Re:I wouldn't let the retards at microsoft by AlphaHelix · · Score: 2

      That's a pretty untutored opinion. I've used debuggers on about ten different platforms and found the MS Visual C++ debugger to be the best designed one I've used. It's well integrated, easy to look at, it has machine code disassembly built in and displays it between the code lines (if you want), it has intuitive hot keys, et cetera. There are some really bad debuggers out there. dbx on AIX was absolutely retarded, and couldn't set watch points without crashing. Their GUI for it was harder to use than the command line. The MS debugger is a dream by comparison.

      --
      * mild mannered physics grad student by day *
      * daring code hacker by night *
      http://www.silent-tristero.com
    2. Re:I wouldn't let the retards at microsoft by Anonymous Coward · · Score: 0

      Trans: That's a pretty unindoctrinated opinion. signed: ms.stooge

    3. Re:I wouldn't let the retards at microsoft by aroundsomewhere · · Score: 0

      I agree that they have made a good attempt at integration and have some good ideas about useability, BUT their latest creation Visual Studio.NET leaves something to be desired. I spend more time trying to work around bugs in the IDE that I do debugging my applications. I've also spend more time conversing with MS support personal about their bugs than I care to admit. The funny thing is that the MS support guys readily admit VS.NET is a POS and that companies should move from VS.NET to VS.NET 2003 beta as soon as possible if they wan to avoid these bugs.

    4. Re:I wouldn't let the retards at microsoft by aroundsomewhere · · Score: 0

      Not really, I spend more time trying to work around bugs in the IDE that I do debugging my applications. I've also spend more time conversing with MS support personal about their bugs than I care to admit. The funny thing is that the MS support guys readily admit VS.NET is a POS and that companies should move from VS.NET to VS.NET 2003 beta as soon as possible if they wan to avoid these bugs.

    5. Re:I wouldn't let the retards at microsoft by aroundsomewhere · · Score: 0

      agree that they have made a good attempt at integration and have some good ideas about useability, BUT their latest creation Visual Studio.NET leaves something to be desired. I spend more time trying to work around bugs in the IDE that I do debugging my applications. I've also spend more time conversing with MS support personal about their bugs than I care to admit. The funny thing is that the MS support guys readily admit VS.NET is a POS and that companies should move from VS.NET to VS.NET 2003 beta as soon as possible if they wan to avoid these bugs.

  45. Why? Because quality doesn't pay the bill. by Gadzinka · · Score: 1

    It is simple.

    Quality and/or security (which is often the same thing) doesn't pay the bill. Features pay the bill, runaway version numbers pay the bill.

    It would be the same in other industries if it weren't for cunsumers' rights and vendor's liability. Unfortunatelly there is no liability for software vendors, so the QA is still in its infancy as it was few decades ago.

    Robert

    --
    Bastard Operator From 193.219.28.162
    1. Re:Why? Because quality doesn't pay the bill. by Anonymous Coward · · Score: 0

      Guess who said this:

      "People don't want bug fixes. They want new features."

      a. William Henry Gates III
      b. Bill Gates
      c. "Billy the Kid" Gates
      d. All of the Above

  46. The problem is with debugging, not the debugger by AlphaHelix · · Score: 2
    One major problem is that the very concept of debugging is problematic. It assumes that you will make mistakes, and that the only way to track down mistakes is to painstakingly find each one. This process takes O(n) time, but the number of bugs grows more like O(exp(n)) with the program size, so when programs become non-trivial, you'll never be able to track down all the bugs.



    What's actually needed is more intelligent languages and automated code checking tools, as well as better code review and coding practices. Strict code review and coding practices help make programming more like a real engineering endeavor, instead of the fly-by-the-seat-of-your-pants garage hack-fest that seems prevalent in a lot of existing code. But, the real challenge is to develop languages with features like the ability to detect potential problems in code using partial evaluation, and alert the programmer at compilation time rather than run time.



    Basically, we're still in the hunter-gatherer stage of software development, and the Bug Problem needs to be fixed by a fundamental shift in paradigm that can move us beyond the need to deal with "bugs" explicitly. Until then, a snappier debugger interface and new debugging features will only have marginal impact on the ability to develop fault-free software.

    --
    * mild mannered physics grad student by day *
    * daring code hacker by night *
    http://www.silent-tristero.com
    1. Re:The problem is with debugging, not the debugger by Anonymous Coward · · Score: 0
      You sound as though you might be interested in this.

      I believe it supports full formal proof of correspondence between an implementation and a specification.

  47. My debugger by Jonboy+X · · Score: 2

    System.out.println(). Works fine for me most of the time. If not, I can print a stack trace and see what's going on...assuming Java, of course.

    The only place I've seen that a debugger comes in handy is stepping through poorly understood code. Really, the code should be documented well enough to explain what's going on, but that's rarely the case.

    --

    "In a 32-bit world, you're a 2-bit user. You've got your own newsgroup, alt.total.loser." -Weird Al
  48. People...Bugs who need People... by mcmonkey · · Score: 2

    At some point debugging comes down to, the computer can only do what people tell it to do. A lot of advancement has been made in making it easier for programmers to communicate with computers. Advances are made in methods for reporting just what is being done or why something can't be done. But in the end, the bottleneck is the programmer who has sit down with his pencil and paper and slide rule and figure out, "is this really what I want to tell the computer to do?"

  49. Simple... by Wireless+Joe · · Score: 1



    Remove the bugs.

  50. Alternatives to traditional debuggers by mbessey · · Score: 2

    There's an article in the latest issue of Embedded Systems Programming about using visualization tools for debugging. Well worth reading.

    -Mark

  51. Debugging by bytesmythe · · Score: 3, Insightful

    Debugging is difficult primarily because debuggers do not appear to use any kind of intuition.

    Let's say I have a break point on an if statement. The debugger should automatically show me the values of any variables in the condition, as well as the truth values of the individual expressions in that condition.

    A debugger should have an "intelligent" step button that steps into code that has debugging symbols, but steps over system calls. It should also automatically skip to the end of loops if desired.

    Debuggers should have "sanity" checks for values. Any time a pointer is null, or an long integer is set to some really wild value (like -3492883773642) that is nowhere close to the values that it originally contained, or a string doesn't have a null terminator, the debugger should alert you with a little icon, even if you aren't actively watching that variable.

    One thing that sucks about debugging is when programs behave differently in the debugging environment than they do once compiled. We had several problems related to event handling in Visual Basic only occured if the program had been compiled. In debug mode, it worked fine.

    Debuggers should keep a "state" history, especially for loops or recursive functions, so you can see the entire progression of a set of variables until the point of failure. This eliminates having to write in a bunch of printf statements to get a snapshot of each loop iteration or function call.

    The debugger should be integrated into the IDE so you don't have to switch back and forth. Also, it would be really nice if debuggers executed under some kind of virtual machine that allowed you to more easily freeze execution, rewind it, tinker with it as it's running, etc. Visual Basic allows you to do some of this, but certain code changes require you to restart the whole program. I'd like it if you never had to restart, and the line between "debug mode" and "design mode" were almost entirely blurred.

    Just my $0.02.

    --
    bytesmythe
    Hypocrisy is the resin that holds the plywood of society together.
    -- Scott Meyer
    1. Re:Debugging by dubl-u · · Score: 2

      Debugging is difficult primarily because debuggers do not appear to use any kind of intuition.

      Perhaps instead of making the debugger intuitive, you should make your code intuitive.

      In particular, you can write unit tests, so that you make sure that your code does what it should. And if that's not enough, each method or function can contain assertions about pre- and post-conditions for the code.

      Then instead of just catching the errors when you happen to be looking at something in the debugger, you can catch them all the time.

  52. As somebody who uses printf... by cbcbcb · · Score: 1
    I did see a demo of a Java debug system which generated a log during execution and allowed the user to look at what was the full state of the program at any point during its execution. Very cool.

    As somebody who uses printf, I would like the facility to add printf's retrospectively without having to recompile and re-run the code. printf debugging is great because it can be extremely context sensitive to the state of the program.

    Another advantage of printf debugging is that you can compare the behaviour of two similar versions where one displays a bug, and see where the buggy one's behaviour is differing from the working version. Perl is a great tool for accounting for differences which are expected

    Other than that, I find debugging on x86 is a pain because the assembler is much harder to read than a RISC instruction set like ARM. I don't know what I'll do if I ever have to debug something on IA64 :)

    I did see a demo of a Java debug system which generated a log during execution and allowed the user to look at what was the full state of the program at any point during its execution. Very cool.

    1. Re:As somebody who uses printf... by ckline · · Score: 2, Interesting

      I believe you are referring to the Omniscient Debugger: "A software tool written with Java[TM] technology allows developers to step backwards through the execution of a program to determine where and how programming errors occurred. By recording each state change in the target application, it allows the developer to navigate "backwards in time" to see what the values of variables and objects WERE, enormously simplifying the task of debugging programs. "

    2. Re:As somebody who uses printf... by Yrrebnarg · · Score: 1

      Try using the stderr stream sometime. Just redirect stderr to /dev/null or some file and only watch it when you suspect some Strange Magicks to be operating.

  53. More is bad by FortKnox · · Score: 5, Insightful

    Sure, we all like debuggers with conditional breakpoints and backward stepping, but the more you add to the debugger the less opportunity you will of finding the bug (unless its a 'smack in the face' bug).

    The only way of truely solving bugs is to know exactly whats going on in the code (and, also as important, is knowing the language, operating system, and the things going on in the background. IE - in Java, although it appears as if you aren't dealing with pointers, you are, and you should treat all objects like a reference, cause that's what they are). If you can't study the code (cause it was written poorly), it is a terrible terrible thing, because most bugs are not just one line fixes (and even those that are require you to know exactly what all is going on around them).

    "Cherry picking" (just tuning up one line and "guessing" that that's the problem) is what most 'amateurs that taught themselves coding' do, and on major/enourmously large projects, this will do nothing more than cause trouble.

    The best way to beat a bug is knowledge.

    --
    Good quote, too many chars. Seriously, the slashdot 120 char limit sucks!
    1. Re:More is bad by Casca · · Score: 2

      Just finding a bug is seldom the whole battle. To fix it you need to know why it is broken. More often than not when debugging a program that I had written, it would only take a few minutes to locate the source of the error, figuring out what was causing the error could sometimes take hours.

      --
      Casca
    2. Re:More is bad by scrytch · · Score: 2

      > The only way of truely solving bugs is to know exactly whats going on in the code

      Ah, isn't that sort of a given? That's like saying the only way to find your keys is to know exactly where everything is. Debuggers exist to let you see exactly what's going on.

      --
      I've finally had it: until slashdot gets article moderation, I am not coming back.
    3. Re:More is bad by tgv · · Score: 1

      > The only way of truely solving bugs is to know exactly whats going on in the code

      Spoken like a true zealot, who has never written large programs in collaboration with others. Did you ever try to solve a memory allocation bug in a program of more than 100 lines without a debugger? That's when you learn to appreciate the power of debugging statements and conditional break points. Or when you have rare conditions in your networking code and the documentation just isn't accurate (think "Linux and setsockopt" here). It's really practical to be able to stop a program as soon as some condition is broken. You could do it using assertions, but that's just another way of debugging...

  54. Perhaps it's an economic issue. by RelentlessWeevilHowl · · Score: 4, Interesting
    Why do you think so much effort been invested in areas such as advanced modelling tools but so little in improving debugging tools?

    A debugger is going to help you find and fix the bugs that got through:
    • Requirements analysis
    • Specification analysis
    • Design analysis
    • Code analysis

    Studies have shown repeatedly that the cost of fixing each bug increases at each stage. So if you are going to invest $1000 in new development tools, is it more economical to buy tools to detect bugs when they're cheap, or when they're expensive?
    1. Re:Perhaps it's an economic issue. by guido1 · · Score: 1

      Studies have shown repeatedly that the cost of fixing each bug increases at each stage. So if you are going to invest $1000 in new development tools, is it more economical to buy tools to detect bugs when they're cheap, or when they're expensive?

      A debugger is not going to help you find a requirements flaw that slipped through requirements analysis. (Ex: You do not need a debugger to find that you correctly implemented a requirement that was mis-written.)

      Nor will it help with at the specification and design phase. (Ex: The designed objects do not have sufficient functionality.)

      The only phase that a debugger can help is at the implementation/integration phase.

      Finding defects early is indeed cheap. But each time you change the work product type (e.g text requirements spec --> UML --> code) you will introduce defects.

    2. Re:Perhaps it's an economic issue. by leecho · · Score: 1
      Unfortunately, a debugger that can catch bugs in requirements or specification definitions cannot be built.

      Though there are tools (like those that come in TogetherSoft's ControlCenter) that can take metrics on your diagrams or code and figure out some bad styling or design pattern non-conformance, but still that's not debugging.

    3. Re:Perhaps it's an economic issue. by Zelatrix · · Score: 1
      Unfortunately, a debugger that can catch bugs in requirements or specification definitions cannot be built.

      That's not quite true...

  55. Great Development Tools by repetty · · Score: 2, Interesting

    The original poster's questions are all loaded with the presumption that something is wrong with using graph paper, pens and pencils.

    Why on earth do so many people feel all development tools need to be built into a software debugger or they are inferior???

    One great tool he did not mentiong is the napkin.

    1. Re:Great Development Tools by EvlG · · Score: 2

      Sure, pens and paper are useful, but I think the poster was trying to say he felt that a lot of this could be automated by the machine. And frankly, he's right in many ways.

      Why not let the computer do what it does best (collect and process data to generate different representations) and let people do what they do best (take varied data and past experience, and through a process of logical reasoning, deduce where the problem is)?

      I would love for the debugger to be able to assemble, rearrange, etc... all that data of my choosing with the push of a button. It would save me the time (and errors) in doing it myself.

  56. Reversable debugger by interiot · · Score: 2

    For embedded programming, logic analyzers will let you store X number of steps before your program crashes. Of course, they cost $80,000, but it's still an alternative for the top 10% of employees of the top 100 tech companies...

  57. Java by gUmbi · · Score: 2

    Exception stack traces are a godsend.

    Jason.

    1. Re:Java by cbowland · · Score: 1

      Assertions too (if you have 1.4).

      --

      Give a man a fish and he will eat for a day.
      Teach him to eat and he will fish forever.

  58. Slightly OT by buss_error · · Score: 2
    More thought to how a problem is solved BEFORE coding would solve a lot of debugging problems. I've seen too many programmers start coding first thing when they are given a problem. Sometimes the answer isn't code per se, but how you think about the problem.

    Good example is a damaged database. If you say "You have a damaged record", the customer says, "Well, fix the record and get all my data back!". If you say, "All your data is lost, but I think I can get most of it back if I get rid of this one record.", the customer says "DELETE that record!".

    --
    Necessity is the plea for every infringement of human freedom. It is the argument of tyrants; it is the creed of slaves.
  59. He felt? Did he feel you up? by Anonymous Coward · · Score: 0

    And that's his problem - he didn't think.

  60. Interpreted languages could... by number6x · · Score: 1

    Interpreted languages like perl or python could highlight bad syntax by running the code you are typing through parts of their own interpreter at given intervals. Kind of like an 'autocorrect' feature in some word processors.
    I think I would find it more annoying than helpful.
    I used to always lint my C code from Emacs when I was using C all the time. Does that count?

  61. Re: gdb supports watch and conditional break by Anonymous Coward · · Score: 0

    gdb also supports many types of breakpoints. You can use the "watch" command to break execution when a variable changes, or you can set conditional breakpoints (see "help breakpoints" for the options available to you).

  62. Getting it right the first time by theonetruekeebler · · Score: 5, Interesting
    Okay, so debugging hasn't gotten any better in the last couple of decades. I gotta say it's because the focus of methodology research has been on the development process itself, and that's an extremely good thing.

    The more work goes in before you get to the debugging stage, the less buggy your product will be. A well-designed system does not need as much debugging later. I know I'm idealizing, but I've seen this bear out, especially when version N > 1 comes out and it's been hacked to smithereens because of poor design choices in the previous iteration.

    Probably the most amazing bit of self-fulfilling prophecy you'll ever hear on a software project is a manager saying, "We'd better start coding now, because we're going to have a lot of debugging to do."

    As for catching things ahead of time, I've always put breadcrumbs in my code to spew to stderr or a Java error console class or wherever. Very easy to #ifdef out later and trivial to turn back on later.

    --
    This is not my sandwich.
    1. Re:Getting it right the first time by leandrod · · Score: 2
      > the focus of methodology research has been on the development process itself, and that's an extremely good thing.

      I am not so sure. All I have seen up to now is shuffling around, compressing, expanding or more generally fiddling around with phases of development. The issue is not to know any methodology, but not cutting corners where your successor, employer, customer or subordinates would later regret. And that seems to be above either the moral, intellectual or organizational standards mostly everywhere.

      --
      Leandro Guimarães Faria Corcete DUTRA
      DA, DBA, SysAdmin, Data Modeller
      GNU Project, Debian GNU/Lin
  63. Use Ninnle by Anonymous Coward · · Score: 0

    Simple. Use the debugging tools that come bundled with Ninnle Linux!

  64. Have you tried by rabbits77 · · Score: 1

    printf() ?
    >:)

  65. Re:Debuggers cause problems, and are IDE-dependent by Anonymous Coward · · Score: 0

    The problem I tend to have with debuggers is that they can only tell you what happened, not how it happened. E.g. I can see that char* is NULL, but how did it get to be NULL in the first place? When did I pass NULL into that function? A debugger won't tell you. About the only thing a debugger is useful for is examining a snapshot of the running process, but then so will a bunch of fprint(stderr,'s.

    That, and the syntax for tools like gdb is just awful.

    Maybe its just me. I've so used to working without a debugger, I don't think I'd even bother to a learn to use one these days.

  66. Comment removed by account_deleted · · Score: 2

    Comment removed based on user account deletion

  67. A great feature by Avumede · · Score: 2

    One feature I really liked, that exists in a few places such as VC++ and edebug (for emacs), is the ability to jump around in the code and set values at runtime. You can do a lot with these two features, from running the same code over and over at runtime with different values, to skipping over a part of the code you consider problematic and seeing if it helps.

  68. It's ironic by TerryAtWork · · Score: 2

    One of the best debuggers I ever used is what I'm currently coding in - CA Clipper. Does it all, and I use VB 6 as well, so I know this is true.

    --
    It's Christmas everyday with BitTorrent.
  69. Debuggers are for chimps by torpor · · Score: 2, Interesting

    Been writing code since 1978, and the only debugging tool I've ever needed is:

    printf();

    Seriously, an over-reliance on debugging tools is something I've *definitely* seen come into this industry.

    Bah. Chimps.

    --
    ; -- the corruption of government starts with its secrets. a truly free people keep no secrets. --
    1. Re:Debuggers are for chimps by fredrikj · · Score: 2

      Amen. When I encounter a bug, I generally:

      1. Try to figure out through logic in which part of the code the bug could have occurred.

      2. Use printf()'s to track the progress from the main structures to their branches until I've found the malfunctioning function or code snippet.

      3. If the error isn't obvious, I insert printf()'s that tell the location in the code or values of variables, until I've been able to find the bad statement.

      Works about always.

    2. Re:Debuggers are for chimps by rk · · Score: 1

      I dig using printf (or its equivalent for other languages) for debugging in general, but I've got to ask you: You get a SEGV from a program you are working on. How do you find that with printfs, short of having a log of:

      INIT: Entering...
      INIT: Setting up tables...
      INIT: exiting...
      db_connect: creating object...
      db_connect: signing on...
      db_connect: exiting...
      .
      .
      .
      socket_alloc: Entering...
      socket_alloc: Looking up host name...
      Segmentation Fault (core dumped)

      I've got to say, firing up ddd and doing a backtrace beats putting in 300 printfs in my code only to find that I did something stupid like forget to allocate a chunk of memory for some structure someplace.

      Of course, there was the time I was debugging some stuff to use SCSI in the uCLinux kernel, and just putting printk in the kernel code moved the failure point around... :-)

    3. Re:Debuggers are for chimps by EvlG · · Score: 2

      I don't understand the insistence that printf() is the only way to go, and those that use automated tools are surely lazy or doing something wrong.

      As I said in another post, why not let the computer do what it does best, so that people can focus on what they do best?

      The biggest problem with printf() debugging is the code littering process, and the constant recompiles. Say you have a bug in a subsystem that is writted in approximately 20,000 lines of code. How do you determine where the bug is? You insert printfs() into all the functions/methods to find the culprit(s), and then gradually refine the inspection until you locate the problem. Fine, this is quite similar to how one uses the debugger. The problem is, inserting all those printf() statements is quite time consuming, and removing them and modifying them is even more time consuming. Additionally, it is possible that the printf() statements themselves can cause additional problems or mask the true nature of the problem. Finally, each time you update the printf() statements, you need to recompile the code. That step alone can prove to be a real bottleneck manytimes. The programmer using the debugger can simply inspect values as much as he likes at runtime, without many of the time-consuming problems.

      In short, the programm with a debugger works just as you do, but is typically much more productive because the computer is doing the tedious steps for you.

    4. Re:Debuggers are for chimps by CharlesEGrant · · Score: 1
      1. Try to figure out through logic in which part of the code the bug could have occurred
      To be sure, a debugger is no substitute for really understanding the language, the API, and the program, but a debugger can be a useful learning tool to correct misconceptions about language features, APIs, etc.
      2. Use printf()'s to track the progress from the main structures to their branches until I've found the malfunctioning function or code snippet.

      3. If the error isn't obvious, I insert printf()'s that tell the location in the code or values of variables, until I've been able to find the bad statement.
      How is inserting printf statments more indicitive of sophistication and intelligence then inserting break points in a debugger? It seems to me that you are simply going through a lot of needless edit/compile/run cycles, when the same information could be obtained in one cycle with a debugger.
    5. Re:Debuggers are for chimps by torpor · · Score: 2

      Easy: test often.

      Whenever a SEGV rears its ugly head, I can usually think back through the last 45 minutes of code I've written and see where changes I might've made could introduce the bug. Then I just put printf()'s where needed until its clear, and I'm off again...

      This is why the mantra "Test Often" is a good one ...

      Incidentally, I've run into similar problems with uClinux, though these days I try real hard not to make changes to my kernel ...

      --
      ; -- the corruption of government starts with its secrets. a truly free people keep no secrets. --
    6. Re:Debuggers are for chimps by VAXman · · Score: 2

      Everything you can do with printf (i.e. examine variables), you can do in a debugger. The advantage being that you don't have to recompile everytime you want to examine another variable.

      It is almost impossible to debug certain types of bugs with printf - e.g. if a bug is exposed after calling a particular small function 10 million times, with three different parameter values, you simply wouldn't be able to do this with printf.

      That said, you can do significantly more with debuggers besides examine variables, such as data breakpoints and watchpoints. You can cascade different conditions together to trigger after condition A in function X occurs, and condition B in function Y has occurred, and after condition C in function Z has occurred. You can't do this with printf's since you don't have access to any variables except that function's local variables so you can't monitor what's going on in other functions.

    7. Re:Debuggers are for chimps by code_martial · · Score: 1

      The problem is, inserting all those printf() statements is quite time consuming, and removing them and modifying them is even more time consuming.

      It is not unfair to assume from the beginning that your code will have bugs initially. You can insert print statements as you code, rather than adding them as an afterthought. With more experience you'll start writing debug messages that require lesser amount of changing to locate a problem. AFA removing them is concerned, I follow a simple convention of printing a debug message on a line of it's own and simply grepping away all lines containing "std::cerr<<" when all's done.

      Finally, each time you update the printf() statements, you need to recompile the code.

      This can be tackled by, and indeed be an incentive for, good break-up of source into smaller, more intuitively organized translation units. I've seen single C files spanning ~ 10k lines in mature code. 10k lines of C can accomplish a lot and IMHO, it's better to break things into smaller, functionally grouped units.

  70. Don't Debug, Log by Elias+Ross · · Score: 1

    I haven't used a debugger in almost two years. I think the solution to diagnosing problems is to have in place a good logging framework (such as Log4J), which allows you to specify the verbosity of logging per subsystem. (Most people's complaints about using logging is that the noise/signal ratio is often too high to be useful.)

    Usually, with a complicated program, it's fairly difficult (in an IDE) to trace the execution flow without stepping into the wrong subroutine or accidentally stepping over the routine you're really interested in. In a lot of cases, it will take more time setting up your IDE or debugger to do what you want, than it is to simply set up useful log statements that capture what you're really interested in. If you set up all your objects in Java to return useful debug strings from the "Object.toString()" method, you don't really need to use an IDE for inspectors or watches: You can customize debug information, avoiding information overload, and allows you to present just the critical data.

    For memory profiling (leaks), disassemly, and performance analysis, a proper tool is very worthwhile. And I think that getting a stack trace from a core dump file useful. For everything else, I agree with Linus that debuggers don't really help you be more careful.

  71. GVD by BigMattG · · Score: 1

    You might take a look at GVD, the GNU Visual Debugger,
    which can generate graphs of datastructures.

    See: http://libre.act-europe.fr/gvd/

    1. Re: GVD by Black+Parrot · · Score: 2


      > You might take a look at GVD, the GNU Visual Debugger, which can generate graphs of datastructures.

      It also has pluggable language support, so $SOMEONE can add support for your favorite language to it.

      --
      Sheesh, evil *and* a jerk. -- Jade
  72. Reversibility is very hard by mbessey · · Score: 3, Informative

    You can implement reversibility on a per-thread basis (though that's harder than it sounds, in my experience). For multiple threads, it's basically impossible.

    It's much easier to implement back-stepping in a processor simulator or virtual machine than it is in a native-code debugger. Unless you single-step through all the instructions, keeping snapshots of all the relevant state along the way, you can't go back.

    And if you do single-step, the performance will likely be so poor that you might as well use a simulator.

    -Mark

    1. Re:Reversibility is very hard by exp(pi*sqrt(163)) · · Score: 2
      Reversibility could be done in at least two ways. One is to emulate and the other is to insert extra instructions into the code. Several tools do stuff like the latter - I think purify does and pixie (under Irix) definitely did.

      You don't need to store full snapshots. Some instructions require very little information to be stored to be reversible. Eg. add eax,1 only needs a few bits from the flags register to be logged.

      --
      Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
    2. Re:Reversibility is very hard by ptevis · · Score: 1

      Actually, reversibility is relatively straightforward IF you have hardware trace. However, this a feature that's not uncommon in the embedded world, but nonexistant outside of it. In the absence of trace, don't bother.

  73. Debuggers can be good but.... by MartinG · · Score: 2

    Debuggers have their place, but in some cases, to have to resort to a debugger can mean that the code is too complicated, or badly designed in the first place. Furthermore, having to use a debugger many times on the same bits of code is a clear sign that the stlye of the code is bug-prone and it should be rewritten.

    --
    -- MartinG To mail me: echo kewyjlcxyzvjfxbqwh | tr bcefhjklqvwxyz .@adgimnoprstu
  74. How teams are put together by jj_johny · · Score: 1
    The problem with most software development is not that the debuggers are good, bad or indifferent but that the makeup of the team. Ususally there is nobody in charge of tools, who just writes/finds needed tools and who can educate the programmers in how best to use the tools - including debuggers.

    So I am not suprised that debuggers still have not gotten anywhere cause general program development has not really evolved as you would expect. We all have lost site of the idea that productivity is total output / total input of the whole team but instead focus on our little part in the bigger picture even if we are screwing up the project in the process.

  75. Better approaches are needed by JoeBuck · · Score: 2

    Almost all comments ignore the main problem with debuggers: they let you verify that a program works correctly for a given input, but tell you nothing about what happens for other inputs you haven't tried. Did you miss something? Are there buffer overflows or security holes? Coverage tools can help, but then you've got to come up with directed tests to reach all of the code, or prove that it can't be reached.

    Complete formal verification for large programs is a pipe dream, but there is a lot that can be discoverd through static analysis. Consider Dawson Engler's Meta-Level Compilation project, which automatically found hundreds of errors in the Linux kernel, for an example of what is possible.

    Engler and gang have gotten quiet lately, I wonder if they are trying to start a company.

    There are other approaches, used in hardware verification, that can mix directed testing with symbolic methods (from a state that is reached in a simulation, can I reach some "bad" state? If so, generate a test vector that takes me there).

    While waiting for these tools to be developed, get a four-year old. Let him/her play with your GUI. If it's a Gnome or KDE app, it will probably crash in under ten minutes, because the kid will do things that would never occur to the developer or tester.

    1. Re:Better approaches are needed by Error27 · · Score: 2

      If you liked the Stanford Checker, but you want something that is a little bit crappier then you should try out Smatch.

      As far as I can tell, it's the functional equivelent of the Stanford Checker, but it not as elegant or complete.

      Also I wrote it.

    2. Re:Better approaches are needed by JoeBuck · · Score: 2

      Perhaps you'd be interested in working with the GCC team to get your patch integrated, so that it gets maintained, works with newer compiler versions, etc.

      I'm certain that major cleanups will be required before it could be accepted, but the experts may be able to help you do things in a more elegant, powerful way. And if every gcc version had something like this, free software would be less buggy.

    3. Re:Better approaches are needed by Error27 · · Score: 2

      Perhaps by next fall I'll be ready to do something like that. For smatch to be really useful that's the way to go.

      Right now I keep on changing the intermediate format and trying new things. Once it gets included then you have to worry about backwards compatability etc...

  76. Re:Perhaps.++ by Anonymous Coward · · Score: 2, Interesting

    One of the reasons debuggers are so far behind, is that they attempt to make the vonNeuman paradigm real for debugging programs.

    I write CPU simulators. In this kind of environment, there may be hundreds of threads each performing one little iota of work per (simulated CPU) cycle. When a bug is encountered, the code that encounters the bug is not in any way related to the code that created the bug. And the cod that created the bug may have made its mistake thousands of simulated CPU cycles (billions of actual CPU instructions) before the code that stumbles over the bug-incarnate.

    Stack back traces, and other vonNeuman-like debuggers are totally useless in this kind of programming environment. I am simulating real parallel things (circuits) on a sequential turing machine. Its no wonder that a debugger is useless--it is based on the wrong mental model of what I am programming.

    I have to build the degugger into the actual simulation code--which I proport--is the right way to debug programs anyway.

  77. It never changes by Anonymous Coward · · Score: 0

    New tools come on the market, new people come along, but many things never change. Most people do not code well, they only code well-enough. Programs do not have to work, they only have to work well-enough. There are still plenty of idiots in the business today but there are just more people so the percentage or outright count of people who are incompetent seems to be out-of-touch with what it was 10, 15, 20, ... years ago.

    Most people do not even know the first thing about debugging - it's almost a process of trial-and-error, regardless of their schooling, intellect, experience. They make a change, throw it against the wall, then see if it sticks. It's almost like they're wardialers trying to find a magic phone number.

    The sad part is their friends, relatives, and people who are lower on the ladder somehow think these people are gods.

    And to make it worse, most people, if they've attended college, have taken a few programming classes, or that's all they've taken. Where are the people who have taken a comprehensive scope to approach the industry? A hardware interfacing class, an assembler class where you write your own assembler, a database class where you write your own DBMS, etc. How about a technical writing course? No one says that because you take a hardware class that you have to expect to do hardware on the job, but it provides perspective. The same goes for technical writing.

    On top of that, look at the messages posted. 75% of the people can't write complete sentences - it's actually higher than 75%. Poor spelling doesn't mean anyone is stupid. It does, however, indicate they are poor organizers - unable to organize information in their brain, as an example.

    I already know most of the people who read this will shred it, but remember this:

    "Truth fears no trial." -Thomas Paine

    1. Re:It never changes by Oculus+Habent · · Score: 2
      I don't know how beneficial writing your own assembler or DBMS is. If your plan on becoming a programmer with a foot in DBMS, this might be a good thing, as it teaches you the underlying functions and limitations.

      To me, and I quite probably am very alone on this, it would be better to conceive of a DBMS (forgive the gravitation toward this one example) - to chart the program flow at a general level. Not:
      When an "Insert" is called, run the Entry function, which handles insertion, integrity, keys, indexes, etc...
      But instead of spending the time sitting down and creating a whole DBMS, why not understand how to do so. It is part of the writing process to understand the function of your application (hopefully), but what we need more than rote programming is imaginative conceptualizing.

      And, if you choose, you can take your concept, and follow the iterations down and break modules into components, components into functions, functions into code.

      Of course, none of this has much to do with debugging.

      And poor spelling doesn't mean poor organization skills. Poor mental organizers tend to have sequencing problems more than specific spelling problems, and crap classes like Study Skills in high school teach all the wrong ways to remember things (you "web" a database, not a textbook. Textbooks are almost always sequential, not relational).

      Some people were never properly taught to spell, and some people don't type well. This does not make them poor organizers.

      "There is no worse lie than a truth misunderstood by those who hear it." - William James
      --
      That what was all this school was for... to teach us how to solve our own problems. -- janeowit
  78. one word... by outsider007 · · Score: 4, Funny

    Clippy!

    --
    If you mod me down the terrorists will have won
    1. Re:one word... by silhouette · · Score: 2

      You look like you're trying to track down a memory leak! Would you like me tojg80;/aOUT OF MEMORY

      --
      Experts agree: everything is fine.
  79. debugging tools are only useful in rare cases by turingcomplete · · Score: 1

    Most programmers use some kind of logging & trace mechanism when debugging. For the most part you know where the problem is located and it takes longer to 'run program to cursor', then do watches on the variables, then it is to just do a log(Level.DEBUG, "variable", var) and run the program.

    Using a debugger is rarely more effective. Some situations demand it, e.g. a bug caused by a compiler bug.

    Perhaps language & IDE's should concentrate development on helping with the kind of debugging tools that programmers actually use, then sophisticated debuggers.

    At the very least using System.out.println() should not be necesary. VB has Debug.print although for various reasons it's really annoying to use. E.g. it doesn't clear itself on every program run.

  80. Sometimes it's interesting not to use a debugger.. by alyosha1 · · Score: 2, Insightful

    I use debuggers every day, and find them indespensible for tracking down obscure bugs. (Like the one I just hit a few minutes ago - why does MSVC barf when calling vector::clear? The debugger stops app execution in _free_base() in free.c. This doesn't happen if I recompile using STLPort instead of the default stl library. ) That said, when I don't use a debugger I'm sure I find myself writing more robust code - I'm more inclined to spend more time on proper exception handling, thinking about my design instead of: write, compile, run, oh it failed on line 2493, fix that line, run again, now it fails at line 2547, fix that .... which results in code that works under the exact set of circumstances that you test it, but has no guarantee as to what will happen if the parameters change any. (And those pesky users always find those annoying 'special cases').

  81. Omiscient Debugger by Degobah · · Score: 1

    I haven't used it myself, but this debugger for Java allows you to record the execution of your program and play it back again and again to see what's happening, who's setting what variables, etc http://www.lambdacs.com/debugger/debugger.html It appears to be free (as in beer), so there's a bonus for your right there!

  82. FLOW CONTROL and visual debuggers by goombah99 · · Score: 2
    One language I have used is "g" by National Instruments. They market it as "labView". Here one does not write code. in stead one places icons on a screen and wires their input and ouput nodes. A scalar operation like cosine has one input and one output node. A loop is a box with wires that pass in and out of the box, inputs for the loop length, and internal wiring for local variables. Inside the box you put more circuits.

    subrountins are just hierarchical encapuslations of these with inputs and outputs.

    a given subroutine does not "fire" (is called) until all of the input wires have delivered there data. Thus one does not (usually) explicity control the order in which subroutines execute. as long as they have no dependencies (i.e. output wires from one leading to input wires of the other) then they are free to execute whenever their inputs are filled.

    to debug in this language one watched the diagram. Graphicaly a value passes down a "wire" like a pig in a python and stops when it reaches an input (or maybe it splits if the wire splits, and goes to more than one input icon). once the subroutine icon has all its inputs filled, it pops open and reveals all the witing in side. the data again passes from the input connectors to the internal wires and so on. once all the outputs are satisfied, the window closes and were back in the original diagram.

    you can place text boxes or graphs or chart recorders, or image plots on any wire. these show you the contents or changing contents of the wire in the format if the viewer. e.g. a strip chart recorder plots single or array values on a strip char that scrolls with time so you can watch them change.

    you can selectively debug any part of the wiring diagram and let the other perform normally.

    The neat part of the language is there is NO SUCH THING as a syntax error, or wrong pointer, or memory location overlap. Indeed there are no variables at all. just wires and controls that inject values into wires or display values in the wires. this makes it very suitable for control systems where those sort of programming errors are undesirable. Better to have wrong functionality that weird unexpected memory errors

    the other cool thing about the language is that because it is inherently concurrent and event driven rather than sequenctial, the data flow language is easy to parallelize. It's also relatively easy to use an FPGA to hard code the functions of the icons into hardware.

    the problem with the language is it requires garbarge collection and is the memory management is not so good as implemented. It's not too speedy either. But as I said it may be that its parallel advantages and near bug free coding and easy debugging outweigh single cpu speen in applications.

    --
    Some drink at the fountain of knowledge. Others just gargle.
  83. The best debugging tool I've ever used... by leecho · · Score: 2, Interesting

    Is a stuffed frog I've got from my gf that sits on top of my monitor. When I need to ask something about a hard bug, I ask him first, and just by asking most of the time the problem gets solved.

    It's interesting to note that a lot of those day-to-day bugs can be solved by simply straightening out your train of thought by posing a question in a manner that someone who doesn't know the system can understand.

    1. Re:The best debugging tool I've ever used... by cant_get_a_good_nick · · Score: 2

      This may sound silly, but extremely effective. I had a professor who I did this to. I was staring at some homework that was bombing for 3 hours. Went to ask him what I fscked up. In the process I see that I used the wrong var as an index. I thank him for his time, and leave. If I had a frog, would have saved me some walking and him about 5 minutes.

      The trick is that you have to explain it to the frog (or whatever object) completely enough for them to understand it if they were a real person. Sometimes just the act of organizing your thoughts force a different organization which shows you what you were looking at for 5 hours but couldn't see.

    2. Re:The best debugging tool I've ever used... by JohnFluxx · · Score: 2

      Leecho, I want to buy your frog.

    3. Re:The best debugging tool I've ever used... by leecho · · Score: 1

      It's half a million dollars, take it or leave it.

      Think I'll announce the lil' green guy on eBay...

  84. Display structures, follow pointers by dochood · · Score: 1

    Borland used to have a debug feature where you could actually follow pointers in structures like linked-lists and stuff, and get a graphical picture of what your data looked like. You had these little boxes that were connected with lines, and you could move them around, kind of like M$ Access's Query Builder tool. That was so awesome! It made it easy to see whether or not your data structure was messed up, or if it contained messed up data.

    We use STL in M$ Visual C++ 6.0. When I need to look at an item in the middle of a vector, I have to iterate through it in the code. I don't think there's anyway to view an item in the middle of the list (you get the first item and the last item) without doing this.

    BTW, if anyone knows of a way to do this, please fill me in!

    dochood

  85. State preservation by selderrr · · Score: 2

    Some sort of smart dump of every variable & call in your app at any point. (Offourse for a short period of time only to avoid overflowing your memory. For instance limited to the last 5 function calls)

    This could allow you to replay a certain function with exact parameters as they were. I now often find myself repeating 5 minutes of clicking & typing to reproduce a certain function behavior of one line of code which *sometimes* crashes.

  86. Traceback buffer by Anonymous Coward · · Score: 0

    My first (non-intern) programming job had a traceback buffer as part of in circuit emulation. As soon as you hit the problem you can look back at the last so many K of instructions that were executed and figure out what the heck happened and how some other developer or buggy compiler screwed up your perfect code :). So many hard problems were easier to solve that way because printf only works when you put it in the right spot and can really slow things down.

    I used to complain about the tools we had then, but now I realize how rare it is that developers are lucky enough to have traceback buffers and even watchpoints (at least in the embedded world I program in) Most managers don't understand the value of spending 20K on a tool upfront because it could save you several weeks at the end of a project by fixing the hard bugs faster. You can just work 80 hours for them instead, thats free.

  87. The best debugger ever by egeorge · · Score: 1

    The best debugger I have ever used is Log4j. There is really no substitute for a good logging subsystem and grep. The chainsaw log viewer that is part of Log4j is also an excellent tool that can be used instead of grep.

    I have also found that an interactive scripting language can be very handy. I use Jython for peeking into the state of Java objects and manually working with them. In my experience, this kind of manipulation can provide much better insight into the runtime behaviour of your code than an interactive debugger can. It can even be used to probe objects for which you do not have the code.

    Of course, for non-Java development, there are usually analogs to these tools (syslog, perl, etc)

  88. Good Old printf()-Debugger - even for CGIs by Tux2000 · · Score: 1

    I'm working since the previous millenium (hehe, ca. 1999) on a complex, CGI-based application. Some day, I "invented" the "ultimate" printf() debugger for CGIs - a simple program that waits for input on a TCP socket and writes it to the screen or a telnet client on a second TCP port. The CGI to be debugged just opens a TCP connection and printf()s the messages into the TCP socket. All nicely wrapped in a small module, providing a single function named debug().

    I never needed anything else for my job.

    Back in those old days when Borland Pascal 7 was new and cool and I went to school, I was happy to have a debugger that could single-step into my Assembler code. But now, I have no more need for PEEK and POKE.

    --
    Denken hilft.
  89. Bah, humbug. by Kickasso · · Score: 1

    [mybox] dbx
    (dbx)
    help fix
    fix (command)
    Use `fix' to make changes to your program given. `fix' recompiles
    modified source files and dynamically links the modified functions into
    the application.

    1. Re:Bah, humbug. by Anonymous Coward · · Score: 0

      That must be a feature of the AIX version of dbx. The z/OS version that I work with doesn't have that subcommand in it.

      That seems like an interesting feature, though. I should talk to my boss about adding it :)

  90. Check out this debugger ... it REALLY works!! by mustangdavis · · Score: 2
    What would make a better debugger?


    In Java:

    System.println("MyVar = "+MyVar);


    In C:

    printf("MyVar is %d\n", MyVar);


    In C++:

    cout

    In PHP

    echo "MyVar is $MyVar <br>";


    In Perl

    print "MyVar is $MyVar\n";


    Works better than any debugger I've ever used .. and it saves my sanity too!!

    1. Re:Check out this debugger ... it REALLY works!! by djmurdoch · · Score: 2

      In C:

      printf("MyVar is %d\n", MyVar); ... [ Then save, make, wait, run ...]

      Works better than any debugger I've ever used .. and it saves my sanity too!!


      That "save, make, wait, run" part has been pretty hard on my sanity. Give me a good GUI debugger any day.

    2. Re:Check out this debugger ... it REALLY works!! by mustangdavis · · Score: 2

      OK, I give ...

      My "debugger" from the parent post probably works best with interpreted languages, but I still don't like most debuggers ....

      I feel like I accomplish something if I debug it myself ...

      Besdies, many GUI debuggers just aren't that user friendly (but I'm not saying print statements are either .. but they are mine) :)

  91. Easy capturing/debugging post-deployment by Fastolfe · · Score: 2

    I find myself routinely investigating problems with applications where I don't have immediate access to the source code, or where it's difficult to replicate the problem and we find that we have to correct it (restart, etc.) without getting an adequate opportunity to investigate.

    I would love to be able to grab a snapshot of a process and identify exactly what it was doing. In some respects, this can be satisfied by getting a process to core dump and analyzing the core, but to date this has always been an annoying and time-consuming process, requiring source code to see anything useful.

  92. How would I improve today's debugging tools? by HelbaSluice · · Score: 0

    Easy. ESP! I want it to know what I meant, and ignore what I said.

    That's also how I'd improve today's compilers and run-time interpreters, by the way.

  93. I'm tired of this useless drivel by Ars-Fartsica · · Score: 2
    Sure, we'd all like to make it perfect the first time. If there was a tool, methodology, etc that could deliver this, don't you think we would be using it???

    When the codebase reaches a certain size and complexity, you are going to be using a debugger, thats why this thread is taking place.

    1. Re:I'm tired of this useless drivel by theonetruekeebler · · Score: 2
      There's no magic bullet, yah. No the methodology. But just because there's no eliminate doesn't mean there's no minimize.

      I must admit the largest project I've worked on so far had only 350,000 lines of code, and given the then sorry state of Jave debugging, we pretty much settled for leaving footprints in the code.

      --
      This is not my sandwich.
  94. Custom data type viewers. by SteveX · · Score: 2

    Often the data I'm working on is tough to just look at to see if it's right; being able to write something that would plug into the debugger to display some data would be cool.

    For example, lets say I'm writing a scanner driver and I'm receiving buffers of data from the scanner. There's no way to know in the debugger if they look right or not - but if I could write a debugger plugin that could basically be given access to the entire address space the program is in with a target of "show me your data starting at this address if you can" it'd be awesome.

    Same would be true for any data that isn't represented as a data structure or ASCII. I found often doing Win32 GDI work that I wanted to see what a particular HBITMAP looked like at a given point of the program's execution and the only way to do it was to blit it onto the desktop or something.

    - Steve

    1. Re:Custom data type viewers. by dair · · Score: 2, Informative

      Often the data I'm working on is tough to just look at to see if it's right; being able to write something that would plug into the debugger to display some data would be cool.

      This is one of the features in CodeWarrior 8 (at least in the Mac versions, and presumably the Windows version too). You can describe how the data should be organised so that the debugger can view it sensibly (e.g., where to find the string data in a std::string or that a CFloatRect is 4 floats), or write a plug-in to display it using your own code.

      E.g., you could display an image as a square of RGB data and a square of alpha data - or as individual color planes, or whatever you like.

      There was also a Mac tool a couple of years ago called General Edit (not by Metrowerks), although not a debugger as such - you type in a templated description of what your data looks like (with nested definitions, fields that rely on other fields, etc) and it pops up a structured view of the data. Very useful for poking around in data that normally you'd be trying to interpret with a hex editor, as you could tweak your decoding description until you had it right.

      -dair

  95. Best debug tool! by Anonymous Coward · · Score: 0

    perl -c myscript.pl

  96. Use dbx, gdb or any other real debugger. by Kickasso · · Score: 1

    What's so special about that Eclipse thingy if it can't even do conditional breakpoints?

    1. Re:Use dbx, gdb or any other real debugger. by znaps · · Score: 1

      It can do conditional breakpoints, and lots of other special thingys.

  97. More good stuff is good by djmurdoch · · Score: 2

    The only way of truely solving bugs is to know exactly whats going on in the code

    This is the key. Anything that makes it easier to know what's going on in the code is good.

    Modern debuggers like the one in Delphi (probably similar to J Builder's) make this fairly easy. You need the GUI interface so you're looking at the source all the time, command line debuggers obscure it. It needs to be absolutely easy to find out the state of any relevant variables. You need to be able to drop down into an assembly view (or some equivalent if you're in an interpreter) to see what code got generated at a low level.

    The more *well-designed* stuff you add to the debugger, the better the opportunity for understanding the state of the program. Delphi doesn't have backward stepping; it would be great if it did, because it's often easy to detect that something has gone wrong, but hard to detect exactly when it happened. Conditional breakpoints are essential. Hardware breakpoints (which let the program run at full speed, but break when a particular memory location changes) are great.

    You also want to be working in an environment where it's easy to add custom views of data structures, so that you'll see when things have gone wrong. Delphi (and probably Visual Basic, though I've never used it) are very good at that. If you've got a lot of numerical data, it's basically a one line addition to generate a graph of it, and one keypress and a second or two to wait to compile a new executable containing that addition.

    You want tools like the various heap diagnostic utilities to be built in to the debugger, and you want system libraries to be written cleanly. It's easy to detect that you've got a memory leak if on exit your heap is always supposed to be completely empty; it's much harder if the run-time library leaves variable amounts of junk there, or if it's hard to determine what's there at all.

    Knowledge about your program is good. Adding features that make it easier to see how your program runs makes debugging much easier.

  98. It is the interface by Kefaa · · Score: 2

    Despite the slick graphical interfaces, nice thread stack traces and local variable browsers, I still make sure I have on hand plenty of notepads, graph paper, pens and pencils so I can try to build up a picture of what state the program is in and to help me play detective in pinpointing what is going wrong with my (or other peoples) programs. Do other developers have similar problems?

    Several people have mentioned feature enhancements, many I would also like to see. However, your statement about stuck me as being a little deeper. Yes, we have the same problems. However, it is not the debugger it is the interface in general. Your desires are for the "paperless office." For years we heard about it, but it never came to fruition. In fact, it may never come. The problem with a User Interface is it presumes users think, and behave in the a similar fashion doing the same job. Ask two secretaries how they file paperwork for themselves. Look at the notes written by two experienced developers during a debugging session. Similar results? Certainly. Similar approaches? Possibly. Identical methods for getting there? Doubtful.

    You need hand plenty of notepads, graph paper, pens and pencils because the task at hand requires you to keep track of abstract data. Why not screen prints, cut/paste of images, text, etc? Because the #2 pencil in your hand forces your to iterate you understanding (I am writing down X=2, then 3, then 4, then -32767 -- whoa!). In addition, you remove the "clutter" while also reducing the effort. Consider that you could cut/paste any sub area of the screen. X=2, now becomes X=2, cut, paste. X=3, cut, paste. X=-32767, cut, paste. X=2, 3, 4, 5, 6, 7 , 9, 37, -32767 looks very obvious. 37 records you must now relate together do not.

    I have also come to believe that the device interface is part of the issue. It is easier (for me) to mentally connect the window on a monitor with the printed surface than it is two windows. Perhaps the solution is a 36 inch monitor where I can have multiple windows open, so I can see everything at once. But it would still suffer from relating data, which also includes looking away from the code. Perhaps avoiding the "deer in the headlights" visual lock.

  99. Re:Use Ninnle...WTF? by Anonymous Coward · · Score: 0

    WTF is this Ninnle shit anyway? Googling it seems to bring up only three websites, one of which has smething to do with baby talk. Is there Ninnle distro or what?

  100. Web Application Debugging by techsoldaten · · Score: 2, Insightful

    As a Web developer, time is on the line and almost everything I do is in a rapid development environment. That being said, debugging information is extremely important.

    On the ASP.NET and Cold Fusion MX application servers, the debugging information provided by each is excellent and thorough. On CFMX, each error is specified by line on the template on which it occurs and provides a 'stack trace' (meaning a list of all the pages involved in generating that particular Web page), execution times for each template, and a complete list of all variables in all scopes. Complex variables, such as structures and arrays, are output along with all the rest in an easy-to-understand format.

    The one thing that could be done better by every application system, IMHO, is a self-documetation feature. I would like to be able to look at the source code and see a breakdown of all variables on the page right away. This may sound a little simple and not really a debugging tool, but I look at it as preventive maintenence.

  101. Real Programmers by m11533 · · Score: 1

    Real Programmers don't use symbolic debuggers. They use hex/octal crash dumps.

    While it does make sense to be thoughtful and produce your best attempt at working code on the first try, clearly this is an imperfect process (for why, see a recent article in IEEE Software... software development is Knowledge Acquisition, known to be a rather imperfect activity). Thus, choosing not to use the most efficient techniques available means you choose to take more time than necessary. You really should not need to handicap yourself by eliminating a productive and useful tool to have the discipline to do the development of the software properly.

  102. Cardboard cutout dogs. by sbaker · · Score: 2

    Peer review - without the peer:

    http://www.sjbaker.org/humor/cardboard_dog.html

    --
    www.sjbaker.org
  103. Re:Very True! by ashitaka · · Score: 2

    How many times I've had another developer come to me saying "Dammit! I've been through this a million times and I JUST CAN'T FIGURE OUT WHY IT'S NOT WORKING!!!"

    I then take a quick scan through the code and see the problem in a minute or two.

    The reverse situation has also happened.

    --
    If you don't want to repeat the past, stop living in it.
  104. Extreme Programming Helps by bruceFinding · · Score: 0, Offtopic

    I have found Extreme Programming techniques to be very useful. I do much less debugging now, because I write unit tests as (or even before!) I write the methods. I use the JUnit framework for all the Java code that I develop.

    I'm sure that debugging technology can and should be improved, but I think that better development methodology reduces the need for debugging.

  105. Use ddd, but with one improvement... by unixpro · · Score: 2, Insightful

    ddd is, by far, the best debugger I've ever used. I used to hate visual debuggers, but ddd turned me around.

    That being said, however, there is one improvement I'd like to see in all debuggers. That's a way to do memory checking. In other words, integrate Purify or Insure++ functionality into the debugger and have it break anytime there is a memory stomp. Memory problems are the biggest issue facing programmers of large, complex systems.

    For those of you who say to write small objects and give them unit tests, or to rely on things like printf(), I suggest that you get a job in the real world. Complex systems are written by large groups of people. When you hit a problem, it may or may not be in your own code. It may or may not be because you're using an object incorrectly. You need a debugger to figure out where things are blowing up and why. Using printf() will work, but it's slow and requires multiple compile/link/test cycles. Not the best use of your time.

    1. Re:Use ddd, but with one improvement... by Bill+Currie · · Score: 2

      Link your program with the electric fence library. Not perfect (can't handle really big (huge quantities of malloc calls) apps), but it makes your program segault at the right time (eg, in free when freeing invalid memory, on the line accessing freed memory, etc). valgrind seems to help a lot too (though I haven't used it much yet, just tracked down memory leaks).

      --

      Bill - aka taniwha
      --
      Leave others their otherness. -- Aratak

  106. Psychic Interface by MopOfJustice · · Score: 1

    Debuggers are always doing what I say, not what I meant!

    --
    ----------- Sig what?
  107. Memory allocation tracking by oliverthered · · Score: 2

    I'd like to see a debugger that told me where memory had been allocated/deallocated.

    Things like the last content of an object (if it has been deleted) and where that memory was allocated etc...

    --
    thank God the internet isn't a human right.
    1. Re:Memory allocation tracking by EvlG · · Score: 2

      This is already possible:

      wrap malloc/free or whatever your memory interface is with one that tracks the location and initial parameters of the allocation.

      Set breakpoints on this code when needed, and viola, you can track exactly what goes on. It's quite simple to do, and there is no need for the debugger to really do this.

  108. Why and how? by hackwrench · · Score: 1

    What about the code makes it bad? What is wrong with "playing" with your code until "it works" and the "edit and continue" school?

    1. Re:Why and how? by The+Bungi · · Score: 1
      Sigh. Look, first of all, I'm not trying to criticize VB or the people who use it, because then I'd be shooting myself as well beacuse I use it as much as I use VC++. Having said that -

      What is wrong with "playing" with your code until "it works" and the "edit and continue" school?

      I'd wager good money that 90% of all people who call themselves "VB programmers" that develop applications that way know essentially nothing about proper application design and how the environment and technologies they're using work. I've seen it myself countless times and I've seen internal studies done by Microsoft that confirm it. Write five lines of code, hit F5, walk through it, edit a line, continue, stop, write another 10 lines, lather, rinse, repeat. That's not writing code and that's not being particularly productive. That's learning how the whole thing works while you're supposed to already know it.

      The debugger is a tool. I'm not saying you shouldn't use it. But if the debugger happens to be your way of confirming a piece of code is going to work, well, then you have a problem.

    2. Re:Why and how? by pyrrho · · Score: 1


      the state of the machine created by the program no longer matches the state the new program would create.

      And also, you are looking at a special case, and making "it work" does not cover all cases, just the one you are working with, with it's specific inputs.

      But go ahead and do it... it's just that that's the problem.

      Basically, people that shotgun (not what you are saying nec.) and are happy when "it works" usually have not made it work, they have just seen it work. If this is OK probably depends on the complexity and variance of the input information.

      --

      -pyrrho

  109. Purify/Quantify-like tools by jrpascucci · · Score: 1

    Hi, Slow as it has, purify/quantify type tools (that track and display memory leaks and time sinks, respectively) have gotten better. I had a Quantify-like ability in the OS I worked on in the 80s (PRIMOS), called PBHIST, for process something (block?) historesis. But, I find quantify very useful (except that it slows things down inordinately for really large systems) for point-optimizations. Purify integrated into an IDE has very high bug-finding value. Consistently running purify with a solid unit-testing suite is going to save you many headaches down the road. -J

  110. Not usually a problem by harveyjrussell · · Score: 1

    I have found most tools adequate for more common development. The best suggestion is to actually create unit tests (if your language supports it) that help you isolate the problems. Once the test passes, you have solved the bug.

  111. Debuggers cause problems and are IDE-dependent. by $$$$$exyGal · · Score: 1

    I know this sounds cliche. But don't many many developers hate debuggers with a passion? They can be extremely useful at times, but they can definitely get in the way. There has been at least 3-4 times in my career when a debugger was actually causing problems to happen! That ain't right.

    Also, using a debugger often requires learning a new IDE. The best ones are usually integrated with some IDE that I otherwise hate. I understand why that would be the case, but I still hate it. I don't want to learn a new IDE!

    --naked

    --
    Very popular slashdot journal for adul
    1. Re:Debuggers cause problems and are IDE-dependent. by OneEyedApe · · Score: 1

      Try printf(), or its equivalent. Quick, easy, and informative. No new IDE. And with C/C++, you could (ab)use the preproccesser and write a macro wrapping printf that could be turned off with a #define, or command line equivalent.

      --
      Life sucks, but death doesn't put out at all....
      --Thomas J. Kopp
    2. Re:Debuggers cause problems and are IDE-dependent. by Oculus+Habent · · Score: 2

      Or you could define a function, dbprint, for example, that all your flow notes call, make dbprint do nothing when you don't need it, and delete any dbprint calls when you're done debugging.

      Of course, that would be much easier...

      --
      That what was all this school was for... to teach us how to solve our own problems. -- janeowit
    3. Re:Debuggers cause problems and are IDE-dependent. by Tony-A · · Score: 2

      I suspect debuggers are somewhat like console debugging a mainframe. While there are times it is the only expedient mechanism, the less one has to do it the better. For almost everything, there is a better way to do it, usually by including enough consistency checks or such and output of enough state to conveniently tell what's going on.
      Against debuggers is that they occupy address space and time space. The program being run under the debugger is not the same as the production program. Each will have a different set of bugs and anomalous behaviour. After being burned a few times by debugging the wrong system, (with debugger instead of production), I would imagine there are more than a few developers who have a strong dislike for debuggers.
      One strong argument for Open Source is that, assuming they don't take up too much resources, there is a tendency to just leave the bug-catchers in the production systems.

  112. This is what I want by SoftwareJedi · · Score: 1
    A debugger that will allow you to capture the value of a variable and log it's state with respect to time and code execution. That way you can step through a log side by side with a log of the code excuted line by line. That would be my wish.

    I know the same could be achieved with lots of printfs,couts or System.err.println,( I use this technique myself, in conjunction with JAVAs logging API ) but those are a pain to add and remove from code, especially in JAVA.

    Just my two cents.

    1. Re:This is what I want by russellh · · Score: 1

      I know the same could be achieved with lots of printfs,couts or System.err.println,( I use this technique myself, in conjunction with JAVAs logging API ) but those are a pain to add and remove from code, especially in JAVA.

      it sounds like you would be interested in Aspect J.

      --
      must... stay... awake...
  113. IN SOVIET RUSSIA . . . by Anonymous Coward · · Score: 0

    IN SOVIET RUSSIA, the debugger bugs you!

  114. START with a TRULY INTEGRATED ENVIRONMENT by Anonymous Coward · · Score: 0

    Don't think the same old "integreated developement environment" but view the computer as one "integrated environment". Be able to write code once, test it once, implement it once and regardless of what programming language, shell script, or computer that you are on, be able to access it.

    That is my current object within the Linux world.

    But then again, MicroShit would be even less than "micro."

  115. And another I forgot by exp(pi*sqrt(163)) · · Score: 2
    Breakpoints should be settable not just on a position in the code, but how you got there. I'd like to be able to set a breakpoint in function A() that only triggers if it was called from function B(). That can be interpreted in two ways: either when A() is called directly from B() or when A() is called from B() maybe via some intermediaries. Or I'd like to be able to set a breakpoint that activates only when the call stack is at a certain depth. Good for debugging those recursive functions!

    There's probably a technical term for the pair consisting of a position in the code and the path taken to get there. It's a bit like what a mathematician would call in a point in the universal cover.

    --
    Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
    1. Re:And another I forgot by Ivan+the+Terrible · · Score: 1
      You can do this using AspectJ.
      AspectJ enables "the clean modularization of crosscutting concerns such as: error checking and handling, synchronization, context-sensitive behavior, performance optimizations, monitoring and logging, debugging support, multi-object protocols".
  116. Some languages require hardware support by Anonymous Coward · · Score: 0

    I know that this only applies to C/C++/Asm (maybe Pascal, too?), but hardware support is required for things like 'what lines alter what piece of code' or constant variable watching. These languages will either need to be fully emulated and interpreted in the design cycle (which has it's pros and cons), or the debugging facilities of modern CPU's need to be more robust than just 'fire off the breakpoint interrupt'. Not that amazing things haven't already been done with the tiny foundation that has been given (it's a miracle to me that things like gdb work), but I think we all need to find our local hardware geek and take them out to dinner and explain to him/her what it is we from them to make our jobs as software engineers easier and more effective.

    As for interpreted and VM-based languages... this doesn't apply to you. You need to lean on your vendor for support.

  117. Debugging means to understand the code by kune · · Score: 2
    My law for debugging code is: "Debugging means to understand, what the code really does." That's reason, why you need pencil and paper.

    So debugging code is easier for simpler, cleaner code. So KISS (Keep it simple and stupid) will be the best debugging tool, we will ever have.

  118. Write-time debugging by JohnFluxx · · Score: 3, Interesting

    How about instead of not using any debugging tools, you debug at write time?

    For a lot of code, the compilier should be able to work out the pre and post conditions of a function, and then just check that when you call that function you don't violate them.

    Also I'd like to be able to hover my mouse over a variable and see what range of values it could have. From here you can check that you never go outside the bounds of a variable, and so on.

    Obviously you can never get it to work on all cases due to the halting problem, but it will work with a lot of code - and on confusing code you can manually add the special comments for the post and pre conditions - a good idea anyway for complex code.

    1. Re:Write-time debugging by Anonymous Coward · · Score: 0

      the compilier should be able to work out the pre and post conditions of a function

      I only see that as true if the program executes exactly the same way each time, and few programs do, demos probably being one of them. The way I see it, if you factor in user interaction for instance what you suggest won't work, but correct me if I'm wrong

    2. Re:Write-time debugging by JohnFluxx · · Score: 2

      not at all. Take a really simple example:

      int x;
      int myarray[5]; //then initialise myarray..
      scanf("%d", &x);
      myarray[x]++;

      So you ask the user to type in a number. The value of x after the scanf statement is [MININT - MAXINT]. But the legal range of myarray is [0-5]. So compare ranges, detect there is a value outside the range, and error.

      Threading will be really hard to do right, but will offer the greatest advantages (since threading is really hard to debug conventionally)

    3. Re:Write-time debugging by BrodieBruce · · Score: 2, Interesting
      Also I'd like to be able to hover my mouse over a variable and see what range of values it could have. From here you can check that you never go outside the bounds of a variable, and so on.

      Try using DDD. It's a graphical frontend to gdb. Also, it's open source.

    4. Re:Write-time debugging by JohnFluxx · · Score: 2

      Thanks - that would be useful info if it had any relevance at all to my message :P I'm talking about at write-time, not run time. I'm talking about ranges a value can be in all possible executions, not one particular execution.

    5. Re:Write-time debugging by toomim · · Score: 1

      Actually, compilers already do as much of this as they can. The problem is that they can't do much. It won't "work with a lot of code", like you assert.

      If you can come up with a compile-time analysis that does any better than the state of the art, you've got yourself an instant PHD thesis.

    6. Re:Write-time debugging by The+Panther! · · Score: 2

      Another feature that I really wanted to see would be a popup that tells you what O() order a function call would be, and have the compiler determine it based on analysis and corrective comments for difficult functions. Again, the halting problem applies here, but it would move a certain type of documentation into the face of a programmer, rather than obscurely in the middle of several nested functions.

      The pre/post-condition validation at write time is an idea I've been toying with for the past two years. The problem is that (most) languages do not extend pre- and post-conditions into the language itself. Rather, you have to infer them based on types. This isn't strong enough. What you really need is a language that allows you to define not only the types, but the values or ranges that are legal as input and legal as output.

      So, what I did was started from there and modified the grammar of C++ until it met all my requirements, then removed some things that would make such analysis impossible (like pointer arithmetic and anything else that contributes to weak typing), then added a few tweaks that I always wanted in my own language.

      The result? An almost purely functional language, using C++ like syntax, with some unique features... for instance, one of my favorites was that scoping with braces { } works differently, such that you must declare all variables you take _into_ scope from the parent block, and you could poke locally declared variables _out_ of that scope into the parent block through another declaration. This follows exactly the same syntax as declaring a function, which made it trivial to rearrange blocks of code or inline things manually, etcetera. It also solves the problem of scope reduction for temporaries which are used only to call the constructor on a non-default constructor class.

      Alas, I have no time to write the language, and considerably less to write an analysis tool like you describe, but it would have been neat to play with. A nearly perfectly functional language, as you know, parallelizes really well so I'd planned to put it on a cluster. Even bought the machines for it, then sold them when my interest waned. :-)

      --
      Any connection between your reality and mine is purely coincidental.
    7. Re:Write-time debugging by JohnFluxx · · Score: 2

      Well I was thinking why not integrate these compile-time checks into my editor? If the checker can't do something, then let the programmer help out - it's good to do post and pre conditions on complex code anyway..

      But yeah, this is actually what I want to do for phd ;)

    8. Re:Write-time debugging by JohnFluxx · · Score: 2

      pointer arithmetic was something that bothered me. But, from a naive point of view, how hard can it be? Famous last words I know, but sure 90% of the cases are:
      *) Point to something of known type (easy case)
      *) Point to something of type void * (I don't even know what the compilier does, so I'll ignore this case)
      *) Increment point by one, or some smallish number (Easy again - turn it into an array reference)

      You would need some kind of simulated memory to make it easier to update arrays when you update the pointer to an array.

      Remember that in the areas where it gets hideously complicated I can just give up and set the variable to unknown. If that is too wide, the programmer can add special-comments.

    9. Re:Write-time debugging by Anonymous Coward · · Score: 0
      Unfortunately this really won't help you much in the real world, when the compiler does exactly what you tell it, and there was a subtle flaw in how you expressed it.


      A compiler is NEVER going to be able to understand your intent. The only part of the problem it can see is the part you have expressed.

    10. Re:Write-time debugging by Anonymous Coward · · Score: 0

      The pre/post-condition validation at write time is an idea I've been toying with for the past two years. The problem is that (most) languages do not extend pre- and post-conditions into the language itself. Rather, you have to infer them based on types. This isn't strong enough. What you really need is a language that allows you to define not only the types, but the values or ranges that are legal as input and legal as output.

      Haven't you seen Eiffel? Eiffel is all about pre and post conditions.

    11. Re:Write-time debugging by JohnFluxx · · Score: 2

      Actually these are the cases that I hope to tackle. For example when I finish writing a function, and then notice that my editor has added a post-condition that, say, x>0, and I thought I had written my alogirithm to include x in the output, then I know I have made a mistake.
      Same with preconditions - If I wrote a function and it says the precondition was that x!=0, I might realise I made a mistake, or what have you.

      Obviously this won't tackle all, or even most, of the cases - but it helps.

      The only way you are going to check what you wrote is truely correct is to compare it against a formal specification - which is another topic entirely.

    12. Re:Write-time debugging by scrytch · · Score: 2

      > Another feature that I really wanted to see would be a popup that tells you what O() order a function call would be, and have the compiler determine it based on analysis and corrective comments for difficult functions

      Collect your nobel prize when you do this. It's not possible. Okay, you could do a 99% solution, but I don't see a demand for it in debugging, and it's something a code coverage tool and a profiler will point out in very short order anyway.

      --
      I've finally had it: until slashdot gets article moderation, I am not coming back.
    13. Re:Write-time debugging by Anonymous Coward · · Score: 0

      Yep, that guy was high when he came up with that wish list. He must be hanging out with marketing a lot.

    14. Re:Write-time debugging by The+Panther! · · Score: 2

      I never claimed it would be 100%. Notice I specifically referenced the halting problem... Typical usage would benefit tremendously from such a feature, much of which is already known to the compiler. The last 1% of cases are for academics to bicker over. I'm a programmer, dammit. :-)

      --
      Any connection between your reality and mine is purely coincidental.
    15. Re:Write-time debugging by BrodieBruce · · Score: 2, Insightful
      Hmmm...I didn't even think of that. I guess I just skimmed over part of your post rather quickly.

      However, such a debugger, even if it did exist, probably wouldn't be incredibly useful. Sure, you could catch some errors. But most non-trivial programs I've written consist of so much on I/O (user & device) and system calls that a write-time debugger couldn't possibly tell me the values of enough variables such that it would be nearly as useful as a decent run-time debugger.

      And c'mon, who wants to debug until it doesn't work? That's what testing is for. :-)

    16. Re:Write-time debugging by Anonymous Coward · · Score: 0

      This is all well and good if you can predict how things are going to occur, but in NT/W2K/XP drivers for example you can be sitting on top of a whole array of other drivers, filter or hardware.

      Your initial example with the scanf is also quite interesting, given your now talking about formal specs. It's not the run-time compilers job to range check user input, or know when it's appropriate to range check a variable before use. If the range is important, add some code so the compiler doesn't have to make assumptions. Many situations I can think of the range of a number is not always a min,max situation but one where the exceptable values are sparse and large in number.

      I'm sure NASA has formal methods out the wazoo, but the compilers can't tell if a number represents metres, feet, or widgets.

    17. Re:Write-time debugging by JohnFluxx · · Score: 2

      user and device IO is dead easy, since you should check the input and should assume that it can be anything - that's the easiest case.

      I was thinking of manually adding info system calls so that you wouldn't have to parse glibc etc everytime.

    18. Re:Write-time debugging by JohnFluxx · · Score: 2

      I would guess that in 99% of cases you should assume the user input can be anything. It would also be nice to assume as little as you can about the data being fed in from hardware and drivers and filters.

      Handling multiple allowable ranges is trivial, and I never said anything about restricting it to just min,max. You are right you have to allow for multiple ranges (like 1-2,140-700,800-900) but that is trivial.

  119. Reversibility available for Java by drfuchs · · Score: 1

    Concerning the requests to be able to "reverse" the execution of a program ("Go back to the moment when this variable got set to null; what was the call stack like at the time? What was the value of local variable X (somewhere up the call stack) at the time? Now continue the dynamic execution of the program until the next time X changes..."): Such functionality is available in the RetroVue debugger for Java at http://www.visicomp.com/ (Gosling loves it, according to the quote on that page).

  120. Hmmmm - can you say 'Debug Library Routines'? by Anonymous Coward · · Score: 0

    For all of my projects I have a carefully crafted debug library I use to encapsulate all of my objects.

    Turn on debugging - and out pops the error in most instances. On the rare occaision when things get sticky, the debug code usually helps me zero in on the issue quickly.

    You should also develop your own libraries of common routines and include them in every project. The more variables you elimenate, the less looking you need to do when a bug rears its ugly head.

    1. Re:Hmmmm - can you say 'Debug Library Routines'? by Lodragandraoidh · · Score: 1

      Abso-frigging-lutely!

      --

      Lodragan Draoidh
      The more you explain it, the more I don't understand it. - Mark Twain
  121. I wonder. by Kickasso · · Score: 1

    How "stop modify variable" command works in dbx?

  122. Re:Debugging Not being a troll but.. by Anonymous Coward · · Score: 0

    Intuition requires intelligence, and intelligence is something that computer programs do NOT have. One programmer's idea of intelligence is anothers roadblock that keeps him from getting the job done. Intuition would require the same amount of intelligence as a 'foreign language translating machine' that can translate based on the context of the conversation, and we are hundreds of years away from that. Frankly everytime I use a program that has some supposed intelligence built into it like MS Word, I end up getting extremely frustrated at the program, because the program prevents me from doing my job or I get lazy and stupid and let it do the work. Ever try to start a sentence with an uncapitalized word( just because you want to) or the grammar and spell checkers. Either way the program is very far from being intelligent and noone near capable of showing intuition. Maybe someday, but we will have to wait along time.

  123. Threads by jtougas · · Score: 0

    It would be nice to control multiple threads at once. It would be incredibly useful to test and debug critical sections and all.

  124. Start with tools that really work by m11533 · · Score: 1

    I find I spend a LOT of my time debugging or working around bugs in the tools. Nothing is more aggrevating and frustrating than getting exactly where you need to get to find a bug in a program only to have the debugger itself crash with a SEGV. Between that, and the inability of many of these tools to work easily in the modern dynamic library and distributed computing environments, life is far more difficult than it should be using the existing model.

    Thus, I want a debugger that absolutely does not crash. I want it to let me set breakpoints in any routine, even if it resides in a dynamically loaded library that is not currently/yet loaded. I want to be able to view ALL of my data in their abstract datatype form without having to look up their definitions and then manually guide the debugger through doing the job. And, I want a debugger that always honors my commands and does not lock up (which I find far too often with the GUIs layered on top of command line debuggers).

    I am a long time member of ACM (since 1977) and have watched research into debugger technology over those years. I have seen attempts at dramatically different conceptual models for debugging, but none seem to have been successful. In fact, even most graphical IDEs appear to have been failures. I suspect this is all because ultimately things boil down to mapping program behavior to the code and verifying results are those that are expected for that code. There is little room for new or different models and abstractions so long as code remains the same. And, given the modern evolution of coding, it will be quite some time before the term "Visual" means something more than being part of the Microsoft Visual Studio suite while continuing to use good old text based software language(s).

  125. Re:Very True! by JohnFluxx · · Score: 2

    This is actually one of the reasons I like the pair-based programming style set out in XP. Admittedly it is not really supposed to be for this sort of thing, but it is a really nice benefit

  126. Scriptability. by Kickasso · · Score: 1

    How come no one mentioned it? An ability to write debugger scripts helps immensely. In my environment at least, that is.

  127. I only need 1 command in a debugger by grmoc · · Score: 3, Funny


    I just need the "why" command..
    =)

  128. Re:More is bad - WHY? ego is bad by Suicyco · · Score: 2

    A good debugger/disassembler is invaluable in finding obscure bugs. No amount of knowledge of your code and its structure can help you if a system call mangled a stack in a subtle way, especially with cumulative effects of buggy functions that have very very subtle bugs. Unless you are writting embedded code or something that doesn't rely on other code (an os, libs, etc.) you will never have a total view of what is going on. Debugging tools can help pinpoint generally where trouble is, and then it is up to the programmer and his detailed knowledge of the code to figure out what exactly is being affected and by what.

    There is no right/wrong answer because "debugging" is such a vague term as well. Use all the tools available to you, and arrogance is not one of those. Nobody has perfect understanding of the internal intricacies of software running on top of an operating system running on top of a cpu.

    The best way to beat a bug is to be knowledgable enough to use the right tool, at the right time, to find the correct cause of trouble. That could be anything from a cable tester, to a disassembler, to a coffee break, to another human being.

  129. The perfect debugger... by CommieBozo · · Score: 0
    It should be soft and cuddly.

    With lots of firepower.

    Its eyes should be telescopes! No, periscopes! No, microscopes!

    It should be full of surprises.

    It should never stop dancing.

    It should need accessories.

  130. Spot errors early by Anonymous Coward · · Score: 0

    You have to use a whole range of techniques to get reliable code. A debugger is really only the last-ditch attempt when you really cannot figure out what has gone wrong. The main reason bugs can be hard to spot are when the error does not lie at the point of failure. To combat this, you have to have a robust testing suite so that errors are spotted early. You also need to litter your code with assertions to make sure your program has not failed long before the bug becomes apparent.

  131. debuggers can't get much better by Incy · · Score: 1

    Timeline of watches. I.E. I want the debugger to log any changes in these variables over the life of the program. Draw it nice and pretty so I can see the order in which the changes are happening. but other then that.. I can't think of much else a debugger can do without some more hooks from the language/runtime... Line numners, Assertions, stack traces (with method names and stuff)... are all basic things that really make debugging easier.. but the underying language/runtime had to support them before the debugger could invent nifty features. So, what other meta information could we add to our applications to allow the debuggers some new features? I guess I didn't come up with an answer.. just another question.. that I don't know the answer too.. Maybe it would help if I used a debugger...:)

  132. Debugging race conditions. by Rimbo · · Score: 2

    The hardest thing I've ever had to chase down were race conditions.

    Race conditions don't act the way you'd think they would. If two threads both try to read a variable, you wouldn't necessarily think there'd be a problem, much less a problem that causes your program to suddenly decide to corrupt your hard drive and crash your program. And there's no really effective way to find out where the crash happened, because it happens at random, when you don't expect it.

    Even printf()'s fail you here.

    The only way to find a race condition is to hand-inspect code, and make sure every shared variable is protected by mutual exclusion.

    If I ever got back into grad school, I could probably dedicate an entire career to solving just this one problem.

    I think the real problem, though, is not that there's a lack of good debugging tools, but rather that the really good debugging tools are rare, and the more common ones may have power but are difficult to use. And digging even deeper than that, the real problem is that people tend not to use languages that will enforce programmer discipline and help to prevent programmer errors from getting into the software in the first place.

    1. Re:Debugging race conditions. by JohnFluxx · · Score: 2

      I'm just finishing uni and want to spend a lot of time on this sort of problem.

      I feel that the solution is not run-time debugging, but write-time debugging - why can't my _editor_ at least try to spot race conditions, buffer overflows, etc.

    2. Re:Debugging race conditions. by Rimbo · · Score: 2

      And here, I thought I was the only person in the world who would be interested in pursuing such a thing! :) I'm glad to hear someone else is interested in this too.

      What you say sounds reasonable. I've had similar thoughts as well. It seems that once a race condition gets into a program, the results are typically impossible to debug once the program starts, so some form of analysis -- possibly by the compiler -- seems to be the most likely route to success.

  133. Breaking when contents of memory address changes by cshay · · Score: 1

    Visual studio 5 used to let you do this. You gave it an address and a range and if any memory contents changed in that range a break would occur. This was extremely useful when you had an errant memory write elsewhere in the program such as writing off the end of a string, etc.

    This is different than watching a variable because you can't watch most variables all the time, only when you are in their section of code.

    I was very disappointed to find that Visual Studio 6 stopped supporting this. You could give it an address, but it figured out what symbol (variable)
    the address was associated with and ended up doing an ordinary variable watch on that (and when code was no longer in the class or code module, the watch was no longer looked at, as mentioned above)

    Does anyone know if MS ever fixed this in later releases? (the last time I checked was back in 2000)

  134. Another type of conditional breakpoint by netruner · · Score: 1

    I've always wanted the ability to set a conditional breakpoint on a variable. Let me explain: Have you ever had an issue where a variable was changing and you didn't know what line of code was changing it? Well, that's the kind of breakpoint I would want. Set a breakpoint on: myvariable whenever it changes, and zip to the line of code that changed it. Take this one step further and you could set a breakpoint to go off whenever the variable in question reaches a certain value.

    --



    DISCLAIMER: This post was not checked for speling and grammar- if you complain- you're a whiner
    1. Re:Another type of conditional breakpoint by EnglishTim · · Score: 2

      Come on. Move over to the dark side. Use Visual C++!

  135. valgrind by Anonymous Coward · · Score: 0

    Valgrind. It's the first thing you should use when you've detected a bug. If it's a memory related bug, nine times out of ten, it will find it immediately, as well as several potential bugs you didn't even know about.

  136. One word: Purify by darrylo · · Score: 1

    Purify, an expensive, proprietary piece of commercial sofware, has got to be the most unbelievably timesaving debugging software out there.

    While not perfect, it's a bloody godsend, because it detects (at runtime, usually when it happens, and not long afterwards, like program termination):

    • The use of uninitialized variables.
    • Reads/writes past the end of allocated memory.
    • Memory leaks.
    • Re-use of free'd memory, as well as free()'ing freed memory.
    • Open file descriptors.
    • Lots of other nasty things.

    It basically helps you quickly track down the really nasty bugs. Instead of spending days pulling your hair out, you can nail the bugs in minutes to hours. It does cause your program to run 3-10X slower, though.

    Yes, there are other, open-source alternatives that do some of the above, but none do everything, and many have problems. The closest things are the various debugging malloc()s, but they're useless for tracking down the nasty uninitialized variables (or for showing you the exact line of code that trashed the malloc()'d memory). One of the really nice things about Purify is that Purify works at the object file (.o, .a, .so, .lib, .obj, .dll, etc.) level and does not need access to source code (purify is generally a link-time option). You can run purify on other proprietary code for which you have no source code (very nice for seeing if the bug is caused by your code or someone else's).

    It exist for both Unix and Windows. I'm pretty sure that it exists for Linux, too.

    It also works with most (all?) debuggers, including gdb.

    It's good. It's really good (even though it's proprietary). If you develop commercial software, and your competitors use it and you don't, you're at a serious disadvantage. It's that good.

    (And, no, I don't work for Rational (or IBM). I'm just a very happy user.)

    1. Re:One word: Purify by anent+nought · · Score: 1

      Check out valgrind It's like Purify, but it's free.

  137. Debuggers facilitate trial and error approach by Anonymous Coward · · Score: 0
    Debuggers facilitate trial and error approach so they MUST be avoided, unless absolutely neccessary.
    These tools are much less important than, e.g. version control, which should be standard component of every programming environment.


    Modern debuggers are feature rich and IMHO don't need any improvement (perhaps some sort of usage control will help - to make one think twice before launching debugger).

  138. One Word: TotalView by Gudlyf · · Score: 2
    TotalView

    'nuff said

    --
    Trolls lurk everywhere. Mod them down.
    1. Re:One Word: TotalView by mz001b · · Score: 4, Informative

      I agree, Totalview is a really impressive program. When you have a bug that only manifests itself on 16 or 32 (or more) processors, print don't help as much. Stepping through code with totalview can really help figure out what is going on.

  139. It's not the debuggers, it's the languages by Anonymous Coward · · Score: 0

    It's not that the debuggers need more features. It's that the design of the languages shouldn't require it.

    For example, changing code while it's running. I heard Java is adding this for 1.4 or 1.5. Makes debugging easier, right? I could do this in Smalltalk or Common Lisp 10 years ago.

    Add a method to a class? Trivial in ST or CL. In Java or C++, quit, recompile, run again. Type a line of code and see the result? Again, trivial in ST or CL. In Java you can sort of do it with an almost-Java called "BeanShell". And on and on.

    If Smalltalk or Lisp had half the vendor support Java does today, I'd switch in a heartbeat.

  140. heaven to hell by floydman · · Score: 1

    Well, i am one of the cheesy devlopers that always use IDE's, i used Borland's CBuilder, Kylix, MSVC, and i havent met any major debugging problems except for a few bugs(i mean i had problems but i just handled them). Currently i am using Qt, and i have to admit, debuggin here is not easy, so i agree with u, WE NEED TO DEBUG.

    --
    The lunatic is in my head
  141. I don't use debugging tools for much.. by defile · · Score: 5, Interesting

    But I only use debuggers for two purposes.

    Purpose 1. Segmentation Fault (core dumped). Uhm, now where did that happen? Whip out gdb, find the line that generated SIGSEGV, and it's usually obvious how it happened. If not, I have it print out a stack backtrace. If I really can't figure it out then, a 5 minute walk around the block and I'll have figured it out as soon as I sit back down.

    When writing in high level languages, I'm finding that debuggers are wholly unnecessary. In fact, I can't remember the last time I spent more than 20 minutes trying to track down a bug. *shrug*

    It'd be nice if debuggers solved my problems automatically, but I'm really finding that I don't need them. I might even go so far as saying use of debuggers encourages dependency on debuggers, which in turn discourages thinking about the program itself. Not saying that EVERYONE does this, just that some of the best work gets done remarkably well even without debuggers.

    The Linux kernel, for example, was largely developed without the aid of a debugger, and the core developers seem to eschew them. Here's a good thread on why the developers don't want to include a debugger.

    Purpose 2. On the other hand, debuggers are remarkably good at helping you break program code. With having almost no experience using gdb, I was able to break the license key check on Intel's C Compiler in about an hour. I was amazed at how easy it was to attach a debugger to the compiler and skip the subroutine that performed the license key check. With no debugging symbols to work with. Disassemblers rule. It took another 10 minutes to turn this into a script that could be distributed as a wrapper for icc (called xicc), so all you had to do was set CC=xicc in the Makefile.

    Sure I could have used LD_PRELOAD so that time() always returned a date within the trial period, but breaking program code with a debugger is just so gosh darn fun.

    1. Re:I don't use debugging tools for much.. by Anonymous Coward · · Score: 0

      Congratulations! If what you say above is true, you are an excellent programmer.

      I would like to add a third purpose that you should consider using a debugger for: Understanding other peoples code. I personally find it very useful to set a break point at the entry point to someone else's code and just follow it through with the debugger to understand their object structure and what they mean with various function names. This also saves me a lot of searching through files for the definition of the function called. Of course if the code were properly documented to start with, this also wouldn't be necessary, but we don't live in an ideal world.

    2. Re:I don't use debugging tools for much.. by Anonymous Coward · · Score: 0

      You should really read this article on Phrack 58, about binaries encryption in order to defeat debuggers/disassemblers (and the few decompilers out there).

  142. backtrace by Bill+Currie · · Score: 2

    (call stack, what have you). If a debugger won't give you a stack trace (optimized code excepted:), throw it out. I've found that fixing a null pointer error is often as simpile as running the program in gdb until it crashes and then reading the results of backtrace. function name, parameters, source file and line nummber: (almost) everything you need to find out how that null got passed to your function.

    --

    Bill - aka taniwha
    --
    Leave others their otherness. -- Aratak

  143. small apps by Anonymous Coward · · Score: 0

    People fail to understand the purpose of VB far too often. VB is great for writing small apps.

    Every big app starts out a small app.

    ("A program of a million lines starts with a single character.")

  144. Debuggers are a waste of time by mikehunt · · Score: 1

    Over the years I had used many debuggers and always found I spent huge amounts of time on the process for very little reward.

    Then I started using an inline trace system in my code. Simply put, I can output any text I like, a la printf anywhere in my program. All subroutine entry and exit points are covered by trace statements and critical branches and variables are traced. Each trace statement has a level associated with it so that the trace can show just high level execution detail or low-level detail on request.

    All trace statements are output to a file if trace is turned on. The size of the file can be controlled, new files created every x megabytes, or they can even be made to wrap once a certain size is reached.

    In the end, the trace statements are almost like 'live comments' that clearly show what the code is doing and why. If trace is not enabled, the overhead of the trace system is negligible. If that's a problem then a compile-time switch removes trace completely. I can even turn trace on or off and change it's level on a running process.

    Since using this system I've never needed a debugger. When something goes wrong it is so simple to get the trace file and source code and follow what happened. For catching those bugs that happen once in a million executions, it is completely indispensible.

    Sure, you need some discipline to write good trace in the code, but then again you need that discipline to write good code anyway.

    Anyone else used a similar kind of system? My experience here is C code on UNIX systems. It might be harder to implement this in other languages or operating systems.

  145. No improvement because debug is the wrong tool! by MCRocker · · Score: 1
    Debugging hasn't improved much because it's really the wrong tool to ensure program quality. Debuggers don't prevent coders from creating bad programs. At best debuggers are after-the fact, symptom oriented fire fighting tools that often point to more deeply seated problems than individual atomic bugs. Also, don't forget that in modern object oriented code, the old linear debugging techinques often produce results that are different than the actual program will because of threading, race condition and other issues.

    The inadequacies of debugging (not just the dubuggers themselves) as a method of ensuring quality is why methodologies like agile programming and extreme programming are garnering so much interest from developers. It's also why there has been an explosion of tools that can help with the creation of good software with fewer bugs, easier maintenance and a better chance of actually solving user problems. In the Java world, there is junit, mockobjects and log4J , that can all be used with ant so that tests can be automatically run with every build and source control systems can be automatically updated. One approach is the Naked Objects framework, which is a combinination of a design methodology and tools in one package that has advantages like the easy rapid prototyping and automatic user story docuemtation.

    For example if you were using the Naked Objects framework to create a system, you might take the following approach (simplified here for posting):

    1. Start with an Exploration phase, which includes:
      1. Meeting of developers, administrators and end users to discuss the nature of the problem and brainstorm possible ways to implement the solution.
      2. Create a rough prototype immediately (Frameworks like Naked Objects makes rapid prototyping like this easy).
      3. Go back to the meeting, have everybody play with the code and make more suggestions and changes. Demonstrate the prototype frequently to elicit feedback.
      4. Repeat (often) till people are mostly happy with the results.
      5. This prevents the all-to-common situation where a written specification results in excellent software that doesn't actually solve any of the problems that the users have.
    2. Specification Phase:
      1. Use what you've learned to write a specification that includes lots of special case scenarios (use-cases, user stories etc.)
    3. Delivery Phase:
      1. Throw out all of the code you've already written... maybe keep the class and method names, but no actual functional code
      2. Write the tests FIRST. This includes unit tests, acceptance tests and corresponding documentation.
      3. Write the code to implement various user stories and test frequently.
      4. Auto-generate user training manual, which is based on the acceptance test code.
      5. Deploy to beta testers and be amazed at how happy they are with the product and how few bugs there are.
    4. Notice that approaches like this emphasize getting the design right and doing constant testing to ensure that the code that is delivered actually does the job that is expected of it. Debugging is rarely required when such methodologies are used, though profiling can be of some use.

    --
    Signatures are a waste of bandwi (buffering...)
  146. Debuggers are useful to a point ... by uw_dwarf · · Score: 2, Interesting

    While knowledge of a debugger is useful, it is only a part of the debugging arsenal. You can't beat the wisdom gained by experience. Some people are better at finding bugs than others. Some people have a broader knowledge of the interactions of various layers of software than others. The more bugs one finds and fixes, the better one gets at finding and fixing them. But move from one environment to another, and only the thought process is portable--you need to re-learn the context (which gets easier the more contexts you've worked in). And sometimes that environment doesn't have the debugger you're most familiar with. So again, the tool itself is devalued, and the ability to "debug outside the box" is emphasised. Sometimes you can't put a debugger on a system (live telephone switch); sometimes you can use a debugger but can't put a debuggable image on (same example--how's your hex and 68x00 assembler?). In short, a better tool isn't going to make debugging easier. It may shorten the time to identify the problem area, but it doesn't make the process of removing the bug easier, especially in huge systems with many interacting layers and heterogeneous nodes. That being said, I use stack traces, breakpoints, variable/parameter dumps, and registers when I can get them--and that's about it. The other features don't provide value to me (my opinion, but I'll share without imposing it). Design for debuggability--somebody will feed your software something that's out of spec. Controllable tracing is useful here, but put the control flags in a piece of shared memory that a utility can toggle on and off, because you can't modify environment variables for a running process outside that process. And if your execution environment is guaranteed to have a debugging environment available, master the debugger if you can, but make sure it doesn't master you so you can't debug without it. The best debugging toolset is, in order of importance, your mind, the source code, the occasional invitation to others to look at the code with you, a whiteboard or notebook, and a room free of distractions. Surface for air and refreshment every 45 minutes or so, and food every few hours (there's a reason the Jargon File has an entry for "rotary debugger"). Debugging software will inform this process, but feature-rich debuggers will not speed it up much.

    --
    The Seventh Rule: Take others more seriously than yourself, particularly when you are leading them.
  147. I don't use them, and here's why: by under_score · · Score: 2

    I've been developing software professionally for over 10 years and I can count the number of time I've used a debugger on my fingers.

    I've programmed in c, Objective-C, Java, and a little in C++. I've worked in healthcare, oil and gas, high tech, and most recently the financial field. In all cases I have found that I can track down my bugs by using my brains and sometimes inline print statements (yes, I admit it). I spend approximately 1/10 of my total development time doing debugging work as opposed to design or coding.

    Debuggers are too big a context switch. They don't act like part of the IDE. The best I have ever seen is the debugger in Visual Age (by IBM). It allows some pretty amazing things: you can roll back the stack and continue executing, and you can change any code dynamically while debuggin (the debugger figures out how much of the stack needs to be rolled back to allow for the changes). It also has all the usual stuff like value inspectors, conditional breakpoints, etc.

    The one thing I would really like is to have a more sophisticated watch system that allows me to use the IDE (not the debugger) to insert development-time only code. This would allow me to put in such things as print statements that would not be part of the "real" source code, but rather just part of my project. It would also allow logging, performance measurment, etc. to be done at development time. Note: I don't want to context switch into a debugger to do this!!!!

  148. GDB the millstone by DrXym · · Score: 3, Interesting
    I don't know about others but I find it an immense pain in the backside to debug anything on Linux. The reason is GDB which has to be the biggest hinderance to development on Linux. Arcane, slow and unintuitive would be words best used to describe it. You could grow a beard while waiting for a backtrace when debugging a stack overflow in an app like Mozilla. I've seen GDB page my system to death before now, such must its memory requirements must be for some operations.


    Even front end tools are little help. DDD is much better than the cli but it still suffers the same performance faults as GDB and introduces some fun issues of its own. Even a 'commercial' tool such as Project Builder on Mac OS X groans to a halt with GDB running underneath and has some very odd concepts concerning when breakpoints are hit or not.


    All this would be understandable if Win32 were the same but it isn't. Debugging on Win32 is a snap - just in time debugging, compile in time debugging, a debugger that works, integration with the editor and more. It is sad to say that if asked and irrespective of open / closed source issues, which OS were the better for development I would say Windows. In fact, if I'm faced with a bug in Mozilla, I'd rather fire up Windows and replicate the problem there than wade through the shit that GDB throws in my face.


    Die GDB! Linux really needs a decent debugger and all the mod cons that Windows developers have benefited from in the past decade.

    1. Re:GDB the millstone by EnglishTim · · Score: 2

      Amen to that!

      It'd be nice if kdevelop didn't rely on gdb - it often takes 3-4 seconds just to step to the next line fer frick's sake! And that's not even in a big program!

  149. Debuggers do more than debug! ("Ask the code") by Lumpish+Scholar · · Score: 3, Interesting

    Recently I was given some Java code and asked to port it to C++. At the time, my knowledge of Java was pretty much at the "Where is the bathroom, please?" level. In particular, I could see where the reflection package was being used, but not how the program went from one particular bit of client code to another. I loaded the code into the debugger, started the program, set a few breakpoints at the really puzzling parts, and ran through it a few times. At that point, the student achieved enlightenment.

    As I've gotten more skilled at software development, I've become better able to read a bunch of code and analyze it ... and become more likely to run the darned thing and see what it really does. Sometimes, in this job, inspection is theory, and debugging and testing are experimentation.

    An MIT animal physiologist is said to have told his students, "The animal is always right. When in doubt, ask the animal." Ask the code; the code is always right. (It may be right in knowing what the bug is, but sometimes that's what you need to ask.)

    P.S.: I've learned more Java since then. Running some programs through its debugger was one good way to help learn it.

    --
    Stupid job ads, weird spam, occasional insight at
  150. Re:Debuggers cause problems, and are IDE-dependent by cdf123 · · Score: 1

    Debuggers causing errors is a mojor problem that thankfully I havn't run into yet. Unfortunatly, I get the opposite, the debugger fixes the problem. First you set a break point and find your variable empty (confirming the problem), then you add a watch to the variable and find out that it never empties (confirming that it's going to be one of those days). The only way I've found to get around this is to create a dummy varaible and set it equal to the variable that seems to lose it's value. The down side to this is it looks like outragously poor code (and is), and reflects bad on the developer and the company. I'm terified of a coustomer looking through our code someday and having to explain it. What do you say to that? "Hehe, well... I was smokin sumthin goood man..."

    There's a reason the experienced coders use printfs and couts for debugging, they always work.

  151. Maybe they don't really need improvement-AI? by Anonymous Coward · · Score: 0

    "Debuggers are useful, but I see too many freshouts using them exclusively to fix code, rather than just looking at the code to analyze the design."

    What I would like to see is debuggers that fit better into the idea that software creation is a process.

    Look at all the rich information lying around, just being thrown away, or underutilized, all along the process, that could be fed further up/down the pipe that could make things easier.

    Imagine debuggers that have a better grasp on your code than you, because it peeked at the information in the planning phase.

    Imagine dcumentation tools that have access to all steps, and can pull it all together, and help during the debugging phase answering "what's the difference between what I meant, and what I am getting?"

    Imagine planning tools that can pull in outside information from the problem domain that your about to work on, and help in the integration/exclusion process.

    Imagine internationalization tools that can pinpoint problem areas when doing a cross-culture application, as well as help in the translation process.

    Imagine profilers that at least have a clue while looking further up the chain, and helping better during the "make it better" part. "What would you like to optimize today?"

    Note to all that we wish our "aids" to be all inclusive in helping us solve our problems, and will settle for tools that help us to be on time, under budget, and we all can go home on a "clock cycle".

  152. Turbo Pascal by irontiki · · Score: 1

    Turbo Pascal used to have a Step Backwards that was terribly handy. It was so nice to walk forwards and backwards through a tricky bit of code trying different scenarios. I've never seen it anywhere else. -DJ

  153. And if you don't have somebody around... by dubl-u · · Score: 5, Funny

    If you don't have another programmer handy, try the practice of Rubber Ducking.

    This is where when you are completely stuck, you take a little break. Then you come back, pull a rubber duck out of your drawer, and put it on your desk. Then you turn to it and say, "Rubber duck, here's my problem," and explain your troubles to it, just as you would to a fellow programmer.

    About two thirds of the time I try this, I stop half way through and say, "Aha! That's the problem!" And even if the solution doesn't occur to me, the process of explaining the problem makes me go over it in an orderly way, so that I always think of new places to look.

    1. Re:And if you don't have somebody around... by GigsVT · · Score: 1

      What if the fellow programmer walks in and catches you talking to a rubber duck? :)

      --
      I've had enough abrasive sigs. Kittens are cute and fuzzy.
    2. Re:And if you don't have somebody around... by pyrrho · · Score: 1

      In soviet russia Rubber Duck talks to YOU!

      sig related comment... that IS the topic... cause... I just said so!

      --

      -pyrrho

    3. Re:And if you don't have somebody around... by imnoteddy · · Score: 1
      Once a buddy of mine was working for a short time in an office close to where I was working. One morning I called him and suggested we have lunch. He said "No, I've got a bug, I have to work through lunch."

      The next day I called again to suggest we go out to lunch. He said he still hadn't fixed the bug, and couldn't go to lunch. I asked, "Did you fix the bug by working through lunch yesterday?" After a long silence, I asked when I should pick him up. He fixed the bug thirty minutes after he got back from lunch.

      --
      No electrons were harmed creating this post, though some may have been subjected to electrical and/or magnetic fields.
    4. Re:And if you don't have somebody around... by dubl-u · · Score: 5, Funny

      What if the fellow programmer walks in and catches you talking to a rubber duck? :)

      When you tell him how many problems little Ducky has solved, your main problem is that he will try to steal your duck.

      But if you're really worried about appearances, write Ducky an email about the problem. If by the end of the email you still are mystified, you can always send the email to a colleague.

    5. Re:And if you don't have somebody around... by Anonymous Coward · · Score: 0
      But if you're really worried about appearances, write Ducky an email about the problem. If by the end of the email you still are mystified, you can always send the email to a colleague.


      Just be sure to change the "Dear Rubber Ducky" at the beginning before sending it to someone else.

    6. Re:And if you don't have somebody around... by Elvis77 · · Score: 1

      This is an excellent technique... Often it will be be the right tool for the problem. Sometimes it will be a debugger (I like gdb myself) and sometimes it will be a fprintf(logfile,...), sometimes it will be a break, a coffee or checking out slashdot for half an hour. Hopefully however nice development techniques including writing test cases while you code and maybe even pair programming will help you to not get the problem in the first place. But if you get in trouble use any technique you can to sort it out. (I worked with a guy who used to throw his mouse at the monitor to releave the stress, each to their own...)

      --

      The man in black fled across the desert, and the gunslinger followed (SK)
    7. Re:And if you don't have somebody around... by Kymermosst · · Score: 2

      What if the fellow programmer walks in and catches you talking to a rubber duck? :)

      Better than if he walks in and catches you talking (or worse) to a rubber chick...

      --
      "Alcohol, Tobacco, Firearms, and Explosives" should be a convenience store, not a government agency.
    8. Re:And if you don't have somebody around... by clickety6 · · Score: 2

      But if you're really worried about appearances, write Ducky an email about the problem. If by the end of the email you still are mystified, you can always send the email to a colleague.

      Just be sure you remove the initial "Hello, Ducky" before sending it to a fellow employee!

      --
      ----------------------------------- My Other Sig Is Hilarious -----------------------------------
    9. Re:And if you don't have somebody around... by Bert+Peers · · Score: 2
      But if you're really worried about appearances, write Ducky an email about the problem. If by the end of the email you still are mystified, you can always send the email to a colleague.


      Or try the Magic Mailing List trick : describe the problem and send it to a mailing list for which it is appropriate. The mailing list software will then telepathically send you a fix so that 5 seconds after you hit Send, you already go "Oh shit, DUH, that's it" and you can try covering up your stupidity by replying to yourself and trying to make the one-line fix sound really complicated, "from an architectural point of view".

    10. Re:And if you don't have somebody around... by pne · · Score: 2

      I agree. Though here at work we usually do it with live ducks, and we call them "dogs" (I guess after the way some people talk to their dog).

      So I might ask some co-worker to "come over and play dog" and while I'm explaining the problem to them, often I go "and then I ... um, never mind, I think I found it. Thanks!".

      I guess it's the fact that you order things in your head in order to be able to explain them that helps you fix the problem by yourself.

      --
      Esli epei etot cumprenan, shris soa Sfaha.
  154. what about non-iteractive debugging ? by sir_cello · · Score: 2, Interesting

    Most of this discussion seems to be about interactive debugging tools, but as an individual concerned with mission critical telecommunications software where an outage can take out customer private networks, I tend to find less need for interactive debugging, and greater need for post-mortem diagnostic analysis that results from the following:
    - faults generated in house system / integration testing
    - faults generated in house automated unit / component testing
    - faults generated in house automated system / scalability / performance testing

    I need to isolate sometimes highly obscure run-time failures and discover what went wrong, then resolve the issue, which I do with:
    - high levels of run-time instrumentation using (a) method / object / runtime c++ trace style classes, (b) trace back mechanisms for exception handling and, (c) assertion handling and (d) run-time verification mechanisms; all of which generate output to debug logs (sometimes when returned to support, these logs are multi-gigabyte in size, fortunately our development workstations are very high spec)
    - post-mortem analysis scripts to interpret the contents of debug logs and look for faults, inconsistencies and other issues
    - application level mechanisms to allow testing, deployment and other experts to enable run-time debug instrumentation (if it were enabled all the time, it would constitute considerable performance loss) sometimes at the direction of developers or deployment / field support personnel, and sometimes these personnel don't have access to machines where the components are installed (because the components are distributed CORBA components, and these personnel have access to host / user interfaces, but not to components in a silo in another country)

    The problem is that we've had to design all of this from scratch: (a) general purpose c++ based debugging / tracing modules with command line / run time configuration options, (b) tools to stimulate the debugging facilities to do things [set / change debug trace levels / activation tags / identifiers], (c) tools to capture / wrap up and return trace logs back to support, including capturing host information (processes, memory, installed modules, environment, configuration) and other debugging items (debug stack traces, core dumps) and version information (component version, etc), (d) tools to analyse / work with / process logs for developers, (e) work instructions / process / documentation to educate developers, deployment experts and others about the use of these facilities, (f) make sure that there's a balance between getting the right level of detail, yet avoiding gigabytes of detailed code / method level information

    Typically, once I have a debug log returned to me (as I am developer), I need to look at what was going on, and try to reproduce the fault with a unit test case, then inspect the component for faults of a similar type, and correct those with appropriate unit tests as well, then verify regression test for the component, make changes to multiple development branches, and wait for the scheduling of scalability / system / automated testing to ensure no other significant side effects, then safely know that the next release will have corrections.

    We shouldn't have had to develop all of this in house: there should be standards for this. Other companies that I have worked with have the same adhoc construction of debugging facilities - for these situations were you need to analysis a running system, or obtain post-mortem results.

    Interative debugging dwindles in comparison: unless you are working with obscure hardware, or related sorts of embedded systems, I think that an excessive need to use interative debugging says more about the lack of design / defensive coding / other engineering approaches to reliability of the constructed software. Interative debugging consumes about 10% of my debugging efforts (not including time spend on unit / component / system test design).

  155. Ability to display complex variables by Anonymous Coward · · Score: 0

    What I'd like is the ability to display complex structures, such as GWorlds, HBITMAPs, etc. I do a lot of image processing, and just being able to look at the image I'm processing can instantly tell me I've got an off by one error. But trying to figure it out in code is not always so simple.

    The other thing is to come up with a debugger that doesn't have any side effects with the rest of the OS. Unfortunately, that's probably not possible given what debugging is. But I can't tell you how many times a bug is hidden by or caused by the debugger. That's annoying!

  156. Which is what multiple monitors are for by Anonymous Coward · · Score: 0

    At every job I've had in the last 3 years I've insisted on 2, preferably three monitors.

    Monitor 1 always has the code open.

    Monitor 2 has the Web browser for the CGI ( which is what I write ).

    Monitor 3 has the interactive debugger running.

    If you can't justify 3 monitors, you combine 2 and 3 on one monitor.

    1. Re:Which is what multiple monitors are for by snatchitup · · Score: 2

      I've got 1 and 3 in one window. The latest technology I use, I re-build while the server is running. Sometimes it's a little slow.

      But I'd like something more like the debugger in multiple windows.

      1. Call Stack
      2. Variables ( but this needs to be much better for objects.
      3. Line of code that I'm actually on.

  157. Re:Fix the programmer, not the program-SR-71 by Anonymous Coward · · Score: 0

    " the best way to build a skyscraper is not to use CAD programs at all, but a slide rule and pen'n'paper, which force you to think about what you're doing instead of making mistakes and 'correcting them later'."

    Skunkworks

  158. Slashdot VB attitude = MS Haters + academic types by bADlOGIN · · Score: 1
    I'd say the Slashdot VB attitude is built on opion and/or fact. Here's my $0.05 USD (inflation, you know):


    Opionion(MS Haters): Anti-MS sentiment and general eliteism feed the notion that MS produces mostly crap and VB is the biggest pile of it. Also, simply looking at the easy learning curve and the general "point 'n drool" nature of it makes it inferior. It propells the notion that "any idiot" and create software and that with VB in hand, most "idiots" do.


    Fact (academic types): A little bit of exposure to origonal BASIC shows VB to be a sick mess on technical merits (or lack thereof). VB changed indexing (e.g. origional BASIC String functions are 1 indexed, newer MS VB fuctions are indexed from 0) and enables bad programming practices (global variables, defined GOTO for cryin' out loud). Those you may be able to forgive, but then there's what the die-hards point out: there is no Backus-Naur Form Grammar for the language, and no alternate definition for one to build an interpreter themselves. This speaks somewhat poorly of the language and it's "ilities" (portability, maintainability, etc.). It locks it into the "silly vendor tool" category and most self-respecing academic types refuse to touch it.

    --
    *** Sigs are a stupid waste of bandwidth.
  159. Must be nice by Tintin · · Score: 2, Interesting

    It must be nice to be one of you folks who work on one of those projects where you can just use your brain to understand all the relationships among data structures and various pieces of code or where you can make sure that you only ever work on code where you can be sure that it's structured cleanly with nice small functions that can be tested individually.

    Out here on the wild frontier we're stuck working on code that was written many many years ago by people who weren't quite so clever as the average slashdot poster. These people left behind badly structured code with inelegant data structures and comments that don't accurately describe how the code works. This code consists of several tens of thousands of lines in the component I'm directly involved with and several hundreds of thousands of lines in the larger project.

    So while it sure would be swell if all the functions were small, the data structures elegant, the code tidy, and the comments accurate, that's just not the way it is for many of us.

    And it pains me to say, but much of the debugging we do is done using printf() because most debuggers are such unredeemable sacks of $#!].

    I do much of my debugging using msdev from VC++ v6, and I find it to be even less useful than the CodeView debugger that I used in 1987. There's a few things that are better but there are a lot of things that are worse. How can I get msdev v6 to show some of my variables in hex and some in decimal? Is this such an esoteric request that the developers at MS couldn't be expected to anticipate it?

    The number of things that the MS debugger can't do that I could do in 1992 using IBM's VisualAge C++ debugger is even longer. Is this progress?

    1. Re:Must be nice by iangoldby · · Score: 2

      How can I get msdev v6 to show some of my variables in hex and some in decimal? Is this such an esoteric request that the developers at MS couldn't be expected to anticipate it?

      No, it's not too much to ask at all.

      I think this is what you want. E.g. to display a value as a short hex integer in the watch window:

      myVal,hx

    2. Re:Must be nice by poitypoity · · Score: 1

      hello tintin I found your post on slashdot interesting. Would you care to quickly elaborate on exactly what you valued about Visual Age C++? I am not familiar with the tool. Thanks, Charles

  160. What do we have NOW? by eli173 · · Score: 1

    Ok, I've found that sometimes I discover an age-old program that I wish I'd known about for years.

    In the hopes of finding another, what are the best debugging tools we have NOW?

  161. NuMega by Eisenfaust · · Score: 1

    I find that NuMega (Compuware)'s suite of debugging tools to be much better than anything else that I have used. BoundsChecker especially is an extremely useful tool for find bugs in C/C++ code.

    With a traditional debugger finding memory leaks, overflows, and other errors that may not show symptoms imidately can be a lot of work.

    I think that it is asinine to believe that such tools haven't improved the debugging process in the last 30 years.

    --
    Grrrrr... don't bother me, I'm thinking.
  162. The best way to debug... by bobalu · · Score: 1

    is to not ENBUG.

    --
    The revolution will NOT be televised.
  163. Log4j by Petronius · · Score: 2

    Log4J is my debugger. 'cuz my webserver has no stinking GUI!

    --
    there's no place like ~
  164. 2 Thoughts by taradfong · · Score: 1

    1) I loved how Java has compile-time enforcement of exception handling. That is, if some code you called threw an exception, you HAD to handle it or else it wouldn't compile. This drastically reduced debugging needs. This idea should be greatly expanded upon!

    2) I would use debuggers more, but often I find that getting a project prepped for debugging takes far too long. It gets too hard to configure the debugger to handle hoards of files, libraries and other things. Or when developing games, you're in full screen mode, and the last thing you want to be doing is popping back and forth to windowed mode.

    I agree that we need a new paradigm which gives programmers control but without the heavy GUI.

    --
    Does it hurt to hear them lying? Was this the only world you had?
  165. Savestates. by RyanFenton · · Score: 3, Interesting


    If you've ever followed the popular system computer simulators known as emulators, you've likely seen savestates. It's effectively saving all the variables of a system en bulk, to be leaded back again later so another approach might be taken. They have been very useful to emulator developers who often need to return to an exact point where a virtual machine breaks down, without having to re-run to a certain point.

    It would be nice if debuggers could automate the process of saving the state of functions (and everything they immediately touch), so you could go "back in time" rather than need to restart a program in order to return to a non-bugged state. On small programs, it would also be very convenient to be able to save the state of the entire program.

    Possible extentions of this idea would be a breakpoint-like auto-savestate at a certain line, and a "step back" feature to be able to rollback one line.

    Of course, there would be many possible complications involved in using savestates - but I believe the potential dangers are far outweighed by the opportunities for quicker and more comprehensive testing and code-observation.

    Ryan Fenton

  166. Using debuggers is a habit... by Shant3030 · · Score: 1

    I find that people who use debuggers rely on them like a habit. A co-worker of mine would be lost without Totalview. For him, developing and testing software would not be complete without a debugger handy.

    For me, I have given up using a debugger because its annoying to run and to use correctly. I used to use gdb through Emacs and the process became so time consuming. Now, I use a process of commenting and outputing. If the code is written correctly (appropriate return values, funciton usage, etc.), this can prove to be sufficient.

    Both methods are laborious and time consuming, but are a matter of preference and what you are used to. Software development was never meant to be quick and easy...

    --
    100% Insightful
  167. Being able to trace data dependence by femto · · Score: 1
    I would like the debugger to be able to tell me the way in which variables depend on each other, ideally with a quantitative measure of sensitivity.

    For example, if a variable has a wrong value, being able to click on it and the debugger tells me all the variable on which the incorrect value depends. I can then trace back and inspect the values of the contributing variables. Once all the contributing variables have the right values, I know a problem is 'downstream' of that point.

    It would also be nice to be able to go the other way. Click on a variable and the debugger tells you which variables depend on that variable.

  168. "Omniscient Debugging?" by Anonymous Coward · · Score: 0

    http://www.lambdacs.com/debugger/debugger.html

    This guy gave a presentation on "Omniscient Debugging". Apparently the tool can state changes in program state (including those of multiple threads), starting and terminating at a specified times, so you can basically go forward and backwards across an event and analyze it. It seemed pretty nifty to be able to be able to "rewind" a bug event at will.

  169. Full C++ support for gdb by Anonymous Coward · · Score: 0

    would be a good start -- including namespaces.

    If you don't believe me, try a simple application with namespaces and you'll see a problem. Also, I've had numerous problems with gdb giving errors about "cant find some C++ RTI symbol" or some error like that, don't remember the exact error since I'm not at that computer atm.

    For C, gdb is great, but C++ definetly needs some work and looking on the gdb lists will show you that I'm correct.

  170. Not that Magical by DoseKapital · · Score: 1

    I can understand where you're coming from if you're talking about debugging non-VM and non-interpretive code. Even then, a lot of newer debuggers use methods which could handle most of these issues. 2) Where would this stack of previous values go? What if it's the control for a loop? A buffer variable that updates every second? Your compiler could compile in code save values as they are being changed, in an array of stacks somewhere. You could probably limit the stacks to only the last 10 values. 3) Same point, just makes the stack bigger. Should it cross reference all variables so you can see what that all were at that point? Pretty much... 6) So the debugger should be able to wrestle a process away from the processor without previously having linked into it, and then map memory locations to variables and procedures? That would be impressive. Impressive if your code was compiled to machine code. If it's been compile to bytecode and being JITed, then it shouldn't be so hard. The future is going towards JITing.

    1. Re:Not that Magical by Zelatrix · · Score: 1
      6) So the debugger should be able to wrestle a process away from the processor without previously having linked into it, and then map memory locations to variables and procedures? That would be impressive.

      Impressive if your code was compiled to machine code.


      GDB manages this without a problem (look up "attach to running process" in the help).

    2. Re:Not that Magical by DoseKapital · · Score: 1

      That's right. It does...

  171. Superdebuggers by jimfrost · · Score: 5, Interesting
    Well, it just so happens that there have been a few debuggers much more functional than the likes of Visual Studio.

    I used to work for a company called Saber, who later changed their name to Centerline. We produced a product called Saber-C (and later Saber-C++, and the products were renamed CodeCenter and ObjectCenter).

    This product was a C/C++ superdebugger. It started out as a C interpreter developed at Harvard. Now, an interpretive environment allowed a lot of neat features: You could tell whether or not variables had been initialized at reference time, you had complete stack and context information, it was pretty easy to unload and reload code in source modules (dynamic reloading). You also got dynamic type checking, which caught errors in downcasting (for instance). And everyone's favorite, array bounds checking.

    With this tool debugging C code often meant: Loading the code, running your test case, and seeing where the debugger complained. The first time you ran your code through it was a humbling experience ... almost all production code has serious (but normally benign) errors.

    Unfortunately the tool didn't scale well because it took time to load the interpreted code into the debugger and the heap and runtime requirements of interpreters stressed machines of the time (this was when Sun3s were common, and 3/50s couldn't even have more than 4MB memory).

    I think it was 1990 when we released version 3, whose big new feature was object code debugging (it's not really that easy to have object code debugging as well as interpretive code, although we could certainly have implemented it more easily than we did). We of course maintained the ability to dynamically reload code fragments, so you could do a "make", reload the affected modules, and be on your way in a few seconds. This sure beat the several minute wait you normally had with the linker and debugger restart. But what you lost was some of the runtime checks -- including most of what made the product interesting. Still, the ability to have superdebugger capabilities on some code and still scale to large programs was very valuable.

    About a year, maybe two years later we got visited by the people who eventually started Purify. They had a neat approach where they'd get most of the benefit of our tool, but in object code, by disassembling the object code, adding extra code to perform checks, and putting it back together. This would give about 80% of the functionality of our debugger but with much lower runtime costs and work even if you didn't have source code.

    We ended up re-implementing this functionality such that we had a Purify competitor (and getting sued, and losing, even though Sun later patented the same technique we used).[1] Integrating it into the debugger allowed you to fine-tune the debugging capability you wanted on a module-by-module basis. This was a superb tool.

    Now, what are the raw capabilities that made this stuff really neat?

    1. Incremental reload of modules. That removes the debugger restart cost (symbol loading is a huge time sink).
    2. Supply worst-case scenarios for code. In our tool, we'd initialize heap and stack memory to 0xbfbfbfbf patterns, which tended to trigger bugs in code that had intitialization errors.
    3. Track heap allocations. Knowing who allocated something is remarkably valuable, particularly for tracking down memory leaks.
    4. Augment the code with error checks that are sensible for the source language. For instance, we knew the type that was assigned to memory so we used that to detect all manner of type mismatches.
    5. Augment the code with bounds checking for arrays. The bounds checkers worked with the heap system, which of course tracked the size of all allocations. This caught a lot of off-by-one errors.

    The tool also provided two additional interesting features. One was called "action points". Since we had a C interpreter in the product it was no big deal to allow you to type C code into it and run it at arbitrary times. We'd allow you to attach any code you wanted to any line in the program or to just type code at the debug prompt and it would run in the current scope. This was useful for things like adding print statements without recompiling, for instance, and for adding assertions, and many other things.

    The other feature was a graphical heap inspector. All this did was display structures as tables of their internal values and allow traversal of references to other structures, which would be displayed (including links between the structures). This made the shape of data a LOT easier to determine.

    Several people talked about adding reverse execution. That was actually done for Java by a tools company back in 1996 (maybe 1997). It didn't always work, but it was pretty neat. The problem is that the recording code was pretty expensive and there's a limit to people's patience and what they'll spend on hardware (although I grant that hardware is a lot less of an issue today than it was even in 1997, to say nothing of 1989). Anyway this feature is a lot less interesting if your debugger can find errors at the point they occur.

    Anyway, back in 1995 when I started to work with Visual-C++ on a regular basis I was appalled by what Microsoft was calling a "state of the art" debugger. Feh! It was 1985 technology with a pretty face. It really has not improved much since then either, although they do at least have a pessimistic heap allocator now. With their ability to hook in with the compiler they could do a phenomenal job with heap allocation tracking and instrumentation of code with error checks but they don't bother (because, I suppose, they make their money even without it).

    Now, using a language with runtime error checking built in - such as Java, C#, or Visual Basic, seriously undermines the amount of effort you have to put into the debugger. Still, I'd like to see a lot better heap debugging features built into compilers and runtime environments.

    Hope this gives people some ideas, and that they lead to tools I can use.

    [1] One thing that could be done to avoid the Purify patents would be to have the compiler emit the instrumentation. For the OSS world, where you always have the source code, that is eminently practical. Furthermore you can get all the benefits of an interpreter but at higher performance. A big problem with Purify's technology, and the technology we came up with, was that you're doing a lot of heuristics during code inspection. It's easy to miss code or misinterpret code, and of course the code inspector is VERY architecture and compiler dependent. What I would like to see is a gcc/glibc/gdb combination where the compiler, libraries, and debugger all worked together. That wasn't possible back when the vendor controlled the compiler and you didn't have access to library source. Today it is, at least for the OSS world.

    --
    jim frost
    jimf@frostbytes.com
    1. Re:Superdebuggers by schnell29 · · Score: 1

      wow that brought back memories. I used to use that debugger all the time, and what a hassle it was to get 15+ libs all loaded/aligned, but gosh, when I did all that, it was great.
      we had a project that did a lot of c++ before c++ was popular ( lots of pointers to structures and functions and the structures would contain pointers to more structures and functions, a pretty dynamic system it was) and that debugger was a god send.. it really help to print out our complex data structures ( just call one of our print routines in the debugger.. )

    2. Re:Superdebuggers by ArmorFiend · · Score: 1

      Dear Jim,
      Alot of what your product does really reminds me of Lisp. In most LISPs, you can run your code either interpreted or compiled. Furthermore you can vary the compilation flags to individual functions on a case by case basis by editing the lisp source.

      Often when I got a lisp equivalent of a seg fault (signal eleven at so-and-so location on the stack), I'd just recompile (with the compiler safties on) the topmost function on the stack and restart it. Usually that'd find the problem immediately.

    3. Re:Superdebuggers by jimfrost · · Score: 2
      Alot of what your product does really reminds me of Lisp

      When I interviewed one of my comments was, "Hey, that's like a Lisp environment for C!" I had been building a lisp-based shell at the time so that was really cool :-).

      --
      jim frost
      jimf@frostbytes.com
    4. Re:Superdebuggers by lordmage · · Score: 1

      I use parasoft's Insure++ product. This is a current "Super Memory Debugger" and has a lot of seriously nice features. I did a study and found that Insure++ did find more errors than Purify and since Insure++ was crossplatform to Linux, I was able to convince my company to switch.

      Have not regretted it.

      So.. is this Saber-C stuff Open Source/Free yet?

      --
      I can program myself out of a Hello World Contest!!
    5. Re:Superdebuggers by jimfrost · · Score: 2
      I haven't seen Parasoft's stuff in years, but it was good when I last looked. Nice that it runs on Linux.

      So.. is this Saber-C stuff Open Source/Free yet?

      Nope, but it doesn't matter because it needed a rewrite anyway. Were I to do it today I'd move the instrumentation code into gcc, augment glib, and add some hooks to gdb to allow programmatic control (ie allow the inferior to ask the debugger to do things like stop). That would all be easier than most of our ports of Saber-C to new platforms, and would end up being largely platform independent.

      Getting module swapping/incremental loading to work is a royal pain. Valuable, for sure, but maybe not worth the development agony. It's a lot less of an issue with demand loaded languages like C# and Java anyway.

      --
      jim frost
      jimf@frostbytes.com
  172. class/struct access tracking by captaineo · · Score: 2

    This is more of an IDE thing than a debugger thing, but I'd really like to have an automated way of finding all the call sites that access a particular class or struct member.

    e.g. if I have
    struct foo { int count; ... };

    I want to see all lines of code that access the 'count' member of struct foo. (WITHOUT showing all other occurrences of the string 'count' like a simple grep would).

    Bonus points if the feature can track pointer aliasing - e.g. in the example above, *((int*)&foo) should also count as a hit... Or if I have an array 'int arr[]' and I want to see all access to arr[3], including *(arr+3) and arr[i] where i could equal 3.

    1. Re:class/struct access tracking by Ivan+the+Terrible · · Score: 1

      You can do this with AspectJ.

    2. Re:class/struct access tracking by MikeBabcock · · Score: 2

      I hate to say it, but Visual C++ will do this. Not quite intuitively, but it does do it.

      --
      - Michael T. Babcock (Yes, I blog)
  173. Turbo Debugger by xbytor · · Score: 1

    One of Borland's more excellent products...
    It did have backstepping, but there are limits to what you can backstep over. If you do any IO (filesystem, ports, etc...) backstepping really doesn't make a whole lot of sense. For pure computation, however, it rocked.
    With an app that is multi-threaded, the semantics of backstepping might get a bit dicey. Might be a nice PHD research area, though.
    -xbytor

  174. Delphis weak points by SnapperHead · · Score: 2

    I mainly use PHP for my development, but when it comes to client side applications I use Delphi / Kylix. For your basic simple things, it works quite well and has some nice debugging and error reporting. However, when doing things like database working using the BDE, its a nightmare. Most of the time the errors don't point to anything to help debug it. The errors are sometimes so general, it could mean someone forgot to put the toliet seat down.

    I have found that many developers (of the debuggers or IDEs) don't spend enough time creating error messages for all sorts of common problems.

    They have gotten 10 times better in recent years. I personally *hate* most C / C++ IDEs becuase the application just segfaults, or what not instead of saying what the hell happened. I am a poor C / C++ programmer, so it doesn't help me move any futher into it.

    --
    until (succeed) try { again(); }
  175. Automatic debugging/testing by bored · · Score: 2

    To a certain extent programs like purify and bounds checker do automatic program debugging. BC will check for all kinds of runtime errors. Coupled with tight coding standards enforced by a lint like tool of your choosing a _LOT_ of bugs will be easily isolated automatically. When you combine these tools with a code coverage utility, a decent set of unit tests, a test utilty that can fail system and library calls you will discover a the bug count in released code will go down to nearly 0. Finding these bugs in developement is a lot easier that trying to do it with a core dump from the customers site. Take it from me I've worked for companies that released software where bugs that cause crashes, lost data etc were simply not acceptable.


    People complaining about the debuggers themselves missing functionality are complaining because their code is either to poor to isolate the bug when it happens (causing it to propigate into areas where the bugs arn't ovious), or they simply arn't using all the tools avialable to them. Don't underestimate how useful enforced coding guidelines can be for writing bugfree code. There are whole classes of bugs that can be caught by a lint, but will result in hours of debugging. Variables that never get initialized are the perfect example.

  176. Debugging Tools by d23 · · Score: 1

    I used to use a debugger to walk through my code as a sanity check that it was doing what I expected.

    Recently I've been in an environment where the IDE was not integrated with the app server, so dubgging meant creating log infomation.

    With server side programming and as systems become more complex, debugging on a single thread level is not important and in some ways irrelevent.
    To find a problem I've had to grep through huge amounts of logging information.
    Maybe that's where some tools development should be headed, to searching and organizing logging output.

  177. My wish by Anonymous Coward · · Score: 1, Insightful

    is for a debugger that can do a good job in simulating multithreaded operation. If a debugger could:

    1. Break all threads in one or more processes
    2. Simulate timeslice execution of all threads as the user steps through

    That would be very good. Many of you probably noticed that debuggers don't do a very good job of this, and sometimes threads can either behave too well or too poorly.

    Another nice feature would be the ability to have complete control over what threads to starve and what threads to execute. This would make testing of critical section code much easier by giving us the ability to simulate worst case scenarios in matters of concurrency.

    Finally, I'd like to have more extensible debuggers so I can create my own variable watch plugins that depict things more graphically than a simple watch list.

  178. Eh? by Theatetus · · Score: 2
    x^2=y, then y^1/2 = x. its a square-root!

    Hate to break it to you, but if y^1/2 is implemented as a true function with a single return value, it is not the reverse of x^2.

    Say you have y = 9. Was the x that was squared to produce that 3, or was it -3?

    Similarly with sin. You know that y received the value of 0 after assignment from sin(x). But was x 0, pi, 2*pi, 3*pi, etc.?

    That's just the theoretical problem; there's a bigger practical one involving floating point values. When an operation or cast causes precision loss there's no way to get that precision back. Let's say y is a float and you shift it to the right by 3 bits. Those 3 LSbs are gone forever, and there's no operation that can reverse that unless you log the value of every variable that undergoes an irreversible change.

    --
    All's true that is mistrusted
  179. Modify/Add code in real-time by Bazouel · · Score: 1

    Something VB6 has done for years is that you can modify, add or remove code at will while executing the apps.

    This was really great to test code without restarting the whole thing. I have yet to see that in another debugger.

    Sad thing is, VB.Net doesn't this feature anymore.

    --
    Intelligence shared is intelligence squared.
  180. I agree with Brian W. Kernigan by ry4an · · Score: 4, Interesting
    In The Practice of Programming Brian W. Kernigan and rob pike said:


    As personal choice, we tend not to use debuggers beyond getting a
    stack trace or the value of a variable or two. One reason is that it
    is easy to get lost in details of complicated data structures and
    control flow; we find stepping through a program less productive
    than thinking harder and adding output statements and self-checking
    code at critical places. Clicking over statements takes longer than
    scanning the output of judiciously-placed displays. It takes less
    time to decide where to put print statements than to single-step to
    the critical section of code, even assuming we know where that
    is. More important, debugging statements stay with the program;
    debugging sessions are transient.
    1. Re:I agree with Brian W. Kernigan by Anonymous Coward · · Score: 0
      As personal choice, we tend not to use debuggers ...One reason is that it is easy to get lost in details of complicated data structures and control flow;

      But a good debugger displays complicated structures in the same way you visualize them. A debugger that gets you lost is a stupid debugger designed by software geeks with no knowledge of psychology.

      we find stepping through a program less productive than thinking harder and adding output statements and self-checking code at critical places.

      Yeah yeah, sure, "think harder". Add more output statements. "Self-check". Heck, why not revert back to "self-commenting" C code with embedded assembler?

      It takes less time to decide where to put print statements than to single-step to the critical section of code, even assuming we know where that is.

      A good argument about how to develop better debuggers, but I've wasted too much time writing print statements and re-running code..

      More important, debugging statements stay with the program; debugging sessions are transient.

      Huh? I can run a debugging session repeatedly and watch the code execute. When is this quote from, 1994?

  181. Another Java debugger that can step backwards! by Anonymous Coward · · Score: 0

    http://www.lambdacs.com/debugger/debugger.html

  182. Re:Debuggers:The red-headed step child of developm by HeyLaughingBoy · · Score: 1

    An interesting contrast to this is in embedded development. I can't think of a single embedded designer who doesn't consider tools, esp. debugging tools, when choosing a processor for a project. No, they're not sexy, but they can make or break a project.

  183. Time travel debugging by basiles · · Score: 1

    The Ocaml debugger (see the Caml site) has the ability to travel back in time.

    Also, type inference of the Ocaml language find a lot of bugs at compile time.

    I believe that higher level programming languages will lower the need of debuggers.

    At last, as other comments show, many programs (e.g. servers, CGIs, ....) are difficult to debug with a debugger.

  184. You sound very condescending by DoseKapital · · Score: 1

    I don't know about you, but lumping the rest of us who use debugger in with the heap of "cherry picking" amateurs, sounds REALLY arrogant.

    Firstly, I'm like you, in that usually I know where my problems are, and I don't need to do a step-by-step trace to find my problems. BUT sometimes I do, because sometimes we ALL overlook something. Secondly, I work with a lot of other people's code. I don't have the luxury knowing exactly what's going on in the code, and debuggers help me fix other people's bugs a lot faster than speculating.

    I'm just sick of these one-size-fits all opinions. Just because some people use these features as a crutch, doesn't mean the rest of us having found real value. More features do not cause undiciplined programmers. They were undiciplined before the features got to them. There will always be undiciplined programmers.

    You're not going to change them by taking away thier features.

    NOTE: The bold is used to highlight points, it's not for yelling.

    1. Re:You sound very condescending by FortKnox · · Score: 2

      I wasn't lumping the cherry pickers with the debugger users.

      In fact, I was trying to make the point that using a debugger is good (hell, I use one!), just that you need the basic functionality that bebuggers have today without any extra bells and whistles. The submitter asks "what ELSE do you want?" My response is "nothing, we're at a good equilibrim point of debugging features now. Adding more will take away from the fact of understanding the code, and will become more dependent on solely using the debugger."

      --
      Good quote, too many chars. Seriously, the slashdot 120 char limit sucks!
  185. Here's the product you asked for... by Anonymous Coward · · Score: 0

    http://www.ocsystems.com/rootcause_white_paper.htm l

    It does everything you asked for except reverse-execution but since it lets you re-execute what happened right before the problem it accomplishes the goal you wanted.

  186. what about us firmware engineers?!? by icis_machine · · Score: 1

    things have changed drastically for us in the last decade or so. we have ICEs and hardward debuggers with many times limited functionality, so we still end up using scopes, logic analyzers, and utilizing the free IO ports wiht the help of some LEDs.

    however when we are lucky we get decent debug symbols and more than one breakpoint to use (darn ROM debugging). i would have to say you guys working on the upper layers have it easy. i would kill to be able to see the amount of information you guys have for board bring up.

    --
    icis machine
  187. Assistance at Proving Correctness by Preston+Pfarner · · Score: 1

    A well-known need in academia: proven correctness.

    1. Tools to automate much of the work of proving correctness of program fragments
      If the precondition is satisfied, the code fragment is guaranteed to result in a state that satisfies the postcondition.
    2. Tools to automate composition of proven fragments, to prove larger components
      if Apre is taken to Apost by A, Bpre to Bpost by B, and Bpre is implied by Apost, then AB takes Apre to Bpost.
    3. Tools to generate examples of failure states
      When a proof of correctness for a code fragment fails, some set of initial states will not be guaranteed to work. By examining that subset of initial states which aren't guaranteed to work, one can generate test cases and determine whether the prover needs more axioms or else that the program is actually incorrect.

    Proving correctness is often difficult, but this is largely due to the grunt work involved (which is another source for human error). One needs good tools to minimize the human effort.

    Sure, your program-proving system has to be correct itself, or else you get nasty bugs, but that same situation doesn't keep us from using compilers. And this doesn't eliminate all correctness problems, as specifications virtually never come with enough detail to support this process without programmer effort, but it would certainly be useful to have better code-proving systems.

    And if anyone knows of available systems that actually provide these tools, by all means let us know!

  188. x86 disassemblers by blincoln · · Score: 2

    I would kick someone in the knees for an x86/Win32 disassembler that's as intuitive and easy to use as PS2Dis is for Playstation 2 MIPS code.

    I'd been using that one for awhile (finding hidden bits in games I like), and I decided to check out the same kind of software for x86 disassembly. I felt like I was back in 1992 using DOS tools. Essentially all of the interfaces seem to be text-only, and there's none of the "click on an address and modify the code" functionality of PS2Dis, or the ease of navigation.

    Since I'm only doing this for fun, it's just an irritation, but I imagine it would be very frustrating for a full developer.

    --
    "...always new atoms but always doing the same dance, remembering what the dance was yesterday." -Richard Feynman
  189. Teach people to use them by PhotoGuy · · Score: 2

    I think the biggest advance in debugging would be teaching people to use them.

    I know a lot of programmers, but I think I'm the only one I know that actually uses a debugger to find problems. I haven't personally seen any University courses on debugging techniques or tools.

    I think it's an essential skill (like typing) that makes programmers *so* much more productive.

    -me

    --
    Love many, trust a few, do harm to none.
  190. *shrug* Suggestions: by Object01 · · Score: 1

    1) A facility for examining variables used as bitflags. MSVC++ will let me see a variable in every way except binary. I'm not geeky enough to know what bits are set by looking at a hex or octal value. Not yet, anyway.

    2) The ability to backtrack the flow of execution. Not just see a call stack, but actually move backwards and repeat certain steps to see over and over again how they affect state.

    3) Better GUI debugging all around. The mechanism by which windows or dialogs update is designed to be fast, sure, but it often prevents the developer from seeing how the GUI changes or responds over time. GUI developers need a GUI debugger. "Magic Lenses" are a good step in this direction.

    4) Better fault/bug prediction. If people can diagnose future problems by examining the code, the computer should be able to, too.

    5) Statistical analysis detailing which bugs a developer (a student, in particular) cause/encounter most often.

    6) More debuggers that suggest solutions to problems.

    7) More general breakpoint descriptions. I'd like to be able to tell the debugger to break whenever any variable in the system equals a certain value.

  191. ...there have been some small innovations by tornadron · · Score: 1

    in context to enterprise/web development its common to develop in several languages (usually at each of the different tiers e.g. HTML/Javascript on client, Java/C++/etc on Business tier, some flavour of SQL as a backend).

    In some cases it is useful to be able to debug across tiers...e.g. interatively debug starting from scripting in the client, when a call to the server is made, trace the call to the component in the middle tier, debug there, and then further trace into DB stored procs if needed.

    Visual Studio has had these sorts of features for a while--granted they are often a bitch to setup (and as a result somewhat less than trustworthy)...but when you do have it configured correctly it works quite well and has saved me a lot of time (now if they could address the "bitch to setup" part)

    I'm a bit MS centric in my dev experience but some that I like are:

    Edit and Continue in VB:
    find a small stupid error while debugging? fix it right away and continue...this can generally only be done with very simple errors (e.g. change a value assignment to a variable)...but it saves the time of stopping and restarting a debug session to fix a dumb error preventing you from continuing.

    they implemented this in VC6 as well..don't know how well it worked, because its the sort of thing that only works well if it is unobtrusive--sort of like code complete drop downs...great in VB (cause its lightening fast), pain in the ass in VC++ (and many other IDEs--cause it slows your whole machine down and just gets in the way).

    some ideas that I think'd be useful but have never encountered:

    Simple refactoring while debugging (e.g. find a badly named variable while debugging?, rename it on the spot (and have all other reference renamed) and continue debugging...imagine in some languages this'd be quite difficult to implement but in an interpreted scripting language probably doable)

    Mark a function/module/library/component as "black box" so that the debugger knows NOT to step into any code in that portion of code. This would speed up pinpointing of errors where you have code linked to 3rd party libraries (e.g. writing C++ code and then ending up in nasty MFC code)...the errors could be in those libraries...but if you're pretty sure its your own code (cause its just your first cut on it) then this could save some time....you should of course be able to mark it "white box" just as easily--having this feature sort of extends the idea of "information hiding" to debugging by giving the dev the ability to focus on the specific area he/she is interested in

    --this sort of feature could be expecially useful in code walkthrough exercises where you want to focus the code walkthrough on only specific parts of the code and ignore previously examined code/3rd party code you're not interested in.

    that's my 2c

    that's my 2c.

  192. unit testing by Anonymous Coward · · Score: 0

    With a suite of unit tests, I rarely have to invoke the debugger. If you need pen and paper to hunt down the problem, you probably are missing unit tests at the appropriate boundaries. They keep the problem small enough that you can tackle it with regular debuggers.

  193. What is a debugger anyway? by Pseudonym · · Score: 2

    Most of the responses are missing the point, I think. Step outside the box for a moment...

    When you write software, you have an intended interpretation, namely, what you intend the program to do based on what you meant to write. The compiler, on the other hand, has its own interpretation of your program, based on what you actually wrote. Debugging is the process of finding discrepancies between those two interpretations.

    Understanding this reveals what directions debugging tools should go. Current tools put the programmer in the driving seat, trying to understand how the system has interpreted their program. The next generation will put the system in the driving seat, asking the programmer what they meant that operation should do. Like with a human teddy bear, the act of explaining it to the system might even clarify things enough in the programmer's mind that the problem may become obvious. Or, we may end up in a kind of "pair debugging" situation where the system becomes a code reviewer.

    --
    sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
    1. Re:What is a debugger anyway? by MikeBabcock · · Score: 2

      I want the ability, along these lines, to not show my debugging code and testing code while looking at my code, then have it display again while writing debugging code.

      Programs should do their own code audits which should simply be disabled in proper builds. These audits should not ever modify internal variables or state though; that causes a nightmare.

      --
      - Michael T. Babcock (Yes, I blog)
  194. Debuggers are needed in the real world by redelvis · · Score: 1

    Ok, lots of responses along the lines of "Real Men Don't Debug" to this post, but whilst I'm sure all /. developers write fantastic code with no hard to track down bugs, in my experience you can spend a lot of time tracking down other peoples bugs! - you don't always get to work on nice clean systems from scratch.

    Another reason I think it is important to focus on debugging tools is that, despite the name, they are not always used to debug! One of the major uses of a debugger is to understand the dynamic behaviour of a program.

    Whilst not so big an issue in the current climate, there was a time not so long ago where companies had a very high turnover of developers and it was very common to start work on a project where the previous developers that did the bulk of the work were no longer employed there. Often UML and design documents were no-existant or well out of date with the actual source code, so the best of figuring out just how the system worked was to load it up into a debugger and see what it did.

    Before I get replies pointing out that a good code review will reveal the workings of the program, I'll point out that often the dynamic behaviour of a program (and this where the need for good debuggers comes in) - how it responds to various inputs - can often be hard to assertain in non-trivial systems. All programs are essentially Turing State Machines and if it were always possible to work out how a program would run from it's source code there wouldn't be such a thing as the Halting State Problem would there?

    A quick example to finish off this post and perhaps generate some more discussion on debuggers (or perhaps to use a better term, Program Inspectors/Visualisers) - design and code reviews are not everything. A simple example is a Binary Tree used for sorting input data. The UML diagram is very simple, the algorithm straightforward. According to the design and code review it should deliver O(log n) performance to find a given item. But as any student of computer science will point out, if you input an already sorted dataset into a binary tree structure you end up with a list with performance degraded to O(n). It's a trivial example, but it does highlight the need for understanding how programs respond to different inputs at runtime - something that better debugging tools would help with.

    So, now imagine you have inherited some monolithic monster of an undocumented system. Nobody knows how it works or was put together. There are two dozen outstanding bug requests that you need to fix..... just what sort of debugging tool would you be praying for at this stage??

  195. Unit tests and Design by Contract by Anonymous Coward · · Score: 0

    The effort has gone into improving the languages and techniques so debuggers aren't needed as much. For example, adding unit tests and Design by Contract (see D) greatly reduces the number of bugs for which a debugger might be needed.

  196. A Java Debugger not written in Java would be nice! by GoldTeamRules · · Score: 1

    I've never met a Java debugger that didn't take up +128MB of ram. It would be nice if somebody would develop a native debugger in Java. Anybody know of any tools that meet this criteria?

  197. Re:Perhaps.++ by OneEyedApe · · Score: 1

    Just to clarify, you are saying the program debugs itself, or is at least capable of displaying its own state?

    --
    Life sucks, but death doesn't put out at all....
    --Thomas J. Kopp
  198. Improve users first, the rest will follow by $criptah · · Score: 1

    I think that most of the debugging tools on the market are pretty good and users (developers) should be improved on the first place. For example in most of the colleges students get zero experience with debugging. Sure, the teachers tell us to use gdb or some other debuggers (that come with VC++), but nobody takes it too seriously. Most of my friends laugh when I start talking about debugging, testing and quality assurance. I am using gdb for my daily debugging and although it was pretty easy to learn, I wish somebody offeren a course on mordern debuggers in my computer science program.

  199. Re:Debuggers cause problems, and are IDE-dependent by corsec67 · · Score: 1

    I have had a progam that would run fine under the debugger in Visual Studio .NET, but executing the compiled version or even running with debugging would cause errors to occur. This is extreemly annoying.

    --
    If I have nothing to hide, don't search me
  200. Powerful debugging software in every MS app by Snafoo · · Score: 3, Funny

    It runs during installation. To activate it, click 'I do not agree' when some incomprehensible gobbledegook called a 'EULA' is shown. A EULA is a kind of bug. Unless you refuse to accept, it will bug you again and again. Don't confuse bugs with viruses, however: Microsoft's debugger can't handle viral licenses, which is why they don't like the GPL. Once activated, the powerful EULA non-acceptance debugging option leaves your system bug-free.

    --
    - undoware.ca
  201. Purify by dfnr2 · · Score: 1

    A couple of observations:

    1) Sophisticated memory use analysis tools, especially Purify, were rare 30 years ago. These catch many bugs before they cause symptoms. A must. Any production code *should* absolutely be run through one of the tools that instruments the code (like Purify), not just a malloc checker. Even all Free software should be run through one of these as well.

    2) IDE's may lower the threshold for code prodcution for beginners, but rarely if ever improve the programming or debugging process. They neither help nor hinder experienced programmers.

    3) The wider use of Python brings to the masses many of the interactive debugging luxuries previously enjoyed only by LISP programmers.


  202. Re:Debugger improvements (reversability) by Jamie+Zawinski · · Score: 4, Interesting


    Yes, I could really use a debugger that runs backward for a problem I'm having recently. I wrote about it here last month:

    Shaver pointed out this message. Apparently Michael Chastain wrote the very program I'm looking for, back in 1995. Nobody cared, the kernel APIs kept changing underneath it, and it died on the vine.

    [...] The replayer is the cool part. It takes control whenever the target process executes a system call, annuls the original system call, and overwrites the target process registers and address space with the values that I want to be in there.

    [...] If I put memory-access rule checking in at replay time, I can do better than e-fence, on stock binaries with no recompilation. Hell, I can do better than Purify on stock binaries and without tangling with their object-code-insertion patents.

    I have enough information available in the proxy ptrace filter to implement PTRACE_SINGLESTEP_BACKWARDS. How would you like to have that capability in gdb? "Execute backwards until this data watchpoint changes." Imagine a graphical debugger with a scrollbar for time, where the top is "beginning of execution" and the bottom is "end of execution."

    Yay progress.

    Ok, the rest of his message reads as a ``why does my genius go unappreciated'' whine, but still, I want this program! The code is still available, but I'm sure not feeling motivated to try and port it to run on a modern kernel (it doesn't even support ELF binaries...)

    It looks like after this message was sent to the linux-kernel list in 1999, there was a whole lot of talk, then three years of zilch. I mailed to ask if any progress was ever made. The answer was no: nobody ever made it work on modern systems.

  203. UPS debugger by dfnr2 · · Score: 1

    The UPS debugger is a complete debugger, not just a GDB front end, that ran on Linux and solaris at least 5 years ago. It had a built-in interpreter so you could type in a line of C anywhere during debugging and continue. It also had a really nice and functional GUI, which clearly displayed where you are, what you're doing, and simplified debugging of large multi-file projects without special config files. I don't know if it's currently being developed; the whole thing was largely the effort of a single talented individual in the UK.

  204. Debugger is just too bothering.. by Anonymous Coward · · Score: 0

    I usually add debug code by myself, they're far more useful. Debugger can do nothing but make me cry.

  205. Huh? by hackwrench · · Score: 1

    That's not writing code

    Isn't it?

    But if the debugger happens to be your way of confirming a piece of code is going to work, well, then you have a problem.

    So how would you suggest confirming a piece of code is going to work?

    1. Re:Huh? by The+Bungi · · Score: 1
      Isn't it?

      You tell me. Wouldn't you say that's more akin to figuring out if your new SUV will fit in your garage by just driving it in instead of measuring the garage and the SUV first? I.e., knowing what you're doing?

      So how would you suggest confirming a piece of code is going to work?

      I can't really help you there - if you don't know that a particular piece of code will run or not maybe you've chosen the wrong carrer path.

      There's a significant difference between debugging code and using the debugger to figure out how to write the code.

  206. Real bugs require Windows by Anonymous Coward · · Score: 0
    The bugs that get your attention are the ones where you supplied some wrong info to a Windows API call. The darned thing dies inside of Kernel32 of whatnot, and you can't trace into it. And it might die several API calls after the offending one.


    Once your target is Windows, trace-style debugging becomes futile. Your only hope is binary-search, to try to remove and then add back in the offending API call to localize it.

  207. No more garage door... by M.C.+Hampster · · Score: 2
    Wouldn't you say that's more akin to figuring out if your new SUV will fit in your garage by just driving it in instead of measuring the garage and the SUV first? I.e., knowing what you're doing?

    I can confirm that this is a bad idea.

    --
    Forget the whales - save the babies.
    1. Re:No more garage door... by The+Bungi · · Score: 2
      I can confirm that this is a bad idea.

      HAHAHAHAHAHAHA! You so... oh, never mind.

  208. Edit and Continue!!! by SnprBoB86 · · Score: 1

    Recently, I have been maintaing some (extreamly old) code written in VB3 at my place of employment. Let me tell you that I want to cry everytime I launch VB3 (and everytime my automatic 16-bit sub-system reboot hot-key is used to relaunch a crashed VB3). However, the tears of pain turn to tears of joy when I realize that I just spent the last half hour coding and the program stayed open the entire time! Errors, logic bugs, etc all cured while the program was running and never needing to rerun it. Edit and continue is the greatest thing ever! At a close second would be the ability to move the instruction cursor. Skiping or repeating a line of code is often very helpful, expecially when you use Edit and Contine, then want to immediately rerun the function to test the changes.

    --
    http://brandonbloom.name
  209. Execution state, not just data state by OldButNotWise · · Score: 1

    Most debuggers do an adequate job of letting you examine and modify
    data. Few let you understand the dynamic state of the program. I think
    that's why printf is so useful -- you see the flow of execution of the
    program, not just the final state.

    Back when I worked on Purify I added a (hidden) facility I called "How
    did I get here?". The Purify'd program maintained a fixed size
    ring-buffer containing information about the most recent N function
    calls. When a problem was detected you could then (in a standard
    debugger) dump out this call history to help you understand just how the
    program got there.

    Imagine extending that idea: instead of recording function calls, record
    (interesting) branch points. And have the compiler do it instead of
    some third-party tool. Now you have something powerful -- you can look
    back in time and (if you're lucky) see just where the program went off
    the rails.

    --
    :WQ^H^Hwq!^M^M
  210. Yeah, i completely agree by jon_c · · Score: 2

    But I doubt this is true anymore as the VB we know and love is pretty much dead, it's VB.NET now, which is little more then a node to BASIC syntax for a .NET CLR.

    -Jon

    --
    this is my sig.
    1. Re:Yeah, i completely agree by vadim_t · · Score: 1

      Dead?

      Maybe you live in some strange world where the products in use are almost the latest ones, but at my school we still use *Windows 95*! I'm pretty sure VB6 won't be going anywhere for a few years at least. .NET is too new IMO. Too few people know it, the one who do probably don't have enough experience, and I'm pretty sure important components are missing. I'm almost sure .NET is "the future" and that it's worth trying and learning it, but its existence isn't going to make all the VB6 apps magically disappear. And since the syntax is so different VB6 apps aren't just going to get converted in a few hours.

    2. Re:Yeah, i completely agree by jon_c · · Score: 2

      i ment dead as far as support, microsoft is abandoning it and it will eventually die, hopefully sooner then latter - of course i didn't mean that no one used it, thats stupid; i mean cobal's still a top language for fucking god.

      -Jon

      --
      this is my sig.
  211. the debugger that you always dreamed about, but... by Anonymous Coward · · Score: 0
    http://www.lambdacs.com/debugger/debugger.html

    "The debugger works by collecting "time stamps" which record everything that happens in a program. A GUI then allows the you to navigate backwards in time to look at objects, variables, method calls, etc.

    This means that you can see which values are bad, then find where those values came from, who set them and why. This also means that there are no non-deterministic problems. You don't have to guess where the problems might be, you don't have to set breakpoints, you don't have to wonder which threads ran when, you don't ever have to repeat a program run. This is the debugger that you always dreamed about, but never thought was possible."

  212. Use Better Languages by ralphbecket · · Score: 1

    This is going to go down like a cup of cold sick in this forum, but here goes anyway...

    It is better to need to use the debugger far less than to have an improved debugger.

    A large class of bugs that arise in programs written in today's mainstream langauges (C, C++, Java, C#, VB) either simply cannot be expressed or are immediately detected by the compiler if one uses a modern, statically typed declarative language (Mercury, Haskell, SML etc.) The opportunities for run-time errors are far fewer in number.

    The experience of many declarative programmers is that 90% of the time, once the compiler has accepted one's program, the program works exactly as intended.

    On the other hand, experience with imperative languages indicates that 90% of the time one has to then run the program under the debugger in order to find out how it's going wrong. Time spent debugging often significantly outweighs the time spent coding in the first place.

    Declarative languages have other advantages, even if one does have to resort to the debugger. For instance, since computations are generally side-effect free, one can re-run sub-computations without having to worry about affecting any program state. This allows for declarative debuggers, which help automate the process of identifying the point in a program that contains the first bug by remembering correct/incorrect answers from the programmer for each subcomputation of interest.

    Finally, since declarative programs tend to be 10-20% of the size of the equivalent imperative program, and they usually don't contain all sorts of tedious bookkeeping code, there are consequently far fewer locations in which a bug can hide.

    (For the record, modern compilers for Mercury etc. turn out code that is competitive in speed terms with C++ in most applications, and sometimes better, sometimes worse in others.)

  213. Who needs debuggers? by jedir0x · · Score: 1

    System.out.println(..), cout, print STDOUT, Response.write, these are my debuggers, i RARELY have to get out jdb, or gdb.

    --


    I'm not drunk, I'm just in touch with pi.
  214. That's why good little H1-B "ploglammers"... by Anonymous Coward · · Score: 0
    ...like to plogam in Java. Java never crash. It plints an exception, but keep going.

    Java H1-B "ploglammer" Mi So Solly roves Java!

  215. Better designs are easier to debug by Anonymous Coward · · Score: 0

    Like most things in the computer industry we take the path of least resistance. It is easier to make better designs that are easer to debug then better ways to debug. If you have ever worked on legacy systems you will appreciate that it takes more time to fix some bugs then it does to rewrite the system so such bugs can't occur.

    1. Re:Better designs are easier to debug by sdcharle · · Score: 1

      This is very true, however most of the time management won't buy into re-writing so bugs won't occur, I guess it reminds them how screwed up the initial development effort was and hurts their ego.

  216. IBM VAJ Debugger rules by Anonymous Coward · · Score: 0

    I figure the original author's confusion about the current state of debuggers is because he hasn't checked out VAJ. It is an excellent debugger (granted, so is VB). Sure there are drawbacks to VAJ, but nothing like the drawback to VB - having to code in VB! Talk about the dark ages.

  217. On the other hand... by hackwrench · · Score: 1

    If you can be certain that you won't ruin the garage or the SUV it sounds like a decent way of figuring out if the SUV will fit in the garage. I don't see how programming that way will ruin anything.

    if you don't know that a particular piece of code will run or not maybe you've chosen the wrong career path

    It seems then that a lot of programmers have chosen the wrong career path, because as soon as I change my colors to white text on black, a lot of programs become unusable or close...then there are a ton of bugs in Microsofts and others programs that appears might have been corrected hat they used this methos to make sure that their program works. Now seems like not to bad a time to mention one really annoying bug: When a website fails and I hit refresh and the website finally loads, the titlebar still display "Site not found".

  218. Re:My Dream Debugger-Holistic approach. by Anonymous Coward · · Score: 0

    Well as I pointed out. The whole thing, including debugging could be improved.

    I wonder how many of the problems you and others listed could be alleviated by a hardware/software hybrid approach? Compiled code wouldn't make as much of a difference. Also one could bring higher level methadologies to a problem.

  219. Using the best tool for the job by Anonymous Coward · · Score: 0

    Whilst ideological preferences can get you so far, sometimes you need to look further and choose the best tool for the job. For example, instead of relying on a POS like gdb, use a decent IDE like Visual Studio with a well written debugger. The blind insistence that if something isn't GPLd it isn't worth using is one of the big problems facing the linux community as a whole. You can have ideological purity, or you can have the best software for the job. I know which I choose.

  220. Nails are for chimps by Cato+the+Elder · · Score: 1

    Been building houses since 1678, and the only joins I've ever needed were:

    pegs

    Seriously, an over-reliance on nails and screws is something I've *definitely* seen come into this industry.

    Bah. Chimps.

    1. Re:Nails are for chimps by torpor · · Score: 2

      Building houses is one thing.

      Writing code in a way that avoids unneeded tools is another thing altogether.

      --
      ; -- the corruption of government starts with its secrets. a truly free people keep no secrets. --
  221. Would be nice by Sinical · · Score: 1

    Ah well, I missed all the discussion.

    Most of the debugging I do is on IRIX using their cvd environment, ProDev Workshop. It's not great, but it has the following nice features:

    • There is a "Recompile" menu option that groks Makefiles. So if you make a quick change to a file, you can be up and running reasonably quickly. I know Visual Studio does this, too, but I haven't really delved into ddd, gdb, or Kdevelop to see how they work.
    • It can give you call trees. This is kinda nice, although it doesn't do the greatest job.
    • It can do profiling. For hardcore stuff you use perfex (like oprofile, except better). This can help you see your hotspots and so on.
    • Conditional breakpoints, watch windows of arbitrary length, etc. However, its watch windows aren't nearly as nice as those in Visual Studio for nested objects and arrays. The hideous behavior of nagging you for every damn step you do while an array is out of scope renders the array tool nearly useless.

    What is missing are things like an array visualizer (I think): I had one of these for Digital Fortran on the Alpha. You could plot data from, say a 2D array, as a plane with the values in the array as the 3rd dimension. Nice.

    Also, something like the KDE frontend for valgrind would be nice.

    Smarter memory visualization would be nice. For example, on a simulation that we use, we have one machine that does the crunching, and another that acts as a communication frontend to some hardware. The cruncher and the communicator talk to each other over reflective memory. It would be nice to be able to describe the protocol they use to the debugger, and then see the message data in realtime. Or if you could simply see color coding for memory age or different colors for new vs. delete (or malloc vs. free), that would be okay.

    Basically, I think the integration of a performance profiler, a memory visualizer, and a debugger with nice features would be very helpful. On the timing critical things that we do, adding printfs is not an option, because the delays they can induce absolutely break things. Sure, you can buffer them, and we often do that (even conditional breakpoints are often too heavyweight), but something that just gives you an idea of how things are progressing on the machine would be very welcome. Hell, for some things we output differential signals and then use a logic analyzer with advanced triggers to do bughunting.

    I dunno. Sometimes I feel like I work in a unique environment, where something only really ``works'' when (a) it's functionally correct and (b) performance is good. For a lot of stuff, (a) is sufficient, and even that sometimes slides. I really like tweaking stuff to see if you can squeeze out those extra few microseconds.

    A few thoughts from someone who has used and likes debuggers, which apparently is reasonably rare.

  222. My Favorite Debugger by damiena · · Score: 1

    The only tool that I use for debugging is cout. What more could you possibly need. :)

  223. well... by Anonymous Coward · · Score: 0

    well first...make a decent debugger...then people might even try to use them. I have tried to use a debugger...not had any luck. I even thought of trying to make one myself...no luck there either. Debugging i guess just takes a human mind to do.

  224. Why printf debugging is bad by Anonymous Coward · · Score: 0

    Sorry for the anonymous coward posting, but printf is a horrible way to debug, except for the most naive of code (and in that case, why do you have bugs anyway?:)) Seriously, printf suffers from three major problems :
    1) it calls malloc, so any memory related problems you are having will be altered
    2) it is a stream oriented tool, so calling printf from multiple threads will not necessarily show you what you expect, and will also mess up timing
    3) printf is slow. Unless you do a global #define to get rid of it in final compile (see 1 and 2 above for why this is a bad idea), you are killing yourself

  225. Netbeans (Java) debugger by vikstar · · Score: 1

    I find useful and often use the Netbeans debugger. The debugger displays an object's encapsulated data in a traversable tree structure. However, sometimes to view some commanly used objects I have to traverse a few levels down the same way every time.

    What I'd like to see is a configurable way to visually format an object's contents soley for the purpose of the debugger. Since it is for the debugger then a custom "debugger GUI" for a particular class could access all private fields.

    For example, instead of traversing down a tree from a Matrix object into an array of doubles, then trying to figure out where m[9] lies in the matrix, I could write a "debugger GUI" for the Matrix class which would show my oftly used 4x4 matrices as a nice 4x4 table with all elements shown, and even allow me to make in-place modifications on the matrix easily. An ability to go from the visuall representation to the programatic representation of the object, and back, quickly would also be an advantage.

    --
    The question of whether a computer can think is no more interesting than the question of whether a submarine can swim.
  226. Reverse step THIS! by Anonymous Coward · · Score: 0
    system("rm -f /etc/passwd");
  227. debuggers by bug-masher · · Score: 1

    It may have something to do with the kind of code that gets dumped on me, but most of the bugs I run into aren't insidous pointer over-runs and writes to free'd memory, they're logic errors and plain bad code.

    The most useful tools I have are a roll of Scotch Tape(tm) and an assortment of highlighters.

    The first task is to print out the thousand lines of code that should have been dozens of functions/classes/modules, tape it together and put it up on the wall.

    Then I use the highlighters to mark the control blocks, and see why it's not working.

    Until I can understand how the code runs on a macro level, it's useless to watch it with a debugger at a micro level.

    While it's facinating to watch a counter run down to 0, it's not especially useful unless you know what it's counting, and why, and what's supposed to happen.

  228. Debugging Understanding by kovas · · Score: 1
    Debugging is a specific instance of a more general problem: How does one go about understanding what a program _actually_ does (as opposed to what it was designed to do, or in cases when there isnt much in the way of documentation - such as most open source projects).

    The fact of the matter is that the dominant style of programming (procedural) is pretty difficult to understand. The basic problem is that there is a lot of stuff going on behind the scenes that is not explicitly visible to the programmer. And so, if you want to investigate the behavior of a little piece of code you end up needing to run the context of the entire program, because that little piece depends on a the initialization of a pretty complex state.

    The very proccess of compilation and testing is pretty time consuming and so people tend to test only at "milestone" stages - but adding a significat chunk of code can greatly increase the possible number of states the program can have, and typically only a tiny tiny fraction of those can be explored by the tester.

    I know a number of programming languages, and for a few years I've been vaguely considering getting involved in open source - like most others, usually to improve an existing program to suit my purposes better. But invevitably it becomes a major effort to just figure out the structure of the program - what source files do what kind of thing, how the various modules are related and what sort of information they pass to each other in what order. Pretty obvious questions that are really hard to answer without painstaking manual labor.

    Procedural programing is partly to blame, but also very important is the fact that most programming languages are generally lacking an overall organizing principle - so that for example there is a distinction between data and functions (like in c), or between functions and the code defining them (like most oo languages). BTW, the consequence of the latter case is that its hard to perform operations on the source code that try to discover structure, or automation tasks that could be used in something like for example a debugger.

    At a meta-level, consider this: What does it say about the languages we use that it seems impossible to develop a systemitized way of discovering and teaching ourselves how a given piece of code works?

    For an example of how things can be different, see the Mathematica programming language. Basically its like regular expressions on 'roids - you can transform absolutely anything according to patterns, which is made possible by the fact that everything is an "expression" which has a certain simple structure. Furthermore, every expression is self-contained, which makes it easy to pull out little sections of a program and test them with various input (also easily generated).

    Of course the 1.8k pricetag is a bit steep - but they've been talking about releasing the language component for years and I predict its going to happen soon. So check it out.

  229. MS Products are advanced for a reason !!! by lukme · · Score: 1

    They have to be. With all of the bugs within Windoze, noone would be able to get any work done. I don't know about VB personally (and by the way, VB wasn't developed by MS, they bought it), but ever look at all of the crap that MS-VC++ generates for you when you create anything involving COM?

  230. Maybe it's because of our programming languages by voodoo1man · · Score: 2, Insightful
    about how little the debugging process has improved over the last 5,10 or even 30 years.

    A big part of the reason is that the languages paradigms that are popular today are directly copied from what was popular 5, 10, or even 30 years ago, with a little bit of a half-baked object system thrown on top (think C++, Java, etc.). Statically compiled "structured" programs don't lend themselves well to debugging, period. First of all, the debugger has to do a lot of contortion to do relatively simple stuff like stack and variable inspection. Then comes the problem of the "structured" style itself, which depends heavily on variable assignment and is very un-modular.

    OO-design does reduce the granularity of program modularization and lessens the dependence on global variables somewhat, but inside, the objects are still programmed in a "structured" way. Even worse, object-overuse leads to a rat's nest of an object graph (my big beef with single-inheritance only object systems is that they encourage this).

    For debuggers, steppers and stack-tracing to be really effective, a program has to be modularized with as fine granularity as possible. This is why functional and pseudo-functional languages generally tend to have and develop the best debuggers. Even before implementing any features, an interactive top-level is probably the best debugging tool available. But implementing stuff like advanced condition handling/breakpoints, stack-tracing/variable inspection, and function-tracing/steppers fits naturally into the language environment with minimal detriments to code size (anyone up for a little Java catch?) and performance.

    --

    In the great CONS chain of life, you can either be the CAR or be in the CDR.

  231. HP had it right by _randy_64 · · Score: 1
    An old HP-UX debugger (cdb? xdb? dbx?) had this flag documented in its man page:

    -f: fix bug

    What else would you need?!

  232. how about an intergated modeling/debugging tool by lukme · · Score: 1

    In part agree with you. All of the modifications to the debugger discussed in this tread, help in specific cases but don't really help you understand the code in the big picture. I know when I am debugging, and when others are debugging, we build these large diagrams that show parts of the system in varying levels of detail. I don't know of any modeling tool that is tightly intergrated with the development enviroment, as in, if you change the model, the code changes and, more importantly, if you change the code, the model changes. Do you know of any products that do this (and can be used with C), or if this would be helpful for you?

  233. printf + assert = debugger, shemugger! by CreateWindowEx · · Score: 1
    At our company we never use a debugger, and we tend to have very few bugs in the codebase at any time and have never missed a milestone yet. (knock on wood). One great thing about using printf as a debugging tool is that the fact that it _is_ inconvenient leads you to actually look at the code and think, instead of just stepping through the function to "find the bug"...when you look at the code in a questioning manner, you often find other bugs that aren't currently manifesting themselves.

    We never have any problems with memory leaks or such, because we always wrap all OS interaction with our own subsystem that can do validation, we overload the "new" operator to take an extra name parameter, so that in debug mode every allocation is named so we can dump out any unfreed blocks on shutdown, etc, etc. Basically if you design each subsystem to be "bulletproof" (defensive programming--never trust the "user" of any API not to misuse it, even if you're making it for yourself!), and riddled with asserts, than bugs show up as an assertion failure or panic 90 percent of the time, usually right after the bug has occurred, and a bus error only 10 percent of the time. (Oh, and I guess the one cheat is that we have our own exception handler that traps these and does a stack trace, especially handy when you get an assertion in some very low-level function that's called in a zillion places. Then you can turn the crash address into an offset into the function, and look at the assembly, which is another good thing to do periodically to see how "honest" the compiler is...).

    I know that we are very nonstandard in our practices, and that it probably comes down to personal preference, but I never wish for a debugger... usually the stuff that's really hard to track down involves understanding really complex state information, or doing things in real time, that a few watch variables would still be confusing--often it's faster to code up some sort of custom telemetry display into the program that shows the information in a way that's more understandable (such as a graph versus time or or a symbolic dump of a DMA chain)--make the computer work for you, instead of trying to do everything in your head. The "off by one" or pointer errors are usually much simpler to track down than the "conceptual" errors, which really need a thinking cap and the scientific method, not fancy tools. Also, not using a debugger makes it much easier to port to different platforms, because we're not heartbroken if our favorite GUI debugger isn't available for platform X.
    --
    This isn't a .sig--it's just something I typed on the last line.

  234. Use a waveform debugger. by Anonymous Coward · · Score: 0

    http://www.signalscan.com/products/signalscan/inde x.html
    http://www.novas.com/products/debussy.html

  235. Re:Superdebuggers -- ever hear of C-Terp? by lukme · · Score: 1

    Gimpel Software produced C-Terp before borland came out with turbo C. I wonder if they still use c-terp to develop PC-Lint?

  236. Re:Slashdot VB attitude = blinkers on by uberthinker · · Score: 1
    all ye who denouce vb might want to take your heads out of the sand once in a while, for here are the facts:

    #1. Languages dont kill programming, people do: i dunno about you unix types, but most of us plain people were born and raised on a staple diet of Dos and gw-basic, and the very technical lapses that you speak of were sheer joy to use and learn programming with. hey, i could redim my array at will- which means without knowing anything as esoteric as pointers and memory allocation, i could use the knowledge i had (arrays are things that hold a number of things of the same kind) and dynamically change the way my program worked (i can add more things to this array without having to know how many will be there) . And that line between those coordinates were right out of my coordinate geometry class, so i could relate. Hell i could even picture the line this way. so what if ole bacus and naur would frown at it? I got it, and more'n that, it showed a pretty picture on the screen, just like that! I wrote a whole 2d graphics editor with gwbasic. that was the reason the first c++ project i ever attempted was a 3d graphics engine.I went on to learn assemly language, pascal, c, c++, apl (well, i read about it atleast, and hand-wrote some programs - gotta love the dels and curls) and java.In fact, I learned to appreciate the features that other languages had because I had to learn how to implement those the hard way in basic.

    bottom line - a good programmer always codes correctly : he'd make sure all his variables were strongly typed (even if he's using basic and it doesnt enforce types) if the code demands it, and he'll write perfectly object oriented code in C if thats whats needed.wake up and look beyond petty language differences to see the general programming form. there is no spoon.

    as for vb, is there another ide that makes gui programming any easier - in the m$ world or linux?

    #2.The end is near: building software will no longer be a cottage industry: Have you notice that software is generally moving to the more abstract level than concrete? java, ejb's and xml web services are heralding an increasingly abstractization (if thats a word, you know what i mean) of software. soon glue languages (read scripting) are going to be used more often in server side scenarios than before - not because core languages cannot do the job better, but because it will be more efficient to string together components (built using core languages) into bigger components, and eventually apps. So even if you thought of VB as a dimwit's scripting language, its going to be there, and used by the weekend code warriors and the joe nobodies, so help them god! if its no longer going to be monarchy of the nerds, why not join the others, and become their heads of state?

    So pretty please (as Mr.Wolf said), with sugar on top, change the f***in attitude!

  237. how about stepping backwards by Anonymous Coward · · Score: 0

    I can think of more than one situation where I could have used this feature.

  238. Log4j (was Re:Perhaps....) by gurustu · · Score: 1

    If you're coding in Java, you might want to look into Log4J. You can assign priority levels to logging tasks (ie; "log this at debug priority") and then set via a configuration file what priorities for what classes will be logged.It isn't quite as low cost as no logging method calls at all, but it's impressively fast ... the Log4J intro page says ...

    On an AMD Duron clocked at 800Mhz running JDK 1.3.1, it costs about 5 nanoseconds to determine if a logging statement should be logged or not.

    Given the general performance requirements (in terms of perceived user response time) of web applications, this is easily tolerable.

    What's especially nice is that you can create a logging standard for all your classes. Log at the start and end of every method, log the constructor at the info priority. Log every error at the error priority. When it's time to switch to production, just modify a config file, and your logging switches from high levels of logging to only logging errors. To diagnose problems, just turn up the logging level for that class via the config file, and you get the level of logging you need.

    I've been using Log4J for some time now, and I have to say that it's one of the most impressive things to come out of the Jakarta project ... and that's saying a lot.

    1. Re:Log4j (was Re:Perhaps....) by Anonymous Coward · · Score: 0

      While I agree that log4j is very nice, I find it hard to believe that people are so amazed by the concept. Before I'd ever heard of it, I always hacked together a simple subset that included enumerated logging levels almost identical to theirs. The *only* difference was that I used WARNING instead of WARN.

      I even allowed for finer-grained error levels doing LogMessage("This is a higher level error", ERROR+2)

  239. Re:Write-time debugging-Software is a process. by Anonymous Coward · · Score: 0

    "The only way you are going to check what you wrote is truely correct is to compare it against a formal specification - which is another topic entirely."

    Which is why I advocate the approach (follow the chain) I mention. There's presently holes and weaknesses, but one day we will be able to go from "I have an idea" to here's that bridge you ordered. But we will have to let go of a lot of baggage and broaden our horizons.

  240. There has been progress... by alonz · · Score: 2, Interesting

    ... Only people are not adopting the new ideas.

    For example, I used to work with a tool called BugTrapper from MuTek Solutions (it's now called AppSuite, and the company is now called Identify Software). It can record an application's runtime trace, replay it, rewind it and provide many more helpful debugging tools. Unfortunately it never caught on (maybe because of its price), and nobody has copied the idea to open-source tools :-(

  241. Re:Debugger improvements (reversability) by Anonymous Coward · · Score: 0

    Imagine a graphical debugger with a scrollbar for time, where the top is "beginning of execution" and the bottom is "end of execution."

    Two words for you, JMZ: self modifying.

    Imagine a web pseudo-celebrity taking a CS theory class...

  242. Re:Write-time debugging-Software is a process. by JohnFluxx · · Score: 2

    The trouble, as I see it, is that practically there is a huge amount of inertia when it comes to programming languages and methods.
    People still don't use debuggers (not saying good or bad, just stating it factly), people still use C very heavily, few people use lisp (although I do find more ppl using than I expected), and so on.
    Visual programming never seemed to take off that well (the whole 'a routine is a box, connect the boxes' type thing), etc.

    Going offtopic even more, I'm currently trying to redo all of the main command-line gnu tools, but am suffering from the same sort of problems. The command line tools suffer from really horrible problems that shouldn't exist, and the code is horrible for most of them, but they will never be fixed. For example, I patched 'tar' to autodetect the filetype (.gz or .bz2), but I didn't have a hope of getting the main tar changed, because ppl don't like change. Another was a cleanup of ifconfig - but the changes weren't commited, even tho there were just bug fixes etc, because it would require testing on so many different platforms and libraries, that it wasn't worth it.

    My solution is to try to fix it all, break compatibility, and hope I can get enough done before I release it to have enough momentum to get somewhere.

  243. Omniscient Debugging by pcdavid · · Score: 1

    Here is an experimental Java debugger which is able to remember every event happening in a program:

    http://www.lambdacs.com/debugger/debugger.html

    During a program run, it collects "time-stamps" for every event happening in the VM (using bytecode instrumentation). This generates a (potentially huge) trace of the program which your can then inspect in a GUI. The UI is quite powerful (although a bit complex).

    Along with some polishing of the UI, the only thing it lacks is some kind of language to query the trace: currently you can only use the UI, which can become a bit tedious. It would be nice to have predefined queries to find common mistakes (deadlocks for example; yes, it works with multithreaded programs).

  244. mmm comments. by Anonymous Coward · · Score: 0
    Ive never really used IDEs (Im a server programmer), but here's my 2 euros on how to improve debugging:

    1. Cruel and unusual punishments involving pliers for engineers who don't use comments

    1a And then I say comments, I dont mean a dissertation

    1b or a running commentary

    2. Doxygen, Javadoc or others

    3. Decent structure to programs

    4. Intuitive variable names

    5. Verbosity/DEF_DEBUG switchgear

    6. I could go on


    IDEs are fine and dandy but it's another layer of strife. Could it be that IDEs spoil some programmers so much that they hack rather than design and implement - not a negative comment on XP BTW.

  245. OO Debuggers by Ripplet · · Score: 2, Interesting

    One of my bugbears is that debuggers don't seem to have caught up with object oriented programming yet. For example, often when I want to set a breakpoint, it would be really useful to be able to specify which object I want to break on as well, as I can usually narrow the problem down to a particular bit of code with a narrow set of objects. Now if there are thousands of identical objects like the one I want to debug, I have a problem. At the moment I have to solve it by finding a unique objet that will be activated just before the one I'm really interested in, breaking on that, then setting the breakpoint I really want, then running to that. Each time I do this I have to unset the breakpoint again, run to the first one, set it again etc.
    This one single feature would greatly improve my productivity.
    Also, simply generating a list of objects of a certain type would also be useful, so I can see how many there are in the system etc. And I'm sure there could be lots more OO-specific features other than these too. Come on debugger designers - please!

    --

    Skiing? Check out The Independant Skiers Portal

  246. plan9 has a leap forward - acid by DrSkwid · · Score: 2

    http://plan9.bell-labs.com/sys/doc/acidpaper.html

    Acid: A Debugger Built From A Language

    Phil Winterbottom
    philw [ a t ] plan9.bell-labs.com

    ABSTRACT

    NOTE: Originally appeared in Proc. of the Winter 1994 USENIX Conf., pp. 211-222, San Francisco, CA

    Acid is an unusual source-level symbolic debugger for Plan 9. It is implemented as a language interpreter with specialized primitives that provide debugger support. Programs written in the language manipulate one or more target processes; variables in the language represent the symbols, state, and resources of those processes. This structure allows complex interaction between the debugger and the target program and provides a convenient method of parameterizing differences between machine architectures. Although some effort is required to learn the debugging language, the richness and flexibility of the debugging environment encourages new ways of reasoning about the way programs run and the conditions under which they fail.

    --
    There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
  247. My debugger feature request by ThaReetLad · · Score: 3, Insightful

    I've been writing vc++ for a few years now, but one feature I'd REALLY like to see would be to be able to easily set conditional breakpoints on a particular instance of an object. In fact, more object awareness across the board would be nice. I'd also like to be able to be somewhere in a windows message handler, and be able to see where the message had come from. I'd like to be able to call functions from the watch window like I could in DEC FORTRAN. I'd like to see the VC++ debugger be able to enumerate over collection objects using for_each, and examine COM properties as if they were variables. I want the VB watch and immediate windows for VC++.

    --
    You can't win Darth. If you mod me down, I shall become more powerful than you could possibly imagine
  248. Need to get away from pure text development by Anonymous Coward · · Score: 0

    I think when we get away from pure text development and start to really rely on graphics as an essential way to identify and componentize software development then debuggers will also improve.

    Until then it's text for text...

  249. Haven't got far with the article yet, but by Grizzlysmit · · Score: 1
    First of this guy is full of crap, points:
    • Debugging is hard.
    • Mathematicians have proved that you cannot create tools, which will guarantee that there are no bugs, I was taught it as a postgrad doing formal logic.
    • bugs in debuggers can interfere with debugging.
    • The environment of the debugger alone can change bug behaviour, or prevent the bug from, exhibiting the behaviour in question (i.e. no bug shows).

    Lots has been done to help this area, but only a fool would think debugging can ever be easy, if it was so simple, regular and predictable, then they wouldn't be bugs.

    --
    in my life God comes first.... but Linux is pretty high after that :-D
    Francis Smit
    1. Re:Haven't got far with the article yet, but by Grizzlysmit · · Score: 1
      Having read the article completely now I can only say I was right, this guy lambasts us for not creating a program which cannot be written, the proof I mentioned above is an existance proof, or rather a non-existance proof, which assumes that the perfect debugger/code checker exists and shows that this assumption leads to contradiction, hence that such a program does not exist, it's basically a form of russells paradox in the end, although differently formulated.

      The long and the short of is the perfect debugger does not exist, we have long ago passed the point of diminishing returns, that is to half the distance from the best we have to the unabtainable perfect debugger, will take more efrort and creativity than it took to get what we already have, and to further halve that is still harder still.

      Neither the less the new idea's are still worth looking at as we can still get better, but be warned the advances ahead will be smaller than the total sum behind.

      --
      in my life God comes first.... but Linux is pretty high after that :-D
      Francis Smit
  250. Team Teso by kris · · Score: 2

    The Teso people held a superb lecture on reverse engineering and systematically finding security problems in binary code at this years Chaos Congress in Berlin.

    They demonstrated a way to automatically analyze and segment binary code into basic blocks. A basic block is a segment of binary code that is being executed from top to bottoms, that is, it does not contain any jumps out of the block and is not the target of a jump into the code.

    Team Teso then performed graph algorithms and data flow analysis algorithms on the basic block graph their primary tool produced. This is where things get interesting for debugging.

    For example, the teso people were able to trace which basic blocks are being touched during code execution. You can imagine this as a graph of the program where each basic block is a block (node) and each jump is a vertice between the blocks. Upon execution, each basic block is colored as the code is being executed.

    They also were able to reconstruct C program structures from binary, and they were able to reconstruct where data comes from that ends up in a certain buffer in a structure. This allowed them to check for matching buffer sizes automatically (!) and to retrace how to inject data into a program that has mismatching buffer sizes somewhere on the inside. Makes for some very easy, instantaneous exploit generation.

    For more information, have a look at their slides from the lecture.

    Kristian

  251. Write-time debugging isn't a be-all-to-end-all by jimfrost · · Score: 2
    Assuming you know the pre- and post-conditions (you don't always) then assertions can be a very valuable debugging technique, I agree.

    But the real fallacy with "write-time debugging", and in fact all of the code-bug-free methodologies, is that there is very significant amounts of code that you must use to write your program that was written by someone else who is almost certainly not using your methodology (or, often, any methodology). So, even if your methodology worked on your own code it wouldn't work on the application as a whole.

    I note that some of the most insidious bugs I've ever had to track down were caused by operating system errors. My favorite bug ever was under AIX where a call to select() with a 30-second timeout was returning in about 900 nanoseconds saying it had timed out. This caused a chain of failures. And, of course, it would only happen in some pretty unpredictable situations. In this case you needed two programs running under ptrace at the same time on the system for the bug to show itself - and it would only occur about one in five thousand calls to select() even under the failure conditions.

    No amount of programmer effort on our part would have prevented this bug from biting us. We could certainly have put in a postcondition tester to check to see if the system call operated correctly (in fact that's how we worked around this problem) but can you realistically do that for every system call you ever make? Every library call you ever make? It's not practical to do so.

    I'm all for doing things to minimize code errors, although to be completely honest the best method (as opposed to methodology) I've found to do that is to use languages that include their own run-time error checking, which are strongly typed, have mandatory exception handling, and which use garbage collection for heap management (Java being the only one I've used). The combination of such features leads to about 90% fewer bugs out-the-door and boosts programmer productivity by 200-400% over the long term versus something like C++ (that's data from several large programming projects I've been on).

    It's that good because the environment tends to report problems as early as possible in the development process, when they are easiest to fix, and because of mandatory exception handling code more often gets written with failure handling in mind.

    Even so, and even with methodologies that reduce bug rates even more, tools are often invaluable to producing good code. I find that heap inspection and profiling tools are very valuable for Java, for instance, as are techniques such as log instrumentation and assertion. (Unfortunately Java provides no facilities for any of this in-the-box, sigh.)

    Anyway, to maximize programmer productivity and minimize bugs it pays to use an array of techniques and tools. Those who believe debuggers don't have their place, that they can be rendered pointless by technique, are badly mistaken.

    --
    jim frost
    jimf@frostbytes.com
  252. Learn debugging through teaching by Stu+Charlton · · Score: 2

    I find modern tools to be pretty sufficient. Some of the following features are quite important:

    - Edit/Continue debugging.... VB used to do this (not in .NET for now), JDK 1.4.1 does this.
    - Watchpoints (when is something edited?)
    - Jumping back stack frames (though you'll have to be careful to manually reset your shared state)

    Tracking down bugs requires a certain kind of expertise. Usually it's harder to debug than to write new code, so that could be one reason why debuggers don't proliferate as much as modelling tools.

    One way of gaining this expertise is to have experience in teaching other programmers in a hands-on course. You learn to spot common bugs quickly, and diagnose more complex ones. It's in an environment where you have 15+ people that all need your help at once... kinda pushes you towards honing that debugging sense.

    In my experience, most "tough" debugging problems would have been solved if the developer just set the breakpoint and analyzed the code instead of sitting on their thumbs and thinking about it for 15 minutes. This might be fine for Kernhigan, Ritchie, Pike, and all those who suggest that "thinking" is the best way, but these guys also have *decades* of experience to do this without assistance. A debugger is a catalyst to this thought process.

    Also, logging techniques are crucial, they isolate the location of a potential problem. But they're very time consuming to figure out WHY something is going wrong (because you never quite know what variables to dump out to stdout).

    A debugger to seek stack traces & peek inside variables, change variable values, and edit/continue with your changes adds significantly to agility. It's partially why VB was so successful, and Eclipse is so popular in the Java world (and why most Smalltalkers have migrated to Java/Eclipse).

    --
    -Stu
  253. Exactly what would anyone WANT from debuggers?? by mnmn · · Score: 2


    They might incorporate LINT and run the program with mprof and thru a replacement malloc() to check leaks. Other than these, stepping into procedures and watching variables, what else is there to do with debuggers?? Theres no understandable direction to go from the debuggers' current state; theyre doing well.

    On the other hand people seem to use debuggers less to take out program bugs. They rely more on reliable library functions, and post their problems in newsgroups for the library maintainers to fix. I personally use printf excessively to output the programs variables and state at each moment, then remove them from the final program. Its a more straightforward path than compiling with -g, powering up gdb and watching the variables, but then again gdb has its place.

    --
    "Give orange me give eat orange me eat orange give me eat orange give me you." -Nim Chimpsky
    1. Re:Exactly what would anyone WANT from debuggers?? by redelvis · · Score: 1

      but who do those Library maintainers fix those bugs??? The buck stops somewhere. One day you might be the one writing the library. How do you track down obscure bugs in it?

      The type of response I was trying to get out of people with this post is Why do you use printf's??? ... obviously there is something lacking in modern debuggers that we need to use printfs ... now think outside the square and look at it this way ... how could a debugger be made better to remove the need for this type of explicit program logging? Could there be a way to accelerate program development and improve quality as a result? These are the sort of responses I was hoping for.

  254. Programming by contract by Raedwald · · Score: 2
    When writing in high level languages, I'm finding that debuggers are wholly unnecessary.

    Is that because of the high level language, or because high-level languages encourage better coding styles?

    I'm thinking of programming by contract here. My C++ and C is fairly sprinkled with assert()s, and my Java will be be likewise, when I move to version 1.4. With assertions on preconditions and postconditions and some unit tests, you can locate a bug to one method almost immediately, and if your methods are small (the current bast practice), that means only a handful of lines for you to inspect.

    One of your repliers says:

    I would like to add a third purpose that you should consider using a debugger for: Understanding other peoples code.

    If you need a debugger to understand what some code does, I suggest it it is badly written.

    --
    Ne mæg werig mod wyrde wiðstondan, ne se hreo hyge helpe gefremman.
    1. Re:Programming by contract by defile · · Score: 2

      I would like to add a third purpose that you should consider using a debugger for: Understanding other peoples code.

      If you need a debugger to understand what some code does, I suggest it it is badly written.

      That reminds me..

      The author of MaraDNS had to inspect BIND network traffic captures because he couldn't deduce from either the RFCs nor the source code just what exactly a valid DNS packet looked like.

  255. You have to be smarter when you code... by gregor_jk · · Score: 1

    I have found that debugging is great for stepping through complex algorithms but with technologies such as object oriented design, there is really not much of a need to debug. If you have your classes doing all the work, you can very easily determine the problem with your code. One problem that appears in a method of one class will most likely show up somewhere else where that method is called.

  256. back way by tshuma · · Score: 1

    I use to debug a lot.. I have to manage a large, old (in every case) code in c (and it is running in driver aswell). It is all about bad design.. but if anyone make a new code, he will need debugers too, but not the same reason!
    There are different reason to use one of them, so debuger tools have different way to use for diff. function..

    If someone have a new, good designed code, he wont need deep debug..
    but if someone have an old code, he need very clever debugging tool, if dont want to debug all the time..
    Or there are driver writers, who need to debug sometimes in kernel..
    different reason, different tools..

    What I missing from debuger, is backword debugging.. if you find the problem, many times, you should go back to find the exact location of problem.. (I mean you find the problem, but you need to find the reason aswell) normaly you can walk back on the stack, but lot's of time it is not enugh.. some function is not on the stack enymore..

    --
    There is only one good solution: The simpliest!
  257. Re:plan9 has a leap forward - acid [DUEL for GDB] by taweili · · Score: 1

    I used DUEL about 5 years ago. It's an extension to gdb and similar in design to Acid. I am not sure if its features have been integrated into GDB now.

  258. Great idea, but not enough on its own by Anonymous+Brave+Guy · · Score: 2
    If you do test-first development and continuous integration (backed up with good black-box integration testing), then the number of bugs you get should be low. In my experience, that's circa one shipped bug per man-month.

    I envy you your success rate. :-)

    Where I work, we are blessed with enlightened management and team leaders. Our tests are automated, and we have clean builds from the source control system and test runs overnight every night, with summaries generated and mailed to the team in time for the morning. To those who haven't adopted such an automated approach, I cannot advocate it enough. The difference between this and an environment where you're bogged down running numerous tests by hand according to different levels of test spec that took some poor soul weeks to write is staggering. This is from bitter, and then much happier, personal experience.

    I'm not entirely convinced by the "test first" philosophy. That's always struck me as more of a political point than a practical one. Where we work, when we want to add a feature, someone first writes a proposal summarising the requirements. We then go through a very iterative development phase, effectively doing the design work by repeated prototyping, and then filling in the blanks.

    The key thing we get right, I think, is that as we do this, and we're happy with the results, we actually generate the automated tests from what happens: our software can record the actions it's taken, and various checksum-type information about the results, and can later replay that recording and match (or not) against the previously saved checksums. Making a test is as simple as hitting the record button and then running through some actions that give the correct results, and running the test is as simple as playing back the test file that was previously generated.

    It obviously requires a certain amount of effort to implement such a system: you effectively need some sort of "macro language" for the test files, and you need to have a checksumming facility to verify all the data in your system at a given moment and flag discrepancies. Furthermore, these do need to be updated when new features are added (extra macros) or new state is introduced into your model (extra info in the checksums). For the amount of time, and developer tedium, this saves, though, I'd guess it's an investment well worth making for many development shops. It's not even as much work as it first sounds, because many apps are essentially event-driven or based on some sort of command pattern architecture anyway, which means you've already got most of the framework in place.

    Even with all of this in place, it's still quite possible to get bugs that are hard to find, though. Just because you know such a test failed, if that test was based on complicated processing, the fault could be anywhere within that process. Still, at least you can always look back at the overnight test records to pinpoint where something was checked in that caused the change.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    1. Re:Great idea, but not enough on its own by dubl-u · · Score: 2

      It sounds like y'all are doing better than about 80% of the industry. Congrats!

      But you should consider extending your test coverage further. Or, more accurately, testing smaller units.

      I look at it this way: when I'm forced to use a debugger, that means that I don't really know what the code is doing. I have hypotheses, of course. So instead of setting breakpoints and examining values, I just start adding tests to check the hypotheses.

      That way I get the benefit of my careful thinking not just when I'm in the debugger, but every time anybody runs the test suite.

      I'm not entirely convinced by the "test first" philosophy. That's always struck me as more of a political point than a practical one.

      You should give it a try, at least for a couple of weeks. It completely changes the experience of developing. But make sure to do it in very small increments: write a few lines of test, and then a few lines of production code to make it pass. Then repeat.

      The feeling of confidence it gives you in your code is incredible. It is also more fun; your day becomes a hundred small victories. And because you're always working from the tests, interruptions just aren't a big deal. And most people find that it substantially improves their OO design, too.

      Personally, I find it very practical. For something that's a page or two, I can just crank out the code and not worry about the tests. But for any serious project, I find the tests save me more time than they cost.

  259. Not quite by Anonymous Coward · · Score: 0

    We're talking about real developers here, not php monkeys.

  260. Features Needed - Esp. for inherited code by thebiss · · Score: 1

    I know when we're desinging apps from scratch we can take time to follow a methodology and test appropriately, but not everyone does, and if you've ever inherited a large codebase that you *MUST* fix and was neither well designed, tested, or even documented, some tools would be invaluable:

    - Memory leak detection. After 100K hits, Java and FastCGI's can both be a victim of this, and few tools detect it well. (And it's not as hard to write as you think!)

    - Flow navigation. Having once inherited 200K lines of broken, undocumented servlet spaghetti, I needed tools which would not only breakpoint, but graphically illustrate surrounding logic, active threads and active heap.
    There are static tools which do this, but none integrate directly into debuggers.

    - Model integration. If the app is small enough that you can add couts/printfs/printlns, this is overkill. If the app is 500K lines and has ~1000 classes, its very handy to see the design pattern of the classes containing the bug.

    - JVM/WAS/Apache/IIS integration, so modules may be monitored in-situ.

    --
    Beware: I believe all are created equal, and have the right to life, liberty, and the pursuit of happiness.