Pin
Loading...
Searching...
No Matches
Enumerations | Functions

Enumerations

enum  SEC_TYPE {
  SEC_TYPE_INVALID ,
  SEC_TYPE_UNUSED ,
  SEC_TYPE_REGREL ,
  SEC_TYPE_DYNREL ,
  SEC_TYPE_EXEC ,
  SEC_TYPE_DATA ,
  SEC_TYPE_DYNAMIC ,
  SEC_TYPE_OPD ,
  SEC_TYPE_GOT ,
  SEC_TYPE_STACK ,
  SEC_TYPE_PLTOFF ,
  SEC_TYPE_HASH ,
  SEC_TYPE_LSDA ,
  SEC_TYPE_UNWIND ,
  SEC_TYPE_UNWINDINFO ,
  SEC_TYPE_REGSYM ,
  SEC_TYPE_DYNSYM ,
  SEC_TYPE_DEBUG ,
  SEC_TYPE_BSS ,
  SEC_TYPE_SYMSTR ,
  SEC_TYPE_DYNSTR ,
  SEC_TYPE_SECSTR ,
  SEC_TYPE_COMMENT ,
  SEC_TYPE_LOOS ,
  SEC_TYPE_USER ,
  SEC_TYPE_PROC ,
  SEC_TYPE_LAST
}
 

Functions

IMG SEC_Img (SEC sec)
 
SEC SEC_Next (SEC sec)
 
SEC SEC_Prev (SEC sec)
 
SEC SEC_Invalid ()
 
BOOL SEC_Valid (SEC sec)
 
RTN SEC_RtnHead (SEC sec)
 
RTN SEC_RtnTail (SEC sec)
 
const std::string & SEC_Name (SEC sec)
 
SEC_TYPE SEC_Type (SEC sec)
 
BOOL SEC_Mapped (SEC sec)
 
const VOID * SEC_Data (SEC sec)
 
ADDRINT SEC_Address (SEC sec)
 
BOOL SEC_IsReadable (SEC sec)
 
BOOL SEC_IsWriteable (SEC sec)
 
BOOL SEC_IsExecutable (SEC sec)
 
USIZE SEC_Size (SEC sec)
 

Detailed Description

A SEC is modeled after the sections found inside elf images. Can be accessed at instrumentation time and analysis time.

SECs can be mapped or unmapped, a mapped SEC occupies address space inside the IMG. Unmapped SECs often contain debug and relocation information.
APIs from this group are available in any thread, including any internal thread spawned by the tool.

Iteration idioms:

// Forward pass over all sections in an image
for( SEC sec= IMG_SecHead(img); SEC_Valid(sec); sec = SEC_Next(sec) )
// Reverse pass over all sections in animage
for( SEC sec= IMG_SecTail(img); SEC_Valid(sec); sec = SEC_Prev(sec) )
SEC IMG_SecHead(IMG img)
Returns the first section in the image.
SEC IMG_SecTail(IMG img)
Returns the last section in the image.
SEC SEC_Next(SEC sec)
Returns the section that follows the given section, or SEC_Invalid() if it is last.
BOOL SEC_Valid(SEC sec)
Checks if the section is valid.
SEC SEC_Prev(SEC sec)
Returns the previous section, or SEC_Invalid() if this is the first in the image.
Availability:
Mode: JIT & Probe
O/S: Linux & Windows
CPU: All

Enumeration Type Documentation

◆ SEC_TYPE

enum SEC_TYPE

This file contains SEC: Section Object and Mapping primitives

SEC types

Enumerator
SEC_TYPE_REGREL 

relocations

SEC_TYPE_DYNREL 

dynamic relocations

SEC_TYPE_EXEC 

contains code

SEC_TYPE_DATA 

contains initialized data

SEC_TYPE_DYNAMIC 

Dynamic linking information (.dynamic)

SEC_TYPE_OPD 

contains the official procedure descriptors.

SEC_TYPE_GOT 

Global offset table.

SEC_TYPE_STACK 

Stack segment.

SEC_TYPE_PLTOFF 

The procedure linking table.

SEC_TYPE_HASH 

A symbol hash table.

SEC_TYPE_LSDA 

old exception_info (obsolete)

SEC_TYPE_UNWIND 

Stack unwind information. (exception handling)

SEC_TYPE_UNWINDINFO 

Stack unwind information. (exception handling)

SEC_TYPE_REGSYM 

Static symbol table (.symtab)

SEC_TYPE_DYNSYM 

Dynamic linking symbol table.

SEC_TYPE_DEBUG 

Contains debugging information.

SEC_TYPE_BSS 

contains uninitialized data

SEC_TYPE_SYMSTR 

String table section (.strtab)

SEC_TYPE_DYNSTR 

Dynamic linking string table (.dynstr)

SEC_TYPE_SECSTR 

Section header string table. (.shstrtab)

SEC_TYPE_COMMENT 

contains version control information.

SEC_TYPE_LOOS 

OS specific.

SEC_TYPE_USER 

Application specific.

SEC_TYPE_PROC 

Processor specific.

