/* $Id: $ */ /** @file * * kProfile Mark 2 - Debug Info Reader, Internal Header. * * Copyright (c) 2006 knut st. osmundsen * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with This program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef __internal_DBGInternal_h__ #define __internal_DBGInternal_h__ #include "dbg.h" __BEGIN_DECLS /** * The debug module method table. */ typedef struct RTDBGMODOPS { /** The name of the reader. */ const char *pszName; /** * Closes the module. * * This should free all resources associated with the module * except the pMod which is freed by the caller. * * @returns IPRT status code. * @param pMod The module. */ DECLCALLBACKMEMBER(int, pfnClose)(PRTDBGMOD pMod); /** * Gets a symbol by segment:offset. * This will be approximated to the nearest symbol if there is no exact match. * * @returns IPRT status code. * @param pMod The module. * @param iSegment The segment this offset is relative to. * The -1 segment is special, it means that the addres is relative to * the image base. The image base is where the first bit of the image * is mapped during load. * @param off The offset into the segment. * @param pSym Where to store the symbol details. */ DECLCALLBACKMEMBER(int, pfnQuerySymbol)(PRTDBGMOD pMod, int32_t iSegment, RTUINTPTR off, PRTDBGSYMBOL pSym); /** * Gets a line number entry by segment:offset. * This will be approximated to the nearest line number there is no exact match. * * @returns IPRT status code. * @param pMod The module. * @param iSegment The segment this offset is relative to. * The -1 segment is special, it means that the addres is relative to * the image base. The image base is where the first bit of the image * is mapped during load. * @param off The offset into the segment. * @param pLine Where to store the line number details. */ DECLCALLBACKMEMBER(int, pfnQueryLine)(PRTDBGMOD pMod, int32_t iSegment, RTUINTPTR uOffset, PRTDBGLINE pLine); } RTDBGMODOPS; /** Pointer to a module method table. */ typedef RTDBGMODOPS *PRTDBGMODOPS; /** Pointer to a const module method table. */ typedef const RTDBGMODOPS *PCRTDBGMODOPS; /** * Internal representation of a debug module. */ typedef struct RTDBGMOD { /** Magic value (RTDBGMOD_MAGIC). */ uint32_t u32Magic; /** The handle to the module. (If closed, this is NIL_RTFILE.) */ RTFILE File; /** Pointer to the method table. */ PCRTDBGMODOPS pOps; } RTDBGMOD; /** The magic value for the debug module structure. (Some english writer) */ #define RTDBGMOD_MAGIC 0x00000000 /** The magic value of a dead module structure. */ #define RTDBGMOD_MAGIC_DEAD 0x00000000 int rtDbgModPEOpen(RTFILE File, RTFOFF offHdr, const char *pszModulePath, PRTDBGMOD *ppDbgMod); __END_DECLS #endif