As we soon will need to decode multiple raw traces for the same thread,
having a class that encapsulates the decoding of a single raw trace is
a stepping stone that will make the coming features easier to implement.
So, I'm creating a LibiptDecoder class with that purpose. I refactored
the code and it's now much more readable. Besides that, more comments
were added. With this new structure, it's also easier to implement unit
tests.
If this file is just a wrapper around Libipt and doesn’t have any context about how LLDB gets a trace (from the aux buffer or a file), should we rename it to ‘DecodeTrace’ and the caller is responsible for providing the trace data in a byte buffer?
In the case of in memory trace, the caller already has the byte buffer. In the case of a file, they could mmap the file and cast it to the appropriate type?