Re: [patch v4 00/13] branch tracing support for Atom

Jan Kratochvil
2012-11-27T15:36:26Z

On Tue, 27 Nov 2012 15:32:35 +0100, Jan Kratochvil wrote:
> On Tue, 27 Nov 2012 15:25:39 +0100, Metzger, Markus T wrote:
> > I would also expect problems with stepping, since we won't be able to fake
> > a back trace using branch trace data. I don't expect that commands like
> > reverse-next, next, and finish would work without special cases for btrace.
>
> It is true these commands implemented on btrace would need to disassemble x86*
> instructions (like reverse-execution does for the memory recording purpose),
> as you state backtrace is not available there which they depend upon.
> It would be a larger work.

When thinking about it you can "easily" create backtrace at any point in time
backwards as long as you check for call and ret instructions at each recorded
PC.

Then you would create virtual btrace frames similarly like inline-frame.c and
dwarf2-frame-tailcall.c do. Then the finish/reverse-finish/next/reverse-next
commands will work automatically from those virtual frames. One could even
give proper frame addresses (SP) to the frames thanks to CFI (.eh_frame) valid
at each instruction (as long as gcc -fasynchronous-unwind-tables is used).

This all could be acceptably fast with no additional overhead during recording.

Regards,
Jan