Questions tagged [debugging]

Debugging is the process of examining the state of a program - generally with a debugging tool - while it is running and attempting to find bugs that cause it to behave abnormally.

Questions on the following subjects about "debugging" are accepted:

  • The "debugging" phase itself
  • Debugging techniques/skills
  • How best to debug a given application, be precise in what seems to be the problem (distributed application, concurrent debugging, etc.)
  • When (not) to use a debugger in a given context ; again, be precise.

According to Wikipedia, there is a controversy on the origin of the "debugging" word:

The terms "bug" and "debugging" are both popularly attributed to Admiral Grace Hopper in the 1940s. However the term "bug" in the meaning of technical error dates back at least to 1878 and Thomas Edison and "debugging" seems to have been used as a term in aeronautics before entering the world of computers. Indeed, in an interview Grace Hopper remarked that she was not coining the term. The moth fit the already existing terminology, so it was saved.

We don't need any more questions on the origin of the term or definition of bug "types".

252 questions
105
votes
21 answers

What's the benefit of avoiding the use of a debugger?

Over the course of my career, I've noticed that some developers don't use debugging tools, but do spot checking on erroneous code to figure out what the problem is. While many times being able to quickly find errors in code without a debugger is a…
Jonathan DS
  • 460
  • 2
  • 6
  • 15
64
votes
5 answers

Why is reverse debugging rarely used?

gdb implemented support for reverse debugging in 2009 (with gdb 7.0). I never heard about it until 2012. Now I find it extremely useful for certain types of debugging problems. I wished that I heard of it before. Correct me if I'm wrong but my…
42
votes
8 answers

Should debug code be left in place, always, or added only when debugging and removed when the bug has been found?

I, for one, only add debug code (such as print statements) when I'm trying to locate a bug. And once I've found it, I remove the debug code (and add a test case which specifically tests for that bug). I feel that it's cluttering the real code and…
gablin
  • 17,407
35
votes
8 answers

How to most effectively debug code?

Bugs creeping into code can be minimized, but not entirely eliminated as it is written - programmers are, although many would disagree, only humans. When we do detect an error in our code, what can we do to weed it out? How should we approach it to…
gablin
  • 17,407
29
votes
13 answers

How to improve your ability to debug existing code

A common task in the working world is dealing with existing, but buggy code. What are some tips to improve your skills as a debugger?
GSto
  • 8,531
24
votes
16 answers

Are debugging skills important to become a good programmer?

Along with the other qualities should a programmer need good debugging skills? If I have an applicant who was not able to find the error in the given program, but was able to solve all puzzles and programs, should I consider him for the job? EDIT…
Manoj R
  • 4,076
17
votes
4 answers

How do I isolate difficult to reproduce bugs?

There's a bug in my program. Doesn't really matter what the platform is. Every so often, a row in a ListView is the wrong color. I tried setting a watchpoint for the variable that is supposed to dictate the color of the row, and it doesn't change...…
16
votes
15 answers

Real programmers use debuggers?

If experienced programmers actually ever use debuggers, and if so under what circumstances. Although in the answer to that question I said "months" ago I probably meant "years" - I really don't use a debugger. So my specific answerable question is…
Neil Butterworth
  • 4,066
  • 3
  • 23
  • 28
13
votes
3 answers

Is printing to console/stdout a good debugging strategy?

Let's say we have a function like this: public void myStart() { for (int i = 0; i<10; i++) myFunction(i); } private int myFunction(int a) { a = foo(a); a = bar(a); return a; } private int foo(int a) { //do something here …
dwjohnston
  • 2,553
12
votes
3 answers

Are there any theories or books about how to debug "in general"?

I read and studied a lot of computer science and engineering and I rarely or never seen a book about debugging or a theory how to debug (though I surely developed some debugging theories of my own). Are there any debugging theories and/or books? Why…
Niklas Rosencrantz
  • 8,068
  • 17
  • 57
  • 96
12
votes
14 answers

Can we guarantee a program will never go wrong?

We have a system here. Recently there is a wrong calculation in one of the number in the report generated by the system. Through out our experience, we've never encounter any problem/error in this system for some years. Because the writer of this…
lamwaiman1988
  • 1,483
  • 2
  • 16
  • 22
11
votes
5 answers

Tips for debugging with very little info?

I've inherited a project with a fairly large codebase, and the original developer rarely, if ever, replies to emails. There's a ton of different ways to do some things in it, and I don't know all of them. A lot of duplicated code along these paths…
Tarka
  • 1,588
7
votes
7 answers

What should I learn more about debugging?

To debug my programs I mainly use the following methods: Use printf (or equivalent in other languages) to check the value of a variable after a particular statement or to check whether the program enters a conditional statement or a loop. Use…
Cracker
  • 3,183
6
votes
3 answers

How do I fix an "emergent" bug?

I'm writing a PDE solver, and I have a bug that only shows up in very large test cases. That is, with small grids the program gives correct answers, but there's a large amount of unaccounted-for error (I've accounted for roundoff, discretization,…
Dan
  • 395
  • 4
  • 14
5
votes
8 answers

Bug fixing approach

I have been working on a database project, and I recently received a bug report for the remote execution of some queries. Usually, you try to find out the actual cause for the bug to occur and then fix it. But sometimes what I do when I'm fed up of…
Shirish11
  • 1,469
  • 10
  • 22
1
2