libipt: remove pt_check_sync()

The pt_check_sync() function is used in pt_query.c to check whether the decoder
is synchronized.  This property is also implicitly checked in
pt_fetch_decoder(), which is called directly after the respective
pt_check_sync() calls.

Remove pt_check_sync().

Change-Id: Ia5a5929927e4a0c48a11ed4576a9dc1c41895714
Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
ptunit-query: add sub-test to cut off the trace buffer

Some tests require that the last encoded packet is cut off by adjusting the size
of the decoder's PT buffer.

Implement this as a sub-test.

Change-Id: Iea7cf293bb50a3ea9cd720fa3b18f32521d30510
Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
libipt: decode PSB when starting the query interface

In pt_query_start(), we call pt_read_header() to read the PSB+ header.  This is
just what the PSB decoder function's decode() method would do.

Use this, instead, to reduce the number of pt_read_header() users.

Change-Id: I7bf04cd06bb681b095931ed6bf03e8f9716ab3cd
Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
libipt: make pt_read_header() static

pt_read_header() is only used in pt_packet_decode.c, where it is defined.

Declare it static, and rename it.  We also need to move it.

Change-Id: I3a6fb261c7c15bf21737d9ceab2b632c4a278754
Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
ptunit-query: remove time test fixture

The time test fixture is really testing pt_read_ahead().

Remove it.

Change-Id: I7e57bd83f9caa68c3b33fc5dbb84f238b71774e9
Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
ptunit-query: rewrite tsc test

The tsc test generates a TSC packet followed by a query-relevant packet to make
pt_read_ahead() process the TSC packet.

Just set the decoder's tsc field, instead, to avoid using pt_read_ahead().

Change-Id: Ic8945314932c26aea7083092d568d8531a880d48
Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
libipt: make pt_read_ahead() static

pt_read_ahead() is only used in pt_query.c.

Move it there and declare it static.

Change-Id: If14500f73675b7124c7602121a9071619cd48a18
Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>