ETMv4 and PTM trace have a runtime option called "return stack". This is where the hardware saves potential return addresses from Branch+Link instructions onto a stack and uses the top of stack value if it matches for indirect branch instructions, rather than explicitly trace the branch value. This reduces the number of trace bytes in the stream.
If this option is active then the decoder must mirror the return stack from BL instructions and use it when it would ordinarily expect an explicitly traced address on an indirect branch instruction.
Mike Leach (8): opencsd: Add log message call to trace component base class. opencsd: new error type for return stack handling. opencsd: Add return stack object to library opencsd: Add return stack handling to PTM decoder opencsd: Add test trace snapshot for PTM return stack. opencsd: ETMv4 decoder: Implement trace return stack handling. opencsd: ETMv4 - juno add test snapshot for return stack testing opencsd: Update README and versions for v0.7
README.md | 14 +- decoder/build/linux/ref_trace_decode_lib/makefile | 1 + .../ref_trace_decode_lib.vcxproj | 2 + .../ref_trace_decode_lib.vcxproj.filters | 6 + decoder/include/common/trc_component.h | 8 + decoder/include/common/trc_ret_stack.h | 114 +++++++ decoder/include/etmv4/trc_pkt_decode_etmv4i.h | 5 + decoder/include/ocsd_if_types.h | 1 + decoder/include/ocsd_if_version.h | 4 +- decoder/include/ptm/trc_pkt_decode_ptm.h | 3 + decoder/source/etmv4/trc_pkt_decode_etmv4i.cpp | 64 +++- decoder/source/ocsd_error.cpp | 1 + decoder/source/ptm/trc_pkt_decode_ptm.cpp | 51 ++- decoder/source/trc_ret_stack.cpp | 106 ++++++ decoder/tests/snapshots/juno-ret-stck/cpu_0.ini | 16 + decoder/tests/snapshots/juno-ret-stck/cpu_1.ini | 16 + decoder/tests/snapshots/juno-ret-stck/cpu_2.ini | 16 + decoder/tests/snapshots/juno-ret-stck/cpu_3.ini | 16 + decoder/tests/snapshots/juno-ret-stck/cpu_4.ini | 16 + decoder/tests/snapshots/juno-ret-stck/cpu_5.ini | 16 + decoder/tests/snapshots/juno-ret-stck/cstrace.bin | Bin 0 -> 65536 bytes .../tests/snapshots/juno-ret-stck/device_10.ini | 18 ++ .../tests/snapshots/juno-ret-stck/device_11.ini | 18 ++ decoder/tests/snapshots/juno-ret-stck/device_6.ini | 18 ++ decoder/tests/snapshots/juno-ret-stck/device_7.ini | 18 ++ decoder/tests/snapshots/juno-ret-stck/device_8.ini | 18 ++ decoder/tests/snapshots/juno-ret-stck/device_9.ini | 18 ++ .../tests/snapshots/juno-ret-stck/kernel_dump.bin | Bin 0 -> 7340032 bytes decoder/tests/snapshots/juno-ret-stck/snapshot.ini | 20 ++ decoder/tests/snapshots/juno-ret-stck/trace.ini | 23 ++ decoder/tests/snapshots/trace_cov_a15/PTM_0_2.bin | Bin 0 -> 36 bytes decoder/tests/snapshots/trace_cov_a15/README.txt | 1 + decoder/tests/snapshots/trace_cov_a15/device1.ini | 357 +++++++++++++++++++++ decoder/tests/snapshots/trace_cov_a15/device2.ini | 129 ++++++++ decoder/tests/snapshots/trace_cov_a15/device3.ini | 129 ++++++++ decoder/tests/snapshots/trace_cov_a15/device4.ini | 129 ++++++++ decoder/tests/snapshots/trace_cov_a15/device5.ini | 89 +++++ decoder/tests/snapshots/trace_cov_a15/device6.ini | 89 +++++ .../trace_cov_a15/mem_Cortex-A15_0_0_VECTORS.bin | Bin 0 -> 632 bytes .../trace_cov_a15/mem_Cortex-A15_0_1_RO_CODE.bin | Bin 0 -> 6576 bytes .../trace_cov_a15/mem_Cortex-A15_0_2_RO_DATA.bin | Bin 0 -> 304 bytes .../trace_cov_a15/mem_Cortex-A15_0_3_RW_DATA.bin | Bin 0 -> 16 bytes .../trace_cov_a15/mem_Cortex-A15_0_4_ZI_DATA.bin | Bin 0 -> 576 bytes .../mem_Cortex-A15_0_5_ARM_LIB_HEAP.bin | Bin 0 -> 262144 bytes .../mem_Cortex-A15_0_6_ARM_LIB_STACK.bin | Bin 0 -> 65536 bytes .../trace_cov_a15/mem_Cortex-A15_0_7_IRQ_STACK.bin | Bin 0 -> 65536 bytes .../trace_cov_a15/mem_Cortex-A15_0_8_TTB.bin | Bin 0 -> 16384 bytes decoder/tests/snapshots/trace_cov_a15/snapshot.ini | 16 + decoder/tests/snapshots/trace_cov_a15/trace.ini | 24 ++ 49 files changed, 1569 insertions(+), 21 deletions(-) create mode 100644 decoder/include/common/trc_ret_stack.h create mode 100644 decoder/source/trc_ret_stack.cpp create mode 100644 decoder/tests/snapshots/juno-ret-stck/cpu_0.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/cpu_1.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/cpu_2.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/cpu_3.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/cpu_4.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/cpu_5.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/cstrace.bin create mode 100644 decoder/tests/snapshots/juno-ret-stck/device_10.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/device_11.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/device_6.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/device_7.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/device_8.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/device_9.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/kernel_dump.bin create mode 100644 decoder/tests/snapshots/juno-ret-stck/snapshot.ini create mode 100644 decoder/tests/snapshots/juno-ret-stck/trace.ini create mode 100644 decoder/tests/snapshots/trace_cov_a15/PTM_0_2.bin create mode 100644 decoder/tests/snapshots/trace_cov_a15/README.txt create mode 100644 decoder/tests/snapshots/trace_cov_a15/device1.ini create mode 100644 decoder/tests/snapshots/trace_cov_a15/device2.ini create mode 100644 decoder/tests/snapshots/trace_cov_a15/device3.ini create mode 100644 decoder/tests/snapshots/trace_cov_a15/device4.ini create mode 100644 decoder/tests/snapshots/trace_cov_a15/device5.ini create mode 100644 decoder/tests/snapshots/trace_cov_a15/device6.ini create mode 100644 decoder/tests/snapshots/trace_cov_a15/mem_Cortex-A15_0_0_VECTORS.bin create mode 100644 decoder/tests/snapshots/trace_cov_a15/mem_Cortex-A15_0_1_RO_CODE.bin create mode 100644 decoder/tests/snapshots/trace_cov_a15/mem_Cortex-A15_0_2_RO_DATA.bin create mode 100644 decoder/tests/snapshots/trace_cov_a15/mem_Cortex-A15_0_3_RW_DATA.bin create mode 100644 decoder/tests/snapshots/trace_cov_a15/mem_Cortex-A15_0_4_ZI_DATA.bin create mode 100644 decoder/tests/snapshots/trace_cov_a15/mem_Cortex-A15_0_5_ARM_LIB_HEAP.bin create mode 100644 decoder/tests/snapshots/trace_cov_a15/mem_Cortex-A15_0_6_ARM_LIB_STACK.bin create mode 100644 decoder/tests/snapshots/trace_cov_a15/mem_Cortex-A15_0_7_IRQ_STACK.bin create mode 100644 decoder/tests/snapshots/trace_cov_a15/mem_Cortex-A15_0_8_TTB.bin create mode 100644 decoder/tests/snapshots/trace_cov_a15/snapshot.ini create mode 100644 decoder/tests/snapshots/trace_cov_a15/trace.ini