Function Documentation

◆ SEC_Address()

ADDRINT SEC_Address ( SEC  sec)
extern

Returns the address in memory of the section.

If image is loaded by system loader, the real virtual address of section will be returned. If the image is mapped by IMG_Open() the address will be inside the mapped image. On Unix, if the section is not loadable, 0 will be returned in the both cases.

Parameters
[in]secThe section object
Returns
Address in memory of sec

◆ SEC_Data()

const VOID * SEC_Data ( SEC  sec)
extern

Returns a pointer to the raw data for the section.

On Linux, Pin maps the whole image file for processing. The pointer returned by SEC_Data() points inside the mapped file. Note, SEC_Data() pointer is always between IMG_StartAddress() and IMG_StartAddress() + IMG_SizeMapped(). If you are analyzing image in image-load callback, please remember that the image will be unmapped after the callback returns and the pointer provided by SEC_Data() becomes invalid. If you are working with IMG_Open() the pointer is valid until IMG_Close().

If section does not have raw data the function returns 0.

Parameters
[in]secThe section object
Returns
Return a pointer to the raw data for the section
Availability:
Mode: JIT & Probe
O/S: Linux, Windows
CPU: All

◆ SEC_Img()

IMG SEC_Img ( SEC  sec)
extern

Returns the image that contains this section.

Parameters
[in]secThe section object
Returns
Image that contains this section
Availability:
Mode: JIT & Probe
O/S: Linux, Windows
CPU: All

◆ SEC_Invalid()

SEC SEC_Invalid ( )
extern

Returns an invalid section value.

Returns
Invalid section value
Availability:
Mode: JIT & Probe
O/S: Linux, Windows
CPU: All

◆ SEC_IsExecutable()

BOOL SEC_IsExecutable ( SEC  sec)
extern

Checks if the section is executable.

Parameters
[in]secThe section object
Returns
TRUE if section is executable

◆ SEC_IsReadable()

BOOL SEC_IsReadable ( SEC  sec)
extern

Checks if the section is readable.

Parameters
[in]secThe section object
Returns
TRUE if section is readable

◆ SEC_IsWriteable()

BOOL SEC_IsWriteable ( SEC  sec)
extern

Checks if the section is writable.

Parameters
[in]secThe section object
Returns
TRUE if section is writable

◆ SEC_Mapped()

BOOL SEC_Mapped ( SEC  sec)
extern

Checks if section is mapped in memory.

Parameters
[in]secThe section object
Returns
True if section is mapped in memory, unmapped section contain data not needed at run time, like debug information
Availability:
Mode: JIT & Probe
O/S: Linux, Windows
CPU: All

◆ SEC_Name()

const std::string & SEC_Name ( SEC  sec)
extern

Returns the section name.

Parameters
[in]secThe section object
Returns
Section name
Availability:
Mode: JIT & Probe
O/S: Linux, Windows
CPU: All

◆ SEC_Next()

SEC SEC_Next ( SEC  sec)
extern

Returns the section that follows the given section, or SEC_Invalid() if it is last.

Parameters
[in]secThe section object
Returns
Section that follows sec, or SEC_Invalid() is sec is last section in the image
Availability:
Mode: JIT & Probe
O/S: Linux, Windows
CPU: All

◆ SEC_Prev()

SEC SEC_Prev ( SEC  sec)
extern

Returns the previous section, or SEC_Invalid() if this is the first in the image.

Parameters
[in]secThe section object
Returns
Previous section of sec, or SEC_Invalid() if sec is the first in the image
Availability:
Mode: JIT & Probe
O/S: Linux, Windows
CPU: All

◆ SEC_RtnHead()

RTN SEC_RtnHead ( SEC  sec)
extern

Returns the first RTN of the section, or RTN_Invalid() if no RTNs.

Parameters
[in]secThe section object
Returns
First RTN of sec, or RTN_Invalid() if no RTNs
Availability:
Mode: JIT & Probe
O/S: Linux, Windows
CPU: All

◆ SEC_RtnTail()

RTN SEC_RtnTail ( SEC  sec)
extern

Returns the last RTN of the section, or RTN_Invalid() if no RTNs.

Parameters
[in]secThe section object
Returns
Last RTN of sec, or RTN_Invalid() if no RTNs
Availability:
Mode: JIT & Probe
O/S: Linux, Windows
CPU: All

◆ SEC_Size()

USIZE SEC_Size ( SEC  sec)
extern

Returns the size of the section.

Parameters
[in]secThe section object
Returns
Size of section

◆ SEC_Type()

SEC_TYPE SEC_Type ( SEC  sec)
extern

Returns the section type.

Parameters
[in]secThe section object
Returns
Section type
Availability:
Mode: JIT & Probe
O/S: Linux, Windows
CPU: All

◆ SEC_Valid()

BOOL SEC_Valid ( SEC  sec)
extern

Checks if the section is valid.

Parameters
[in]secThe section object to check
Returns
True if sec is not SEC_Invalid()
Availability:
Mode: JIT & Probe
O/S: Linux, Windows
CPU: All