1PT_INSN_ALLOC_DECODER(3) PT_INSN_ALLOC_DECODER(3)
2
3
4
6 pt_insn_alloc_decoder, pt_insn_free_decoder - allocate/free an Intel(R)
7 Processor Trace instruction flow decoder
8
10 #include <intel-pt.h>
11 struct pt_insn_decoder *
12 pt_insn_alloc_decoder(const struct pt_config *config);
13 void pt_insn_free_decoder(struct pt_insn_decoder *decoder);
14
15 Link with -lipt.
16
18 An instruction flow decoder decodes raw Intel Processor Trace (Intel
19 PT) into a sequence of instructions described by the pt_insn structure.
20 See pt_insn_next(3).
21
22 pt_insn_alloc_decoder() allocates a new instruction flow decoder and
23 returns a pointer to it. The config argument points to a pt_config ob‐
24 ject. See pt_config(3). The config argument will not be referenced by
25 the returned decoder but the trace buffer defined by the config argu‐
26 ment's begin and end fields will.
27
28 The returned instruction flow decoder needs to be synchronized onto the
29 trace stream before it can be used. To synchronize the instruction
30 flow decoder, use pt_insn_sync_forward(3), pt_insn_sync_backward(3), or
31 pt_insn_sync_set(3).
32
33 pt_insn_free_decoder() frees the Intel PT instruction flow decoder
34 pointed to by decoder. The decoder argument must be NULL or point to a
35 decoder that has been allocated by a call to pt_insn_alloc_decoder().
36
38 pt_insn_alloc_decoder() returns a pointer to a pt_insn_decoder object
39 on success or NULL in case of an error.
40
42 int foo(const struct pt_config *config) {
43 struct pt_insn_decoder *decoder;
44 errcode;
45
46 decoder = pt_insn_alloc_decoder(config);
47 if (!decoder)
48 return pte_nomem;
49
50 errcode = bar(decoder);
51
52 pt_insn_free_decoder(decoder);
53 return errcode;
54 }
55
57 pt_config(3), pt_insn_sync_forward(3), pt_insn_sync_backward(3), pt_in‐
58 sn_sync_set(3), pt_insn_get_offset(3), pt_insn_get_sync_offset(3),
59 pt_insn_get_image(3), pt_insn_set_image(3), pt_insn_get_config(3),
60 pt_insn_time(3), pt_insn_core_bus_ratio(3), pt_insn_next(3)
61
62
63
64 PT_INSN_ALLOC_DECODER(3)