#endif
-#ifdef TRANSLATE_PDB
-
-/* these are protected */
-
-AddrMap* emitter::emitPDBOffsetTable = 0;
-LocalMap* emitter::emitPDBLocalTable = 0;
-bool emitter::emitIsPDBEnabled = true;
-BYTE* emitter::emitILBaseOfCode = 0;
-BYTE* emitter::emitILMethodBase = 0;
-BYTE* emitter::emitILMethodStart = 0;
-BYTE* emitter::emitImgBaseOfCode = 0;
-
-void emitter::MapCode(int ilOffset, BYTE* imgDest)
-{
- if (emitIsPDBEnabled)
- {
- emitPDBOffsetTable->MapSrcToDest(ilOffset, (int)(imgDest - emitImgBaseOfCode));
- }
-}
-
-void emitter::MapFunc(int imgOff,
- int procLen,
- int dbgStart,
- int dbgEnd,
- short frameReg,
- int stkAdjust,
- int lvaCount,
- OptJit::LclVarDsc* lvaTable,
- bool framePtr)
-{
- if (emitIsPDBEnabled)
- {
- // this code stores information about local symbols for the PDB translation
-
- assert(lvaCount >= 0); // don't allow a negative count
-
- LvaDesc* rgLvaDesc = 0;
-
- if (lvaCount > 0)
- {
- rgLvaDesc = new LvaDesc[lvaCount];
-
- if (!rgLvaDesc)
- {
- NOMEM();
- }
-
- LvaDesc* pDst = rgLvaDesc;
- OptJit::LclVarDsc* pSrc = lvaTable;
- for (int i = 0; i < lvaCount; ++i, ++pDst, ++pSrc)
- {
- pDst->slotNum = pSrc->lvSlotNum;
- pDst->isReg = pSrc->lvRegister;
- pDst->reg = (pSrc->lvRegister ? pSrc->lvRegNum : frameReg);
- pDst->off = pSrc->lvStkOffs + stkAdjust;
- }
- }
-
- emitPDBLocalTable->AddFunc((int)(emitILMethodBase - emitILBaseOfCode), imgOff - (int)emitImgBaseOfCode, procLen,
- dbgStart - imgOff, dbgEnd - imgOff, lvaCount, rgLvaDesc, framePtr);
- // do not delete rgLvaDesc here -- responsibility is now on emitPDBLocalTable destructor
- }
-}
-
-/* these are public */
-
-void emitter::SetILBaseOfCode(BYTE* pTextBase)
-{
- emitILBaseOfCode = pTextBase;
-}
-
-void emitter::SetILMethodBase(BYTE* pMethodEntry)
-{
- emitILMethodBase = pMethodEntry;
-}
-
-void emitter::SetILMethodStart(BYTE* pMethodCode)
-{
- emitILMethodStart = pMethodCode;
-}
-
-void emitter::SetImgBaseOfCode(BYTE* pTextBase)
-{
- emitImgBaseOfCode = pTextBase;
-}
-
-void emitter::SetIDBaseToProlog()
-{
- emitInstrDescILBase = (int)(emitILMethodBase - emitILBaseOfCode);
-}
-
-void emitter::SetIDBaseToOffset(int methodOffset)
-{
- emitInstrDescILBase = methodOffset + (int)(emitILMethodStart - emitILBaseOfCode);
-}
-
-void emitter::DisablePDBTranslation()
-{
- // this function should disable PDB translation code
- emitIsPDBEnabled = false;
-}
-
-bool emitter::IsPDBEnabled()
-{
- return emitIsPDBEnabled;
-}
-
-void emitter::InitTranslationMaps(int ilCodeSize)
-{
- if (emitIsPDBEnabled)
- {
- emitPDBOffsetTable = AddrMap::Create(ilCodeSize);
- emitPDBLocalTable = LocalMap::Create();
- }
-}
-
-void emitter::DeleteTranslationMaps()
-{
- if (emitPDBOffsetTable)
- {
- delete emitPDBOffsetTable;
- emitPDBOffsetTable = 0;
- }
- if (emitPDBLocalTable)
- {
- delete emitPDBLocalTable;
- emitPDBLocalTable = 0;
- }
-}
-
-void emitter::InitTranslator(PDBRewriter* pPDB, int* rgSecMap, IMAGE_SECTION_HEADER** rgpHeader, int numSections)
-{
- if (emitIsPDBEnabled)
- {
- pPDB->InitMaps(rgSecMap, // new PE section header order
- rgpHeader, // array of section headers
- numSections, // number of sections
- emitPDBOffsetTable, // code offset translation table
- emitPDBLocalTable); // slot variable translation table
- }
-}
-
-#endif // TRANSLATE_PDB
-
/*****************************************************************************/
#if EMITTER_STATS
instrDescDebugInfo* info = (instrDescDebugInfo*)emitGetMem(sizeof(*info));
- info->idNum = emitInsCount;
- info->idSize = sz;
- info->idVarRefOffs = 0;
- info->idMemCookie = 0;
-#ifdef TRANSLATE_PDB
- info->idilStart = emitInstrDescILBase;
-#endif
+ info->idNum = emitInsCount;
+ info->idSize = sz;
+ info->idVarRefOffs = 0;
+ info->idMemCookie = 0;
info->idFinallyCall = false;
info->idCatchRet = false;
info->idCallSig = nullptr;
#include "jitgcinfo.h"
/*****************************************************************************/
-#ifdef TRANSLATE_PDB
-#ifndef _ADDRMAP_INCLUDED_
-#include "addrmap.h"
-#endif
-#ifndef _LOCALMAP_INCLUDED_
-#include "localmap.h"
-#endif
-#ifndef _PDBREWRITE_H_
-#include "pdbrewrite.h"
-#endif
-#endif // TRANSLATE_PDB
-
-/*****************************************************************************/
#ifdef _MSC_VER
#pragma warning(disable : 4200) // allow arrays of 0 size inside structs
#endif
struct instrDescDebugInfo
{
- unsigned idNum;
- size_t idSize; // size of the instruction descriptor
- unsigned idVarRefOffs; // IL offset for LclVar reference
- size_t idMemCookie; // for display of method name (also used by switch table)
-#ifdef TRANSLATE_PDB
- unsigned int idilStart; // instruction descriptor source information for PDB translation
-#endif
+ unsigned idNum;
+ size_t idSize; // size of the instruction descriptor
+ unsigned idVarRefOffs; // IL offset for LclVar reference
+ size_t idMemCookie; // for display of method name (also used by switch table)
bool idFinallyCall; // Branch instruction is a call to finally
bool idCatchRet; // Instruction is for a catch 'return'
CORINFO_SIG_INFO* idCallSig; // Used to report native call site signatures to the EE
#endif // FEATURE_EH_FUNCLETS
-/************************************************************************/
-/* Members and methods used in PDB translation */
-/************************************************************************/
-
-#ifdef TRANSLATE_PDB
-
- void MapCode(int ilOffset, BYTE* imgDest);
- void MapFunc(int imgOff,
- int procLen,
- int dbgStart,
- int dbgEnd,
- short frameReg,
- int stkAdjust,
- int lvaCount,
- OptJit::LclVarDsc* lvaTable,
- bool framePtr);
-
-private:
- int emitInstrDescILBase; // code offset of IL that produced this instruction desctriptor
- int emitInstrDescILBase; // code offset of IL that produced this instruction desctriptor
- static AddrMap* emitPDBOffsetTable; // translation table for mapping IL addresses to native addresses
- static LocalMap* emitPDBLocalTable; // local symbol translation table
- static bool emitIsPDBEnabled; // flag to disable PDB translation code when a PDB is not found
- static BYTE* emitILBaseOfCode; // start of IL .text section
- static BYTE* emitILMethodBase; // beginning of IL method (start of header)
- static BYTE* emitILMethodStart; // beginning of IL method code (right after the header)
- static BYTE* emitImgBaseOfCode; // start of the image .text section
-
-#endif
-
/************************************************************************/
/* Methods to record a code position and later convert to offset */
/************************************************************************/