Store backtraces as lists of records rather than strings

This simplifies integration with python and is more future-proof.