O'Reilly logo

Memory Dump Analysis Anthology, Volume 7 by Dmitry Vostokov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Static Code Analysis Patterns

Loop Construct

Static program analysis141 is used to eliminate certain coding errors that may lead to abnormal software behavior. Therefore, it is naturally a part of software diagnostics but at source code level. Our goal here is to identify certain patterns directly linkable to patterns we see in memory dumps and software logs and collect them into a catalog. One such pattern candidate covers conditional and unconditional loops, for example, in one of modern languages:

extern bool soonToBeTrue;
int mediumValue = ...;

while (true)
{
  TRACE("Waiting");
  sleep(mediumValue);
  if (soonToBeTrue)
  {
    break;
  }
  doHeavyWork();
}

while (--pControl->aFewPasses)
{
  TRACE("Waiting");
  sleep(mediumValue);
  doHeavyWork();
}

Such ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required