VirtualBox

Changeset 73494 in vbox for trunk/include/iprt


Ignore:
Timestamp:
Aug 4, 2018 7:41:30 PM (6 years ago)
Author:
vboxsync
Message:

IPRT: Added single stack frame unwind function to RTDbgMod and RTLdr, copying over the PoC from DBGFRStack.cpp. bugref:3897

Location:
trunk/include/iprt
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/dbg.h

    r73482 r73494  
    3434RT_C_DECLS_BEGIN
    3535
    36 # ifdef IN_RING3
    3736
    3837/** @defgroup grp_rt_dbg    RTDbg - Debugging Routines
     
    275274} RTDBGUNWINDSTATE;
    276275
     276/**
     277 * Try read a 16-bit value off the stack.
     278 *
     279 * @returns pfnReadStack result.
     280 * @param   pThis           The unwind state.
     281 * @param   uSrcAddr        The stack address.
     282 * @param   puDst           The read destination.
     283 */
     284DECLINLINE(int) RTDbgUnwindLoadStackU16(PRTDBGUNWINDSTATE pThis, RTUINTPTR uSrcAddr, uint16_t *puDst)
     285{
     286    return pThis->pfnReadStack(pThis, uSrcAddr, sizeof(*puDst), puDst);
     287}
     288
     289/**
     290 * Try read a 32-bit value off the stack.
     291 *
     292 * @returns pfnReadStack result.
     293 * @param   pThis           The unwind state.
     294 * @param   uSrcAddr        The stack address.
     295 * @param   puDst           The read destination.
     296 */
     297DECLINLINE(int) RTDbgUnwindLoadStackU32(PRTDBGUNWINDSTATE pThis, RTUINTPTR uSrcAddr, uint32_t *puDst)
     298{
     299    return pThis->pfnReadStack(pThis, uSrcAddr, sizeof(*puDst), puDst);
     300}
     301
     302/**
     303 * Try read a 64-bit value off the stack.
     304 *
     305 * @returns pfnReadStack result.
     306 * @param   pThis           The unwind state.
     307 * @param   uSrcAddr        The stack address.
     308 * @param   puDst           The read destination.
     309 */
     310DECLINLINE(int) RTDbgUnwindLoadStackU64(PRTDBGUNWINDSTATE pThis, RTUINTPTR uSrcAddr, uint64_t *puDst)
     311{
     312    return pThis->pfnReadStack(pThis, uSrcAddr, sizeof(*puDst), puDst);
     313}
     314
    277315
    278316
     
    308346typedef const RTDBGSYMBOL *PCRTDBGSYMBOL;
    309347
     348
    310349/**
    311350 * Allocate a new symbol structure.
     
    385424RTDECL(void)            RTDbgLineFree(PRTDBGLINE pLine);
    386425
     426
     427# ifdef IN_RING3
    387428
    388429/** @defgroup grp_rt_dbgcfg     RTDbgCfg - Debugging Configuration
     
    659700/** @} */
    660701
     702# endif /* IN_RING3 */
    661703
    662704/** @} */
     
    11051147
    11061148
     1149# ifdef IN_RING3
    11071150/** @defgroup grp_rt_dbgmod     RTDbgMod - Debug Module Interpreter
    11081151 * @{
     
    17501793 */
    17511794RTDECL(int)         RTDbgModLineByAddrA(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGLINE *ppLineInfo);
     1795
     1796/**
     1797 * Try use unwind information to unwind one frame.
     1798 *
     1799 * @returns IPRT status code.  Last informational status from stack reader callback.
     1800 * @retval  VERR_DBG_NO_UNWIND_INFO if the module contains no unwind information.
     1801 * @retval  VERR_DBG_UNWIND_INFO_NOT_FOUND if no unwind information was found
     1802 *          for the location given by iSeg:off.
     1803 *
     1804 * @param   hDbgMod             The module handle.
     1805 * @param   iSeg                The segment number of the program counter.
     1806 * @param   off                 The offset into @a iSeg.  Together with @a iSeg
     1807 *                              this corresponds to the RTDBGUNWINDSTATE::uPc
     1808 *                              value pointed to by @a pState.
     1809 * @param   pState              The unwind state to work.
     1810 *
     1811 * @sa      RTLdrUnwindFrame
     1812 */
     1813RTDECL(int)         RTDbgModUnwindFrame(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTDBGUNWINDSTATE pState);
     1814
    17521815/** @} */
    1753 
    17541816# endif /* IN_RING3 */
     1817
    17551818
    17561819
  • trunk/include/iprt/err.h

    r72367 r73494  
    17291729/** Internal processing error the CodeView debug information reader. */
    17301730#define VERR_CV_IPE                             (-693)
     1731/** No unwind information was found. */
     1732#define VERR_DBG_NO_UNWIND_INFO                 (-694)
     1733/** No unwind information for the specified location. */
     1734#define VERR_DBG_UNWIND_INFO_NOT_FOUND          (-695)
     1735/** Malformed unwind information. */
     1736#define VERR_DBG_MALFORMED_UNWIND_INFO          (-696)
    17311737/** @} */
    17321738
  • trunk/include/iprt/ldr.h

    r73442 r73494  
    12281228RTDECL(int) RTLdrHashImage(RTLDRMOD hLdrMod, RTDIGESTTYPE enmDigest, char *pszDigest, size_t cbDigest);
    12291229
     1230/**
     1231 * Try use unwind information to unwind one frame.
     1232 *
     1233 * @returns IPRT status code.  Last informational status from stack reader callback.
     1234 * @retval  VERR_DBG_NO_UNWIND_INFO if the module contains no unwind information.
     1235 * @retval  VERR_DBG_UNWIND_INFO_NOT_FOUND if no unwind information was found
     1236 *          for the location given by iSeg:off.
     1237 *
     1238 * @param   hDbgMod             The module handle.
     1239 * @param   pvBits              Optional pointer to bits returned by
     1240 *                              RTLdrGetBits().  This can be utilized by some module
     1241 *                              interpreters to reduce memory consumption and file
     1242 *                              access.
     1243 * @param   iSeg                The segment number of the program counter.  UINT32_MAX if RVA.
     1244 * @param   off                 The offset into @a iSeg.  Together with @a iSeg
     1245 *                              this corresponds to the RTDBGUNWINDSTATE::uPc
     1246 *                              value pointed to by @a pState.
     1247 * @param   pState              The unwind state to work.
     1248 *
     1249 * @sa      RTDbgModUnwindFrame
     1250 */
     1251RTDECL(int) RTLdrUnwindFrame(RTLDRMOD hLdrMod, void const *pvBits, uint32_t iSeg, RTLDRADDR off, PRTDBGUNWINDSTATE pState);
     1252
    12301253RT_C_DECLS_END
    12311254
  • trunk/include/iprt/mangling.h

    r73375 r73494  
    755755# define RTDbgModSymbolByOrdinalA                       RT_MANGLER(RTDbgModSymbolByOrdinalA)
    756756# define RTDbgModSymbolCount                            RT_MANGLER(RTDbgModSymbolCount)
     757# define RTDbgModUnwindFrame                            RT_MANGLER(RTDbgModUnwindFrame)
    757758# define RTDbgSymbolAlloc                               RT_MANGLER(RTDbgSymbolAlloc)
    758759# define RTDbgSymbolDup                                 RT_MANGLER(RTDbgSymbolDup)
     
    11721173# define RTLdrSegOffsetToRva                            RT_MANGLER(RTLdrSegOffsetToRva)
    11731174# define RTLdrSize                                      RT_MANGLER(RTLdrSize)
     1175# define RTLdrUnwindFrame                               RT_MANGLER(RTLdrUnwindFrame)
    11741176# define RTLinuxCheckDevicePath                         RT_MANGLER(RTLinuxCheckDevicePath)
    11751177# define RTLinuxCheckDevicePathV                        RT_MANGLER(RTLinuxCheckDevicePathV)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette