Share via


PDATA Structures

9/7/2007

ARM, MIPS, and SH-4 device compilers use PDATA structures to aid in stack walking at run-time. This structure aids in debugging and exception processing.

The compilers associate one PDATA structure with each procedure.

The data structure is a table stored in a COFF .pdata section. The .pdata section contains an array of function table entries for exception handling, and is pointed to by the exception table entry in the image data directory.

The MIPS calling standard supports an uncompressed PDATA format, _IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY. In most cases, MIPSII currently uses an uncompressed 20 bytes for each function for the _IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY entry.

Leaf functions that do not have associated exception-handling routines do not have an associated pdata entry.

The following table shows the function table entry format for MIPSII images.

Offset Size Field Description

0

4

Begin Address

Virtual address of the corresponding function.

4

4

End Address

Virtual address of the end of the function.

8

4

Exception Handler

Pointer to the exception handler to be executed.

12

4

Handler Data

Pointer to additional information to be passed to the handler.

16

4

Prolog End Address

Virtual address of the end of the function prolog.

ARM and SH-4 Device compilers support a compressed PDATA structure, _IMAGE_CE_RUNTIME_FUNCTION_ENTRY.

The following table shows the COFF-specified function-table entry format used for the ARM and SH-4 hardware platforms.

Offset Size Field Description

0

4

Begin Address

Virtual address of the corresponding function.

4

8 bits

Prolog Length

Number of instructions in the function's prolog.

4

22 bits

Function Length

Number of instructions in the function.

4

1 bit

32-bit Flag

Set if the function is comprised of 32-bit instructions, cleared for a 16-bit function.

4

1 bit

Exception Flag

Set if an exception handler exists for the function.

If an exception handler exists or the function length is zero, an additional PDATA_EH structure precedes the function in the .text section. The function uses PDATA_EH when the function has an associated exception handler or handler data.

In most cases, PDATA structure occupies only eight bytes per function. For functions that have an exception handler, the PDATA_EHstructure requires an additional eight bytes.

The exception-handling data record and the prolog and function length record are guaranteed to be 4-byte aligned. This implies that any function associated with one or more of these records is 4-byte aligned.

See Also

Concepts

Virtual Unwinding