dbgmod.cpp revision b7a07b07543924f45c1fffd2f90de582038b8ba6
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * IPRT - Debug Module Interpreter.
c7814cf6e1240a519cbec0441e033d0e2470ed00vboxsync * Copyright (C) 2009-2012 Oracle Corporation
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * available from http://www.virtualbox.org. This file is free software;
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * you can redistribute it and/or modify it under the terms of the GNU
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * General Public License (GPL) as published by the Free Software
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * The contents of this file may alternatively be used under the terms
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * of the Common Development and Distribution License Version 1.0
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * VirtualBox OSE distribution, in which case the provisions of the
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * CDDL are applicable instead of those of the GPL.
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * You may elect to license modified versions of this file under the
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync * terms and conditions of either the GPL or the CDDL or both.
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync/*******************************************************************************
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync* Header Files *
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsync*******************************************************************************/
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/*******************************************************************************
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync* Structures and Typedefs *
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync*******************************************************************************/
1c822ec4298d5d20b0fb1cc20346c5d4e4e596bfvboxsync/** Debug info interpreter registration record. */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync /** Pointer to the next record. */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync /** Pointer to the virtual function table for the interpreter. */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync /** Usage counter. */
1c822ec4298d5d20b0fb1cc20346c5d4e4e596bfvboxsync/** Image interpreter registration record. */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync /** Pointer to the next record. */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync /** Pointer to the virtual function table for the interpreter. */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync /** Usage counter. */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/*******************************************************************************
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync* Defined Constants And Macros *
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync*******************************************************************************/
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** Validates a debug module handle and returns rc if not valid. */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync AssertReturn((pDbgMod)->u32Magic == RTDBGMOD_MAGIC, (rc)); \
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync } while (0)
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** Locks the debug module. */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync int rcLock = RTCritSectEnter(&(pDbgMod)->CritSect); \
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync } while (0)
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** Unlocks the debug module. */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync int rcLock = RTCritSectLeave(&(pDbgMod)->CritSect); \
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync } while (0)
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/*******************************************************************************
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync* Global Variables *
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync*******************************************************************************/
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** Init once object for lazy registration of the built-in image and debug
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * info interpreters. */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** Read/Write semaphore protecting the list of registered interpreters. */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** List of registered image interpreters. */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync/** List of registered debug infor interpreters. */
7af218a7441de38fc9e814919db04bae3e917664vboxsync/** String cache for the debug info interpreters.
7af218a7441de38fc9e814919db04bae3e917664vboxsync * RTSTRCACHE is thread safe. */
7af218a7441de38fc9e814919db04bae3e917664vboxsyncDECLHIDDEN(RTSTRCACHE) g_hDbgModStrCache = NIL_RTSTRCACHE;
7af218a7441de38fc9e814919db04bae3e917664vboxsync * Cleanup debug info interpreter globals.
7af218a7441de38fc9e814919db04bae3e917664vboxsync * @param enmReason The cause of the termination.
7af218a7441de38fc9e814919db04bae3e917664vboxsync * @param iStatus The meaning of this depends on enmReason.
7af218a7441de38fc9e814919db04bae3e917664vboxsync * @param pvUser User argument, unused.
7af218a7441de38fc9e814919db04bae3e917664vboxsyncstatic DECLCALLBACK(void) rtDbgModTermCallback(RTTERMREASON enmReason, int32_t iStatus, void *pvUser)
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync AssertMsg(pDbg->cUsers == 0, ("%#x %s\n", pDbg->cUsers, pDbg->pVt->pszName));
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync AssertMsg(pImg->cUsers == 0, ("%#x %s\n", pImg->cUsers, pImg->pVt->pszName));
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * Internal worker for register a debug interpreter.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * Called while owning the write lock or when locking isn't required.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @returns IPRT status code.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @retval VERR_NO_MEMORY
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @retval VERR_ALREADY_EXISTS
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * @param pVt The virtual function table of the debug
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * module interpreter.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsyncstatic int rtDbgModDebugInterpreterRegister(PCRTDBGMODVTDBG pVt)
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * Search or duplicate registration.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync for (PRTDBGMODREGDBG pCur = g_pDbgHead; pCur; pCur = pCur->pNext)
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * Create a new record and add it to the end of the list.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync PRTDBGMODREGDBG pReg = (PRTDBGMODREGDBG)RTMemAlloc(sizeof(*pReg));
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync * Internal worker for register a image interpreter.
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync * Called while owning the write lock or when locking isn't required.
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync * @returns IPRT status code.
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync * @retval VERR_NO_MEMORY
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync * @retval VERR_ALREADY_EXISTS
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync * @param pVt The virtual function table of the image
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync * interpreter.
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsyncstatic int rtDbgModImageInterpreterRegister(PCRTDBGMODVTIMG pVt)
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync * Search or duplicate registration.
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync for (PRTDBGMODREGIMG pCur = g_pImgHead; pCur; pCur = pCur->pNext)
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync * Create a new record and add it to the end of the list.
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync PRTDBGMODREGIMG pReg = (PRTDBGMODREGIMG)RTMemAlloc(sizeof(*pReg));
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * Do-once callback that initializes the read/write semaphore and registers
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * the built-in interpreters.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @returns IPRT status code.
a438caaf732f7839dc66b4f8dad672527845a003vboxsync * @param pvUser NULL.
a438caaf732f7839dc66b4f8dad672527845a003vboxsyncstatic DECLCALLBACK(int) rtDbgModInitOnce(void *pvUser)
7af218a7441de38fc9e814919db04bae3e917664vboxsync * Create the semaphore and string cache.
7af218a7441de38fc9e814919db04bae3e917664vboxsync rc = RTStrCacheCreate(&g_hDbgModStrCache, "RTDBGMOD");
7af218a7441de38fc9e814919db04bae3e917664vboxsync * Register the interpreters.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync rc = rtDbgModDebugInterpreterRegister(&g_rtDbgModVtDbgNm);
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync rc = rtDbgModDebugInterpreterRegister(&g_rtDbgModVtDbgDwarf);
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync rc = rtDbgModImageInterpreterRegister(&g_rtDbgModVtImgLdr);
7af218a7441de38fc9e814919db04bae3e917664vboxsync * Finally, register the IPRT cleanup callback.
7af218a7441de38fc9e814919db04bae3e917664vboxsync rc = RTTermRegisterCallback(rtDbgModTermCallback, NULL);
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync /* bail out: use the termination callback. */
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync rtDbgModTermCallback(RTTERMREASON_UNLOAD, 0, NULL);
a438caaf732f7839dc66b4f8dad672527845a003vboxsync return RTOnce(&g_rtDbgModOnce, rtDbgModInitOnce, NULL);
20593760b116c90f3e439552763eef632a3bbb17vboxsync * Creates a module based on the default debug info container.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * This can be used to manually load a module and its symbol. The primary user
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * group is the debug info interpreters, which use this API to create an
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * efficient debug info container behind the scenes and forward all queries to
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * it once the info has been loaded.
20593760b116c90f3e439552763eef632a3bbb17vboxsync * @returns IPRT status code.
20593760b116c90f3e439552763eef632a3bbb17vboxsync * @param phDbgMod Where to return the module handle.
20593760b116c90f3e439552763eef632a3bbb17vboxsync * @param pszName The name of the module (mandatory).
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param cbSeg The size of initial segment. If zero, segments will
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * have to be added manually using RTDbgModSegmentAdd.
20593760b116c90f3e439552763eef632a3bbb17vboxsync * @param fFlags Flags reserved for future extensions, MBZ for now.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsyncRTDECL(int) RTDbgModCreate(PRTDBGMOD phDbgMod, const char *pszName, RTUINTPTR cbSeg, uint32_t fFlags)
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * Input validation and lazy initialization.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * Allocate a new module instance.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync PRTDBGMODINT pDbgMod = (PRTDBGMODINT)RTMemAllocZ(sizeof(*pDbgMod));
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync pDbgMod->pszName = RTStrCacheEnter(g_hDbgModStrCache, pszName);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync RTStrCacheRelease(g_hDbgModStrCache, pDbgMod->pszName);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncRTDECL(int) RTDbgModCreateFromImage(PRTDBGMOD phDbgMod, const char *pszFilename, const char *pszName, RTDBGCFG hDbgCfg)
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync * Input validation and lazy initialization.
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync AssertPtrReturn(pszFilename, VERR_INVALID_POINTER);
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync AssertReturn(*pszFilename, VERR_INVALID_PARAMETER);
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync AssertPtrNullReturn(pszName, VERR_INVALID_POINTER);
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync * Allocate a new module instance.
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync PRTDBGMODINT pDbgMod = (PRTDBGMODINT)RTMemAllocZ(sizeof(*pDbgMod));
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync pDbgMod->pszName = RTStrCacheEnter(g_hDbgModStrCache, pszName);
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync pDbgMod->pszImgFile = RTStrCacheEnter(g_hDbgModStrCache, pszFilename);
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync * Find an image reader which groks the file.
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync rc = RTSemRWRequestRead(g_hDbgModRWSem, RT_INDEFINITE_WAIT);
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync * Find a debug info interpreter.
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync for (PRTDBGMODREGDBG pDbg = g_pDbgHead; pDbg; pDbg = pDbg->pNext)
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync * That's it!
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync * Image detected, but found no debug info we were
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync * able to understand.
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync /** @todo Fall back on exported symbols! */
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync * Could it be a file containing raw debug info?
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync for (PRTDBGMODREGDBG pDbg = g_pDbgHead; pDbg; pDbg = pDbg->pNext)
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync * That's it!
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync /* bail out */
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync RTStrCacheRelease(g_hDbgModStrCache, pDbgMod->pszName);
c58c758d3642ac45d3f12356c406c631fcd8f538vboxsync RTStrCacheRelease(g_hDbgModStrCache, pDbgMod->pszImgFile);
4e47bb772df0d04d1ded3e06354de547d52e2d06vboxsyncRTDECL(int) RTDbgModCreateFromMap(PRTDBGMOD phDbgMod, const char *pszFilename, const char *pszName,
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * Input validation and lazy initialization.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync AssertPtrReturn(pszFilename, VERR_INVALID_POINTER);
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync AssertReturn(*pszFilename, VERR_INVALID_PARAMETER);
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync AssertPtrNullReturn(pszName, VERR_INVALID_POINTER);
4e47bb772df0d04d1ded3e06354de547d52e2d06vboxsync AssertReturn(uSubtrahend == 0, VERR_NOT_IMPLEMENTED); /** @todo implement uSubtrahend. */
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * Allocate a new module instance.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync PRTDBGMODINT pDbgMod = (PRTDBGMODINT)RTMemAllocZ(sizeof(*pDbgMod));
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync pDbgMod->pszName = RTStrCacheEnter(g_hDbgModStrCache, pszName);
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync pDbgMod->pszDbgFile = RTStrCacheEnter(g_hDbgModStrCache, pszFilename);
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync * Try the map file readers.
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync rc = RTSemRWRequestRead(g_hDbgModRWSem, RT_INDEFINITE_WAIT);
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync for (PRTDBGMODREGDBG pCur = g_pDbgHead; pCur; pCur = pCur->pNext)
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync /* bail out */
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync RTStrCacheRelease(g_hDbgModStrCache, pDbgMod->pszName);
72a6fe3989272cb2d409b50caca25e1edbca9398vboxsync RTStrCacheRelease(g_hDbgModStrCache, pDbgMod->pszDbgFile);
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * Destroys an module after the reference count has reached zero.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @param pDbgMod The module instance.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * Close the debug info interpreter first, then the image interpret.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync RTCritSectEnter(&pDbgMod->CritSect); /* paranoia */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * Free the resources.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync ASMAtomicWriteU32(&pDbgMod->u32Magic, ~RTDBGMOD_MAGIC);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync RTStrCacheRelease(g_hDbgModStrCache, pDbgMod->pszName);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync RTStrCacheRelease(g_hDbgModStrCache, pDbgMod->pszImgFile);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync RTStrCacheRelease(g_hDbgModStrCache, pDbgMod->pszDbgFile);
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync RTCritSectLeave(&pDbgMod->CritSect); /* paranoia */
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * Retains another reference to the module.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @returns New reference count, UINT32_MAX on invalid handle (asserted).
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @param hDbgMod The module handle.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @remarks Will not take any locks.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * Release a reference to the module.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * When the reference count reaches zero, the module is destroyed.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @returns New reference count, UINT32_MAX on invalid handle (asserted).
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @param hDbgMod The module handle. The NIL handle is quietly ignored
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * and 0 is returned.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @remarks Will not take any locks.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * Gets the module name.
172ae196da38208e5f1e3485715a89f2d53c6880vboxsync * @returns Pointer to a read only string containing the name.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param hDbgMod The module handle.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * Converts an image relative address to a segment:offset address.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @returns Segment index on success.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * NIL_RTDBGSEGIDX is returned if the module handle or the RVA are
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param hDbgMod The module handle.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param uRva The image relative address to convert.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param poffSeg Where to return the segment offset. Optional.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsyncRTDECL(RTDBGSEGIDX) RTDbgModRvaToSegOff(RTDBGMOD hDbgMod, RTUINTPTR uRva, PRTUINTPTR poffSeg)
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync RTDBGMOD_VALID_RETURN_RC(pDbgMod, NIL_RTDBGSEGIDX);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync RTDBGSEGIDX iSeg = pDbgMod->pDbgVt->pfnRvaToSegOff(pDbgMod, uRva, poffSeg);
ad27e1d5e48ca41245120c331cc88b50464813cevboxsync * Image size when mapped if segments are mapped adjacently.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * For ELF, PE, and Mach-O images this is (usually) a natural query, for LX and
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * NE and such it's a bit odder and the answer may not make much sense for them.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @returns Image mapped size.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * RTUINTPTR_MAX is returned if the handle is invalid.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param hDbgMod The module handle.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsyncRTDECL(RTUINTPTR) RTDbgModImageSize(RTDBGMOD hDbgMod)
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync RTUINTPTR cbImage = pDbgMod->pDbgVt->pfnImageSize(pDbgMod);
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync * Gets the module tag value if any.
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync * @returns The tag. 0 if hDbgMod is invalid.
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync * @param hDbgMod The module handle.
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync * Tags or untags the module.
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync * @returns IPRT status code.
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync * @retval VERR_INVALID_HANDLE if hDbgMod is invalid.
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync * @param hDbgMod The module handle.
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync * @param uTag The tag value. The convention is that 0 is no tag
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync * and any other value means it's tagged. It's adviced
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync * to use some kind of unique number like an address
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync * (global or string cache for instance) to avoid
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync * collisions with other users
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsyncRTDECL(int) RTDbgModSetTag(RTDBGMOD hDbgMod, uint64_t uTag)
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync RTDBGMOD_VALID_RETURN_RC(pDbgMod, VERR_INVALID_HANDLE);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * Adds a segment to the module. Optional feature.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * This method is intended used for manually constructing debug info for a
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * module. The main usage is from other debug info interpreters that want to
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * avoid writing a debug info database and instead uses the standard container
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * behind the scenes.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @returns IPRT status code.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @retval VERR_NOT_SUPPORTED if this feature isn't support by the debug info
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * interpreter. This is a common return code.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @retval VERR_INVALID_HANDLE if hDbgMod is invalid.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @retval VERR_DBG_ADDRESS_WRAP if uRva+cb wraps around.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @retval VERR_DBG_SEGMENT_NAME_OUT_OF_RANGE if pszName is too short or long.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @retval VERR_INVALID_PARAMETER if fFlags contains undefined flags.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @retval VERR_DBG_SPECIAL_SEGMENT if *piSeg is a special segment.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @retval VERR_DBG_INVALID_SEGMENT_INDEX if *piSeg doesn't meet expectations.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param hDbgMod The module handle.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param uRva The image relative address of the segment.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param cb The size of the segment.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param pszName The segment name. Does not normally need to be
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * unique, although this is somewhat up to the
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * debug interpreter to decide.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param fFlags Segment flags. Reserved for future used, MBZ.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param piSeg The segment index or NIL_RTDBGSEGIDX on input.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * The assigned segment index on successful return.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * Optional.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsyncRTDECL(int) RTDbgModSegmentAdd(RTDBGMOD hDbgMod, RTUINTPTR uRva, RTUINTPTR cb, const char *pszName,
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * Validate input.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync RTDBGMOD_VALID_RETURN_RC(pDbgMod, VERR_INVALID_HANDLE);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync AssertMsgReturn(uRva + cb >= uRva, ("uRva=%RTptr cb=%RTptr\n", uRva, cb), VERR_DBG_ADDRESS_WRAP);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync AssertReturn(cchName > 0, VERR_DBG_SEGMENT_NAME_OUT_OF_RANGE);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync AssertReturn(cchName < RTDBG_SEGMENT_NAME_LENGTH, VERR_DBG_SEGMENT_NAME_OUT_OF_RANGE);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync AssertMsgReturn(!fFlags, ("%#x\n", fFlags), VERR_INVALID_PARAMETER);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync AssertMsgReturn(!piSeg || *piSeg == NIL_RTDBGSEGIDX || *piSeg <= RTDBGSEGIDX_LAST, ("%#x\n", *piSeg), VERR_DBG_SPECIAL_SEGMENT);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * Do the deed.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync int rc = pDbgMod->pDbgVt->pfnSegmentAdd(pDbgMod, uRva, cb, pszName, cchName, fFlags, piSeg);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * Gets the number of segments in the module.
ad27e1d5e48ca41245120c331cc88b50464813cevboxsync * This is can be used to determine the range which can be passed to
ad27e1d5e48ca41245120c331cc88b50464813cevboxsync * RTDbgModSegmentByIndex and derivatives.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @returns The segment relative address.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * NIL_RTDBGSEGIDX if the handle is invalid.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param hDbgMod The module handle.
8b4a8db7768e94d025f1216ecfcd50d727fa2b7cvboxsyncRTDECL(RTDBGSEGIDX) RTDbgModSegmentCount(RTDBGMOD hDbgMod)
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync RTDBGMOD_VALID_RETURN_RC(pDbgMod, NIL_RTDBGSEGIDX);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync RTDBGSEGIDX cSegs = pDbgMod->pDbgVt->pfnSegmentCount(pDbgMod);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * Query information about a segment.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * This can be used together with RTDbgModSegmentCount to enumerate segments.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * The index starts a 0 and stops one below RTDbgModSegmentCount.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @returns IPRT status code.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @retval VERR_DBG_INVALID_SEGMENT_INDEX if iSeg is too high.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @retval VERR_DBG_SPECIAL_SEGMENT if iSeg indicates a special segment.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @retval VERR_INVALID_HANDLE if hDbgMod is invalid.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param hDbgMod The module handle.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param iSeg The segment index. No special segments.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param pSegInfo Where to return the segment info. The
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * RTDBGSEGMENT::Address member will be set to
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * RTUINTPTR_MAX or the load address used at link time.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsyncRTDECL(int) RTDbgModSegmentByIndex(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, PRTDBGSEGMENT pSegInfo)
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync AssertMsgReturn(iSeg <= RTDBGSEGIDX_LAST, ("%#x\n", iSeg), VERR_DBG_SPECIAL_SEGMENT);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync RTDBGMOD_VALID_RETURN_RC(pDbgMod, VERR_INVALID_HANDLE);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync int rc = pDbgMod->pDbgVt->pfnSegmentByIndex(pDbgMod, iSeg, pSegInfo);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * Gets the size of a segment.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * This is a just a wrapper around RTDbgModSegmentByIndex.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @returns The segment size.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * RTUINTPTR_MAX is returned if either the handle and segment index are
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param hDbgMod The module handle.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param iSeg The segment index. RTDBGSEGIDX_ABS is not allowed.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * If RTDBGSEGIDX_RVA is used, the functions returns
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * the same value as RTDbgModImageSize.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsyncRTDECL(RTUINTPTR) RTDbgModSegmentSize(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg)
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync int rc = RTDbgModSegmentByIndex(hDbgMod, iSeg, &SegInfo);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync return RT_SUCCESS(rc) ? SegInfo.cb : RTUINTPTR_MAX;
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * Gets the image relative address of a segment.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * This is a just a wrapper around RTDbgModSegmentByIndex.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @returns The segment relative address.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * RTUINTPTR_MAX is returned if either the handle and segment index are
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param hDbgMod The module handle.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param iSeg The segment index. No special segment indexes
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * allowed (asserted).
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsyncRTDECL(RTUINTPTR) RTDbgModSegmentRva(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg)
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync int rc = RTDbgModSegmentByIndex(hDbgMod, iSeg, &SegInfo);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync return RT_SUCCESS(rc) ? SegInfo.uRva : RTUINTPTR_MAX;
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * Adds a line number to the module.
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * @returns IPRT status code.
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * @retval VERR_NOT_SUPPORTED if the module interpret doesn't support adding
ad27e1d5e48ca41245120c331cc88b50464813cevboxsync * custom symbols. This is a common place occurrence.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_INVALID_HANDLE if hDbgMod is invalid.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_DBG_SYMBOL_NAME_OUT_OF_RANGE if the symbol name is too long or
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_DBG_INVALID_RVA if an image relative address is specified and
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * it's not inside any of the segments defined by the module.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_DBG_INVALID_SEGMENT_INDEX if the segment index isn't valid.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_DBG_INVALID_SEGMENT_OFFSET if the segment offset is beyond the
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * end of the segment.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_DBG_ADDRESS_WRAP if off+cb wraps around.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_INVALID_PARAMETER if the symbol flags sets undefined bits.
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * @param hDbgMod The module handle.
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * @param pszSymbol The symbol name.
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * @param iSeg The segment index.
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * @param off The segment offset.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @param cb The size of the symbol. Can be zero, although this
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * may depend somewhat on the debug interpreter.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @param fFlags Symbol flags. Reserved for the future, MBZ.
044af0d1e6474076366759db86f101778c5f20ccvboxsync * @param piOrdinal Where to return the symbol ordinal on success. If
044af0d1e6474076366759db86f101778c5f20ccvboxsync * the interpreter doesn't do ordinals, this will be set to
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * UINT32_MAX. Optional.
a1df400bbe9d64aad400442e56eb637019300a5evboxsyncRTDECL(int) RTDbgModSymbolAdd(RTDBGMOD hDbgMod, const char *pszSymbol, RTDBGSEGIDX iSeg, RTUINTPTR off,
a1df400bbe9d64aad400442e56eb637019300a5evboxsync RTUINTPTR cb, uint32_t fFlags, uint32_t *piOrdinal)
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * Validate input.
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync RTDBGMOD_VALID_RETURN_RC(pDbgMod, VERR_INVALID_HANDLE);
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync AssertReturn(cchSymbol, VERR_DBG_SYMBOL_NAME_OUT_OF_RANGE);
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync AssertReturn(cchSymbol < RTDBG_SYMBOL_NAME_LENGTH, VERR_DBG_SYMBOL_NAME_OUT_OF_RANGE);
a1df400bbe9d64aad400442e56eb637019300a5evboxsync AssertMsgReturn(off + cb >= off, ("off=%RTptr cb=%RTptr\n", off, cb), VERR_DBG_ADDRESS_WRAP);
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync AssertReturn(!fFlags, VERR_INVALID_PARAMETER); /* currently reserved. */
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * Convert RVAs.
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync iSeg = pDbgMod->pDbgVt->pfnRvaToSegOff(pDbgMod, off, &off);
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * Get down to business.
044af0d1e6474076366759db86f101778c5f20ccvboxsync int rc = pDbgMod->pDbgVt->pfnSymbolAdd(pDbgMod, pszSymbol, cchSymbol, iSeg, off, cb, fFlags, piOrdinal);
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * Gets the symbol count.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * This can be used together wtih RTDbgModSymbolByOrdinal or
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * RTDbgModSymbolByOrdinalA to enumerate all the symbols.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @returns The number of symbols in the module.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * UINT32_MAX is returned if the module handle is invalid or some other
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * error occurs.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @param hDbgMod The module handle.
a1df400bbe9d64aad400442e56eb637019300a5evboxsyncRTDECL(uint32_t) RTDbgModSymbolCount(RTDBGMOD hDbgMod)
a1df400bbe9d64aad400442e56eb637019300a5evboxsync uint32_t cSymbols = pDbgMod->pDbgVt->pfnSymbolCount(pDbgMod);
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * Queries symbol information by ordinal number.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @returns IPRT status code.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_SYMBOL_NOT_FOUND if there is no symbol at the given number.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_DBG_NO_SYMBOLS if there aren't any symbols.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_INVALID_HANDLE if hDbgMod is invalid.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_NOT_SUPPORTED if lookup by ordinal is not supported.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @param hDbgMod The module handle.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @param iOrdinal The symbol ordinal number. 0-based. The highest
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * number is RTDbgModSymbolCount() - 1.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @param pSymInfo Where to store the symbol information.
a1df400bbe9d64aad400442e56eb637019300a5evboxsyncRTDECL(int) RTDbgModSymbolByOrdinal(RTDBGMOD hDbgMod, uint32_t iOrdinal, PRTDBGSYMBOL pSymInfo)
a1df400bbe9d64aad400442e56eb637019300a5evboxsync RTDBGMOD_VALID_RETURN_RC(pDbgMod, VERR_INVALID_HANDLE);
a1df400bbe9d64aad400442e56eb637019300a5evboxsync int rc = pDbgMod->pDbgVt->pfnSymbolByOrdinal(pDbgMod, iOrdinal, pSymInfo);
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * Queries symbol information by ordinal number.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @returns IPRT status code.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_DBG_NO_SYMBOLS if there aren't any symbols.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_NOT_SUPPORTED if lookup by ordinal is not supported.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_SYMBOL_NOT_FOUND if there is no symbol at the given number.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_NO_MEMORY if RTDbgSymbolAlloc fails.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @param hDbgMod The module handle.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @param iOrdinal The symbol ordinal number. 0-based. The highest
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * number is RTDbgModSymbolCount() - 1.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @param ppSymInfo Where to store the pointer to the returned
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * symbol information. Always set. Free with
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * RTDbgSymbolFree.
a1df400bbe9d64aad400442e56eb637019300a5evboxsyncRTDECL(int) RTDbgModSymbolByOrdinalA(RTDBGMOD hDbgMod, uint32_t iOrdinal, PRTDBGSYMBOL *ppSymInfo)
a1df400bbe9d64aad400442e56eb637019300a5evboxsync int rc = RTDbgModSymbolByOrdinal(hDbgMod, iOrdinal, pSymInfo);
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * Queries symbol information by address.
ad27e1d5e48ca41245120c331cc88b50464813cevboxsync * The returned symbol is what the debug info interpreter considers the symbol
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * most applicable to the specified address. This usually means a symbol with an
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * address equal or lower than the requested.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @returns IPRT status code.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_SYMBOL_NOT_FOUND if no suitable symbol was found.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_DBG_NO_SYMBOLS if there aren't any symbols.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_INVALID_HANDLE if hDbgMod is invalid.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_DBG_INVALID_RVA if an image relative address is specified and
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * it's not inside any of the segments defined by the module.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_DBG_INVALID_SEGMENT_INDEX if the segment index isn't valid.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_DBG_INVALID_SEGMENT_OFFSET if the segment offset is beyond the
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * end of the segment.
2d8870843ff566fee9bd3a6a5942414254106479vboxsync * @retval VERR_INVALID_PARAMETER if incorrect flags.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param hDbgMod The module handle.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param iSeg The segment number.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param off The offset into the segment.
2d8870843ff566fee9bd3a6a5942414254106479vboxsync * @param fFlags Symbol search flags, see RTDBGSYMADDR_FLAGS_XXX.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param poffDisp Where to store the distance between the
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * specified address and the returned symbol.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * Optional.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param pSymInfo Where to store the symbol information.
2d8870843ff566fee9bd3a6a5942414254106479vboxsyncRTDECL(int) RTDbgModSymbolByAddr(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, uint32_t fFlags,
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * Validate input.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync RTDBGMOD_VALID_RETURN_RC(pDbgMod, VERR_INVALID_HANDLE);
2d8870843ff566fee9bd3a6a5942414254106479vboxsync AssertReturn(!(fFlags & ~RTDBGSYMADDR_FLAGS_VALID_MASK), VERR_INVALID_PARAMETER);
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * Convert RVAs.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync iSeg = pDbgMod->pDbgVt->pfnRvaToSegOff(pDbgMod, off, &off);
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * Get down to business.
2d8870843ff566fee9bd3a6a5942414254106479vboxsync int rc = pDbgMod->pDbgVt->pfnSymbolByAddr(pDbgMod, iSeg, off, fFlags, poffDisp, pSymInfo);
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * Queries symbol information by address.
ad27e1d5e48ca41245120c331cc88b50464813cevboxsync * The returned symbol is what the debug info interpreter considers the symbol
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * most applicable to the specified address. This usually means a symbol with an
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * address equal or lower than the requested.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @returns IPRT status code.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_SYMBOL_NOT_FOUND if no suitable symbol was found.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_DBG_NO_SYMBOLS if there aren't any symbols.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_INVALID_HANDLE if hDbgMod is invalid.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_DBG_INVALID_RVA if an image relative address is specified and
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * it's not inside any of the segments defined by the module.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_DBG_INVALID_SEGMENT_INDEX if the segment index isn't valid.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_DBG_INVALID_SEGMENT_OFFSET if the segment offset is beyond the
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * end of the segment.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_NO_MEMORY if RTDbgSymbolAlloc fails.
2d8870843ff566fee9bd3a6a5942414254106479vboxsync * @retval VERR_INVALID_PARAMETER if incorrect flags.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @param hDbgMod The module handle.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @param iSeg The segment index.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @param off The offset into the segment.
2d8870843ff566fee9bd3a6a5942414254106479vboxsync * @param fFlags Symbol search flags, see RTDBGSYMADDR_FLAGS_XXX.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @param poffDisp Where to store the distance between the
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * specified address and the returned symbol. Optional.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @param ppSymInfo Where to store the pointer to the returned
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * symbol information. Always set. Free with
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * RTDbgSymbolFree.
2d8870843ff566fee9bd3a6a5942414254106479vboxsyncRTDECL(int) RTDbgModSymbolByAddrA(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, uint32_t fFlags,
2d8870843ff566fee9bd3a6a5942414254106479vboxsync int rc = RTDbgModSymbolByAddr(hDbgMod, iSeg, off, fFlags, poffDisp, pSymInfo);
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * Queries symbol information by symbol name.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @returns IPRT status code.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_DBG_NO_SYMBOLS if there aren't any symbols.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_SYMBOL_NOT_FOUND if no suitable symbol was found.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_DBG_SYMBOL_NAME_OUT_OF_RANGE if the symbol name is too long or
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @param hDbgMod The module handle.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @param pszSymbol The symbol name.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @param pSymInfo Where to store the symbol information.
a1df400bbe9d64aad400442e56eb637019300a5evboxsyncRTDECL(int) RTDbgModSymbolByName(RTDBGMOD hDbgMod, const char *pszSymbol, PRTDBGSYMBOL pSymInfo)
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * Validate input.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync RTDBGMOD_VALID_RETURN_RC(pDbgMod, VERR_INVALID_HANDLE);
a1df400bbe9d64aad400442e56eb637019300a5evboxsync AssertReturn(cchSymbol, VERR_DBG_SYMBOL_NAME_OUT_OF_RANGE);
a1df400bbe9d64aad400442e56eb637019300a5evboxsync AssertReturn(cchSymbol < RTDBG_SYMBOL_NAME_LENGTH, VERR_DBG_SYMBOL_NAME_OUT_OF_RANGE);
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * Make the query.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync int rc = pDbgMod->pDbgVt->pfnSymbolByName(pDbgMod, pszSymbol, cchSymbol, pSymInfo);
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * Queries symbol information by symbol name.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @returns IPRT status code.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_DBG_NO_SYMBOLS if there aren't any symbols.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_SYMBOL_NOT_FOUND if no suitable symbol was found.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_DBG_SYMBOL_NAME_OUT_OF_RANGE if the symbol name is too long or
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @retval VERR_NO_MEMORY if RTDbgSymbolAlloc fails.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @param hDbgMod The module handle.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @param pszSymbol The symbol name.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @param ppSymInfo Where to store the pointer to the returned
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * symbol information. Always set. Free with
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * RTDbgSymbolFree.
a1df400bbe9d64aad400442e56eb637019300a5evboxsyncRTDECL(int) RTDbgModSymbolByNameA(RTDBGMOD hDbgMod, const char *pszSymbol, PRTDBGSYMBOL *ppSymInfo)
a1df400bbe9d64aad400442e56eb637019300a5evboxsync int rc = RTDbgModSymbolByName(hDbgMod, pszSymbol, pSymInfo);
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * Adds a line number to the module.
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * @returns IPRT status code.
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * @retval VERR_NOT_SUPPORTED if the module interpret doesn't support adding
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * custom symbols. This should be consider a normal response.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_INVALID_HANDLE if hDbgMod is invalid.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_FILE_NAME_OUT_OF_RANGE if the file name is too longer or
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_INVALID_RVA if an image relative address is specified and
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * it's not inside any of the segments defined by the module.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_INVALID_SEGMENT_INDEX if the segment index isn't valid.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_INVALID_SEGMENT_OFFSET if the segment offset is beyond the
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * end of the segment.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_INVALID_PARAMETER if the line number flags sets undefined bits.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param hDbgMod The module handle.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param pszFile The file name.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param uLineNo The line number.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param iSeg The segment index.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param off The segment offset.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param piOrdinal Where to return the line number ordinal on
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * success. If the interpreter doesn't do ordinals,
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * this will be set to UINT32_MAX. Optional.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsyncRTDECL(int) RTDbgModLineAdd(RTDBGMOD hDbgMod, const char *pszFile, uint32_t uLineNo,
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync RTDBGSEGIDX iSeg, RTUINTPTR off, uint32_t *piOrdinal)
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * Validate input.
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync RTDBGMOD_VALID_RETURN_RC(pDbgMod, VERR_INVALID_HANDLE);
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync AssertReturn(cchFile, VERR_DBG_FILE_NAME_OUT_OF_RANGE);
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync AssertReturn(cchFile < RTDBG_FILE_NAME_LENGTH, VERR_DBG_FILE_NAME_OUT_OF_RANGE);
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync AssertReturn(uLineNo > 0 && uLineNo < UINT32_MAX, VERR_INVALID_PARAMETER);
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * Convert RVAs.
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync iSeg = pDbgMod->pDbgVt->pfnRvaToSegOff(pDbgMod, off, &off);
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * Get down to business.
044af0d1e6474076366759db86f101778c5f20ccvboxsync int rc = pDbgMod->pDbgVt->pfnLineAdd(pDbgMod, pszFile, cchFile, uLineNo, iSeg, off, piOrdinal);
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * Gets the line number count.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * This can be used together wtih RTDbgModLineByOrdinal or RTDbgModSymbolByLineA
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * to enumerate all the line number information.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @returns The number of line numbers in the module.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * UINT32_MAX is returned if the module handle is invalid or some other
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * error occurs.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param hDbgMod The module handle.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsyncRTDECL(uint32_t) RTDbgModLineCount(RTDBGMOD hDbgMod)
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync uint32_t cLineNumbers = pDbgMod->pDbgVt->pfnLineCount(pDbgMod);
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * Queries line number information by ordinal number.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * This can be used to enumerate the line numbers for the module. Use
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * RTDbgModLineCount() to figure the end of the ordinals.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @returns IPRT status code.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_NO_LINE_NUMBERS if there aren't any line numbers.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_LINE_NOT_FOUND if there is no line number with that
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_INVALID_HANDLE if hDbgMod is invalid.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param hDbgMod The module handle.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param iOrdinal The line number ordinal number.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param pLineInfo Where to store the information about the line
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsyncRTDECL(int) RTDbgModLineByOrdinal(RTDBGMOD hDbgMod, uint32_t iOrdinal, PRTDBGLINE pLineInfo)
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync RTDBGMOD_VALID_RETURN_RC(pDbgMod, VERR_INVALID_HANDLE);
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync int rc = pDbgMod->pDbgVt->pfnLineByOrdinal(pDbgMod, iOrdinal, pLineInfo);
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * Queries line number information by ordinal number.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * This can be used to enumerate the line numbers for the module. Use
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * RTDbgModLineCount() to figure the end of the ordinals.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @returns IPRT status code.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_NO_LINE_NUMBERS if there aren't any line numbers.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_LINE_NOT_FOUND if there is no line number with that
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_INVALID_HANDLE if hDbgMod is invalid.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_NO_MEMORY if RTDbgLineAlloc fails.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param hDbgMod The module handle.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param iOrdinal The line number ordinal number.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param ppLineInfo Where to store the pointer to the returned line
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * number information. Always set. Free with
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * RTDbgLineFree.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsyncRTDECL(int) RTDbgModLineByOrdinalA(RTDBGMOD hDbgMod, uint32_t iOrdinal, PRTDBGLINE *ppLineInfo)
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync int rc = RTDbgModLineByOrdinal(hDbgMod, iOrdinal, pLineInfo);
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * Queries line number information by address.
ad27e1d5e48ca41245120c331cc88b50464813cevboxsync * The returned line number is what the debug info interpreter considers the
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * one most applicable to the specified address. This usually means a line
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * number with an address equal or lower than the requested.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @returns IPRT status code.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_NO_LINE_NUMBERS if there aren't any line numbers.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_LINE_NOT_FOUND if no suitable line number was found.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_INVALID_HANDLE if hDbgMod is invalid.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_INVALID_RVA if an image relative address is specified and
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * it's not inside any of the segments defined by the module.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_INVALID_SEGMENT_INDEX if the segment index isn't valid.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_INVALID_SEGMENT_OFFSET if the segment offset is beyond the
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * end of the segment.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param hDbgMod The module handle.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param iSeg The segment number.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param off The offset into the segment.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param poffDisp Where to store the distance between the
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * specified address and the returned symbol.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * Optional.
88acfa6629a7976c0583c1712d2b5b22a87a5121vboxsync * @param pLineInfo Where to store the line number information.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsyncRTDECL(int) RTDbgModLineByAddr(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGLINE pLineInfo)
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * Validate input.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync RTDBGMOD_VALID_RETURN_RC(pDbgMod, VERR_INVALID_HANDLE);
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * Convert RVAs.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync iSeg = pDbgMod->pDbgVt->pfnRvaToSegOff(pDbgMod, off, &off);
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync int rc = pDbgMod->pDbgVt->pfnLineByAddr(pDbgMod, iSeg, off, poffDisp, pLineInfo);
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * Queries line number information by address.
ad27e1d5e48ca41245120c331cc88b50464813cevboxsync * The returned line number is what the debug info interpreter considers the
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * one most applicable to the specified address. This usually means a line
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * number with an address equal or lower than the requested.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @returns IPRT status code.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_NO_LINE_NUMBERS if there aren't any line numbers.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_LINE_NOT_FOUND if no suitable line number was found.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_INVALID_HANDLE if hDbgMod is invalid.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_INVALID_RVA if an image relative address is specified and
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * it's not inside any of the segments defined by the module.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_INVALID_SEGMENT_INDEX if the segment index isn't valid.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_INVALID_SEGMENT_OFFSET if the segment offset is beyond the
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * end of the segment.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_NO_MEMORY if RTDbgLineAlloc fails.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param hDbgMod The module handle.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param iSeg The segment number.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param off The offset into the segment.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param poffDisp Where to store the distance between the
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * specified address and the returned symbol.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * Optional.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param ppLineInfo Where to store the pointer to the returned line
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * number information. Always set. Free with
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * RTDbgLineFree.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsyncRTDECL(int) RTDbgModLineByAddrA(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGLINE *ppLineInfo)