| 1 | /* $Id: $ */
|
|---|
| 2 | /** @file
|
|---|
| 3 | *
|
|---|
| 4 | * kProfile Mark 2 - Debug Info Reader, Internal Header.
|
|---|
| 5 | *
|
|---|
| 6 | * Copyright (c) 2006 knut st. osmundsen <bird-src-spam@anduin.net.de>
|
|---|
| 7 | *
|
|---|
| 8 | *
|
|---|
| 9 | * This program is free software; you can redistribute it and/or modify
|
|---|
| 10 | * it under the terms of the GNU General Public License as published by
|
|---|
| 11 | * the Free Software Foundation; either version 2 of the License, or
|
|---|
| 12 | * (at your option) any later version.
|
|---|
| 13 | *
|
|---|
| 14 | * This program is distributed in the hope that it will be useful,
|
|---|
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 17 | * GNU General Public License for more details.
|
|---|
| 18 | *
|
|---|
| 19 | * You should have received a copy of the GNU General Public License
|
|---|
| 20 | * along with This program; if not, write to the Free Software
|
|---|
| 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 22 | *
|
|---|
| 23 | */
|
|---|
| 24 |
|
|---|
| 25 | #ifndef __internal_DBGInternal_h__
|
|---|
| 26 | #define __internal_DBGInternal_h__
|
|---|
| 27 |
|
|---|
| 28 | #include "dbg.h"
|
|---|
| 29 |
|
|---|
| 30 | __BEGIN_DECLS
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 | /**
|
|---|
| 34 | * The debug module method table.
|
|---|
| 35 | */
|
|---|
| 36 | typedef struct RTDBGMODOPS
|
|---|
| 37 | {
|
|---|
| 38 | /** The name of the reader. */
|
|---|
| 39 | const char *pszName;
|
|---|
| 40 |
|
|---|
| 41 | /**
|
|---|
| 42 | * Closes the module.
|
|---|
| 43 | *
|
|---|
| 44 | * This should free all resources associated with the module
|
|---|
| 45 | * except the pMod which is freed by the caller.
|
|---|
| 46 | *
|
|---|
| 47 | * @returns IPRT status code.
|
|---|
| 48 | * @param pMod The module.
|
|---|
| 49 | */
|
|---|
| 50 | DECLCALLBACKMEMBER(int, pfnClose)(PRTDBGMOD pMod);
|
|---|
| 51 |
|
|---|
| 52 | /**
|
|---|
| 53 | * Gets a symbol by segment:offset.
|
|---|
| 54 | * This will be approximated to the nearest symbol if there is no exact match.
|
|---|
| 55 | *
|
|---|
| 56 | * @returns IPRT status code.
|
|---|
| 57 | * @param pMod The module.
|
|---|
| 58 | * @param iSegment The segment this offset is relative to.
|
|---|
| 59 | * The -1 segment is special, it means that the addres is relative to
|
|---|
| 60 | * the image base. The image base is where the first bit of the image
|
|---|
| 61 | * is mapped during load.
|
|---|
| 62 | * @param off The offset into the segment.
|
|---|
| 63 | * @param pSym Where to store the symbol details.
|
|---|
| 64 | */
|
|---|
| 65 | DECLCALLBACKMEMBER(int, pfnQuerySymbol)(PRTDBGMOD pMod, int32_t iSegment, RTUINTPTR off, PRTDBGSYMBOL pSym);
|
|---|
| 66 |
|
|---|
| 67 | /**
|
|---|
| 68 | * Gets a line number entry by segment:offset.
|
|---|
| 69 | * This will be approximated to the nearest line number there is no exact match.
|
|---|
| 70 | *
|
|---|
| 71 | * @returns IPRT status code.
|
|---|
| 72 | * @param pMod The module.
|
|---|
| 73 | * @param iSegment The segment this offset is relative to.
|
|---|
| 74 | * The -1 segment is special, it means that the addres is relative to
|
|---|
| 75 | * the image base. The image base is where the first bit of the image
|
|---|
| 76 | * is mapped during load.
|
|---|
| 77 | * @param off The offset into the segment.
|
|---|
| 78 | * @param pLine Where to store the line number details.
|
|---|
| 79 | */
|
|---|
| 80 | DECLCALLBACKMEMBER(int, pfnQueryLine)(PRTDBGMOD pMod, int32_t iSegment, RTUINTPTR uOffset, PRTDBGLINE pLine);
|
|---|
| 81 |
|
|---|
| 82 | } RTDBGMODOPS;
|
|---|
| 83 | /** Pointer to a module method table. */
|
|---|
| 84 | typedef RTDBGMODOPS *PRTDBGMODOPS;
|
|---|
| 85 | /** Pointer to a const module method table. */
|
|---|
| 86 | typedef const RTDBGMODOPS *PCRTDBGMODOPS;
|
|---|
| 87 |
|
|---|
| 88 |
|
|---|
| 89 | /**
|
|---|
| 90 | * Internal representation of a debug module.
|
|---|
| 91 | */
|
|---|
| 92 | typedef struct RTDBGMOD
|
|---|
| 93 | {
|
|---|
| 94 | /** Magic value (RTDBGMOD_MAGIC). */
|
|---|
| 95 | uint32_t u32Magic;
|
|---|
| 96 | /** The handle to the module. (If closed, this is NIL_RTFILE.) */
|
|---|
| 97 | RTFILE File;
|
|---|
| 98 | /** Pointer to the method table. */
|
|---|
| 99 | PCRTDBGMODOPS pOps;
|
|---|
| 100 | } RTDBGMOD;
|
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 | /** The magic value for the debug module structure. (Some english writer) */
|
|---|
| 104 | #define RTDBGMOD_MAGIC 0x00000000
|
|---|
| 105 | /** The magic value of a dead module structure. */
|
|---|
| 106 | #define RTDBGMOD_MAGIC_DEAD 0x00000000
|
|---|
| 107 |
|
|---|
| 108 |
|
|---|
| 109 | int rtDbgModPEOpen(RTFILE File, RTFOFF offHdr, const char *pszModulePath, PRTDBGMOD *ppDbgMod);
|
|---|
| 110 |
|
|---|
| 111 |
|
|---|
| 112 | __END_DECLS
|
|---|
| 113 | #endif
|
|---|
| 114 |
|
|---|