|
Packit |
b1f7ae |
% PT_ISCACHE_ALLOC(3)
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
! Copyright (c) 2015-2017, Intel Corporation
|
|
Packit |
b1f7ae |
!
|
|
Packit |
b1f7ae |
! Redistribution and use in source and binary forms, with or without
|
|
Packit |
b1f7ae |
! modification, are permitted provided that the following conditions are met:
|
|
Packit |
b1f7ae |
!
|
|
Packit |
b1f7ae |
! * Redistributions of source code must retain the above copyright notice,
|
|
Packit |
b1f7ae |
! this list of conditions and the following disclaimer.
|
|
Packit |
b1f7ae |
! * Redistributions in binary form must reproduce the above copyright notice,
|
|
Packit |
b1f7ae |
! this list of conditions and the following disclaimer in the documentation
|
|
Packit |
b1f7ae |
! and/or other materials provided with the distribution.
|
|
Packit |
b1f7ae |
! * Neither the name of Intel Corporation nor the names of its contributors
|
|
Packit |
b1f7ae |
! may be used to endorse or promote products derived from this software
|
|
Packit |
b1f7ae |
! without specific prior written permission.
|
|
Packit |
b1f7ae |
!
|
|
Packit |
b1f7ae |
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
Packit |
b1f7ae |
! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
Packit |
b1f7ae |
! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
Packit |
b1f7ae |
! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
Packit |
b1f7ae |
! LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
Packit |
b1f7ae |
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
Packit |
b1f7ae |
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
Packit |
b1f7ae |
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
Packit |
b1f7ae |
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
Packit |
b1f7ae |
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
Packit |
b1f7ae |
! POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
b1f7ae |
!-->
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
# NAME
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
pt_iscache_alloc, pt_iscache_free, pt_iscache_name - allocate/free a traced memory
|
|
Packit |
b1f7ae |
image section cache
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
# SYNOPSIS
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
| **\#include `<intel-pt.h>`**
|
|
Packit |
b1f7ae |
|
|
|
Packit |
b1f7ae |
| **struct pt_image_section_cache \*pt_iscache_alloc(const char \**name*);**
|
|
Packit |
b1f7ae |
| **const char \*pt_iscache_name(const struct pt_image_section_cache \**iscache*);**
|
|
Packit |
b1f7ae |
| **void pt_iscache_free(struct pt_image_section_cache \**iscache*);**
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
Link with *-lipt*.
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
# DESCRIPTION
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
**pt_iscache_alloc**() allocates a new *pt_image_section_cache* and returns a
|
|
Packit |
b1f7ae |
pointer to it. A *pt_image_section_cache* object contains a collection of file
|
|
Packit |
b1f7ae |
sections and the virtual addresses at which those sections were loaded.
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
The image sections can be added to one or more *pt_image* objects. The
|
|
Packit |
b1f7ae |
underlying file sections will be mapped once and their content will be shared
|
|
Packit |
b1f7ae |
across images.
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
The *name* argument points to an optional zero-terminated name string. If the
|
|
Packit |
b1f7ae |
*name* argument is NULL, it will be ignored and the returned
|
|
Packit |
b1f7ae |
*pt_image_section_cache* object will not have a name. Otherwise, the returned
|
|
Packit |
b1f7ae |
*pt_image_section_object* object will have a copy of the string pointed to by
|
|
Packit |
b1f7ae |
the *name* argument as name.
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
**pt_iscache_name**() returns the name of the *pt_image_section_cache* object
|
|
Packit |
b1f7ae |
the *iscache* argument points to.
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
**pt_iscache_free**() frees the *pt_image_section_cache* object pointed to by
|
|
Packit |
b1f7ae |
*iscache*. The *iscache* argument must be NULL or point to an image section
|
|
Packit |
b1f7ae |
cache that has been allocated by a call to **pt_iscache_alloc**().
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
# RETURN VALUE
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
**pt_iscache_alloc**() returns a pointer to a *pt_image_section_cache* object
|
|
Packit |
b1f7ae |
on success or NULL in case of an error.
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
**pt_iscache_name**() returns a pointer to a zero-terminated string of NULL if the
|
|
Packit |
b1f7ae |
image section cache does not have a name.
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
# EXAMPLE
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
~~~{.c}
|
|
Packit |
b1f7ae |
int foo(const char *name) {
|
|
Packit |
b1f7ae |
struct pt_image_section_cache *iscache;
|
|
Packit |
b1f7ae |
errcode;
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
image = pt_iscache_alloc(name);
|
|
Packit |
b1f7ae |
if (!iscache)
|
|
Packit |
b1f7ae |
return pte_nomem;
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
errcode = bar(iscache);
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
pt_iscache_free(iscache);
|
|
Packit |
b1f7ae |
return errcode;
|
|
Packit |
b1f7ae |
}
|
|
Packit |
b1f7ae |
~~~
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
# SEE ALSO
|
|
Packit |
b1f7ae |
|
|
Packit |
b1f7ae |
**pt_iscache_add_file**(3), **pt_image_add_cached**(3)
|