It is true that cause and effect aren't simple. But that doesn't mean that making the effort isn't amply rewarded.

For instance, it has been repeatedly found that most bugs are found in a small fraction of the code. Research at IBM demonstrated that it is very worthwhile to measure discovered bugs/line of code in different modules, and pre-emptively rewrite any that are particularly buggy. They found that rewriting a small fraction of the software dramatically reduces ongoing maintainance costs.

That's a pretty big return on the simple bookkeeping effort of keeping track of which function a given bug was traced back to, and then computing simple statistics on that.

For another demonstration of the value of proactively dealing with bugs, look at OpenBSD. The secret of their security record is simple - any time they find a bug they reflect on the underlying mistake for that bug and then search their entire code base for similar mistakes. The results speak for themselves.

Cheers,
Ben