Frogtoss Labs - title image with flowers

List of App Auditing Tools

Last update: December 30th, 2018

Windows Tools and Environment Setup

Linux Tools

  • Valgrind
  • Helgrind (A Valgrind tool. Specify --tool=helgrind). It will detect synchronisation errors.
  • Clang analyzer Must be built from source. Includes clang-format which is useful.

Mac Tools

  • OS X Graphics Tools (A separate download nowadays)
  • Clang analyzer Includes other binaries including clang-format.

Thread Accounting

Windows Performance Toolkit can discover who owns a thread.

Process Explorer can be used to inspect threads. Use the stack button to see the thread stack update on sample interval.

LLDB has two commands which can be run at a breakpoint:

  • thread list
  • bt all

CPU Profiling

Graphics Profiling

  • mac OpenGL Driver Monitor (part of OS X graphics tools)
  • win MSVCRT alloc check
  • Texture usage
  • OpenGL
    • win and linux GDebugger
    • mac OpenGL Profiler (does not sort by largest texture though)

Memory Leak

Memory Alloc Tracing

  • cocoa/OS X environment variables. Some notable ones:
    • NSDebugEnabled — turns on extra debug information in Foundation
    • NSZombieEnabled — notifies when messages are incorrectly sent to deallocated objects.
    • MallocStackLogging — Record all methods that call a specific variable as args. Using console, you can have a backtrace using command malloc_history.

Miscellaneous Accountability

  • win Process Explorer functionality:
  • Dump strings
  • Review memory mapped files
  • Confirm whether DEP is on by adding Data Execution Prevention column

DLL Associations

  • win Dependency Walker. Some things to look for:
    • Confirm no non-Microsoft DLLs outside of executable cwd. (ex: python26.dll in system directory).
    • Confirm only one CRT dependency (no need for MSVCRT80 and MSVCRT90)
    • Profile and sort by file size
  • llvm toolchain Some LLDB commands:
    • Get a list of all loaded modules. target modules list
    • Dump the symtable from all target modules. target modules dump symtab
    • Find out why a function is included - win Process Explorer functionality:
    • Dump strings
    • Review memory mapped files
    • Confirm whether DEP is on by adding Data Execution Prevention column

in the modules list. target modules lookup --address

Static Analyzers

  • Visual Studio /analyze
  • Clang --analyze
    • Use -Xanalyzer -analyzer-output=text to get an explanation of what’s actually going on.
  • CPPCheck

Runtime Analyzers

Gotchas and unexpected events

  • Clang and GCC -Wall does NOT warn if a member variable is uninitialized in a constructor.
  • As of late 2013, many of the -fsanitize options to Clang are not stable on the latest Xcode and OS X.

Materials