PT_ISCACHE_ADD_FILE(3)
π NAME π
pt_iscache_add_file β bestie, this is the one that adds file sections to a traced memory image section cache β¨
πΈ SYNOPSIS πΈ
#include <intel-pt.h>
int pt_iscache_add_file(struct pt_image_section_cache *iscache,
const char *filename, uint64_t offset,
uint64_t size, uint64_t vaddr);
Link with -lipt.
π¦ DESCRIPTION π¦
okay so pt_iscache_add_file() takes a brand new section β literally size bytes, starting at offset inside filename, loaded at vaddr β and drops it into iscache. slay π
When it works? it hands you back a positive integer identifier that uniquely IDs the section you just added, inside that cache. no cap, that identifier is your new bestie because you can use it to:
- add sections from an image section cache to one or more traced memory images β go check
pt_image_add_cached(3)π«Ά and heads up, sections added from an image section cache get shared across images π - read memory from the cached section β see
pt_iscache_read(3)π
and the way this thing is lowkey smart: if the cache already contains a suitable section, it doesn't add anything, it just returns the identifier for the existing one. periodt. and if the cache already has a section that only differs in the load address, then a new section gets added that shares the underlying file section π§ shared file section, shared vibes.
β RETURN VALUE β
pt_iscache_add_file() returns a positive image section identifier when it's thriving, or a negative pt_error_code enumeration constant if it's giving error π
π ERRORS π
pte_invalidβ theiscacheorfilenameargument isNULL, or theoffsetargument is too big such that the section would start past the end of the file π (like, you can't start reading past the end of the file, babe, that's not a thing)
π₯ EXAMPLE π₯
int add_file(struct pt_image_section_cache *iscache, struct pt_image *image,
const char *filename, uint64_t offset, uint64_t size,
uint64_t vaddr, const struct pt_asid *asid) {
int isid;
isid = pt_iscache_add_file(iscache, filename, offset, size, vaddr);
if (isid < 0)
return isid;
return pt_image_add_cached(image, iscache, isid, asid);
}
π SEE ALSO π
pt_iscache_alloc(3), pt_iscache_free(3), pt_iscache_read(3), pt_image_add_cached(3)
ok that's the whole thing, you're so welcome π this was PT_ISCACHE_ADD_FILE(3) from the intel-pt (libipt) section 3 manual pages β mwah, kisses, go add some file sections bestie πβ¨πΈ
π¦ where this page comes from
- fedora 43: libipt-devel 2.1.2-3.fc43 Β· BSD-3-Clause
- fedora 43: libipt-devel 2.1.2-3.fc43 Β· BSD-3-Clause
- fedora 44: libipt-devel 2.1.2-4.fc44 Β· BSD-3-Clause
- fedora 44: libipt-devel 2.1.2-4.fc44 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms