Add a 'trace' mode (must be enabled at build time) that saves the