getsentry / pdb

A parser for Microsoft PDB (Program Database) debugging information
https://docs.rs/pdb/
Apache License 2.0
400 stars 71 forks source link

Implement support for S_TRAMPOLINE #126

Closed jan-auer closed 2 years ago

jan-auer commented 2 years ago

The definition is sourced from microsoft-pdb:

typedef enum TRAMP_e {      // Trampoline subtype
    trampIncremental,           // incremental thunks
    trampBranchIsland,          // Branch island thunks
} TRAMP_e;

typedef struct TRAMPOLINESYM {  // Trampoline thunk symbol
    unsigned short  reclen;     // Record length
    unsigned short  rectyp;     // S_TRAMPOLINE
    unsigned short  trampType;  // trampoline sym subtype
    unsigned short  cbThunk;    // size of the thunk
    CV_uoff32_t     offThunk;   // offset of the thunk
    CV_uoff32_t     offTarget;  // offset of the target of the thunk
    unsigned short  sectThunk;  // section index of the thunk
    unsigned short  sectTarget; // section index of the target of the thunk
} TRAMPOLINE;

The test comes from the last trampoline symbol in https://github.com/mstange/pdb-addr2line/issues/52#issuecomment-1130225425.

Fixes https://github.com/willglynn/pdb/issues/123

mstange commented 2 years ago

Thank you!