1PT_ISCACHE_ADD_FILE(3)                                  PT_ISCACHE_ADD_FILE(3)
2
3
4

NAME

6       pt_iscache_add_file  -  add file sections to a traced memory image sec‐
7       tion cache
8

SYNOPSIS

10       #include <intel-pt.h>
11       int pt_iscache_add_file(struct pt_image_section_cache *iscache,
12                               const char *filename, uint64_t offset,
13                               uint64_t size, uint64_t vaddr);
14
15       Link with -lipt.
16

DESCRIPTION

18       pt_iscache_add_file() adds a  new  section  consisting  of  size  bytes
19       starting at offset in filename loaded at vaddr to iscache.
20
21       On success, pt_iscache_add_file() returns a positive integer identifier
22       that uniquely identifies the added section in that cache.  This identi‐
23       fier  can be used to add sections from an image section cache to one or
24       more traced memory images.  See pt_image_add_cached(3).  Sections added
25       from  an image section cache will be shared across images.  It can also
26       be  used  to  read  memory  from  the  cached  section.    See   pt_is‐
27       cache_read(3).
28
29       If  the  cache already contains a suitable section, no section is added
30       and the identifier for the existing section is returned.  If the  cache
31       already contains a section that only differs in the load address, a new
32       section is added that shares the underlying file section.
33

RETURN VALUE

35       pt_iscache_add_file() returns a positive image  section  identifier  on
36       success  or a negative pt_error_code enumeration constant in case of an
37       error.
38

ERRORS

40       pte_invalid
41              The iscache or filename argument is NULL or the offset  argument
42              is too big such that the section would start past the end of the
43              file.
44

EXAMPLE

46              int add_file(struct pt_image_section_cache *iscache, struct pt_image *image,
47                           const char *filename, uint64_t offset, uint64_t size,
48                           uint64_t vaddr, const struct pt_asid *asid) {
49                  int isid;
50
51                  isid = pt_iscache_add_file(iscache, filename, offset, size, vaddr);
52                  if (isid < 0)
53                     return isid;
54
55                  return pt_image_add_cached(image, iscache, isid, asid);
56              }
57

SEE ALSO

59       pt_iscache_alloc(3),  pt_iscache_free(3),  pt_iscache_read(3),   pt_im‐
60       age_add_cached(3)
61
62
63
64                                                        PT_ISCACHE_ADD_FILE(3)
Impressum