Aussie AI

Generalized Self-Testing Debug Wrappers

  • Book Excerpt from "Generative AI in C++"
  • by David Spuler, Ph.D.

Generalized Self-Testing Debug Wrappers

The technique of debug wrappers can be extended to offer a variety of self-testing and debug capabilities. The types of messages that can be emitted by debug wrappers include:

  • Input parameter validation failures (e.g. non-null)
  • Failure returns (e.g. allocation failures)
  • Common error usages
  • Informational tracing messages
  • Statistical tracking (e.g. call counts)

Personally, I've built some quite extensive debug wrapping layers over the years. It always surprises me that this can be beneficial, because it would be easier if it were done fully by the standard libraries of compiler vendors. The level of debugging checks has been increasing significantly (e.g. in GCC), but I still find value in adding my own wrappers.

There are several major areas where you can really self-check for a lot of problems with runtime debug wrappers:

  • File operations
  • Memory allocation
  • String operations

 

Next:

Up: Table of Contents

Buy: Generative AI in C++: Coding Transformers and LLMs

Generative AI in C++ The new AI programming book by Aussie AI co-founders:
  • AI coding in C++
  • Transformer engine speedups
  • LLM models
  • Phone and desktop AI
  • Code examples
  • Research citations

Get your copy from Amazon: Generative AI in C++