3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/* $Id$ */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/** @file
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * IPRT - Debugging Routines.
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/*
2a2b173b54c259e34320ce0acf26f18e9382ce2avboxsync * Copyright (C) 2008-2013 Oracle Corporation
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync *
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * available from http://www.virtualbox.org. This file is free software;
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * you can redistribute it and/or modify it under the terms of the GNU
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * General Public License (GPL) as published by the Free Software
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync *
0d12c7f9423f2745f8e282523d0930f91bff03b3vboxsync * The contents of this file may alternatively be used under the terms
0d12c7f9423f2745f8e282523d0930f91bff03b3vboxsync * of the Common Development and Distribution License Version 1.0
0d12c7f9423f2745f8e282523d0930f91bff03b3vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
0d12c7f9423f2745f8e282523d0930f91bff03b3vboxsync * VirtualBox OSE distribution, in which case the provisions of the
0d12c7f9423f2745f8e282523d0930f91bff03b3vboxsync * CDDL are applicable instead of those of the GPL.
0d12c7f9423f2745f8e282523d0930f91bff03b3vboxsync *
0d12c7f9423f2745f8e282523d0930f91bff03b3vboxsync * You may elect to license modified versions of this file under the
0d12c7f9423f2745f8e282523d0930f91bff03b3vboxsync * terms and conditions of either the GPL or the CDDL or both.
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync#ifndef ___iprt_dbg_h
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync#define ___iprt_dbg_h
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync#include <iprt/types.h>
032a52c5b2984e26e84c2961f8f7f98a3954c8f2vboxsync#include <iprt/stdarg.h>
6ba706e9f431401d425d16817fdcd6316f83b584vboxsync#include <iprt/ldr.h>
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
590bfe12ce22cd3716448fbb9f4dc51664bfe5e2vboxsyncRT_C_DECLS_BEGIN
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
45c3e41d012100c5f4a3f77e391e4c6da8f5b97avboxsync# ifdef IN_RING3
45c3e41d012100c5f4a3f77e391e4c6da8f5b97avboxsync
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/** @defgroup grp_rt_dbg RTDbg - Debugging Routines
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * @ingroup grp_rt
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * @{
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/** Debug segment index. */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsynctypedef uint32_t RTDBGSEGIDX;
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/** Pointer to a debug segment index. */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsynctypedef RTDBGSEGIDX *PRTDBGSEGIDX;
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/** Pointer to a const debug segment index. */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsynctypedef RTDBGSEGIDX const *PCRTDBGSEGIDX;
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/** NIL debug segment index. */
c2046db2cc346cc299f0cd9b2d1e160179159cfcvboxsync#define NIL_RTDBGSEGIDX UINT32_C(0xffffffff)
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync/** The last normal segment index. */
c2046db2cc346cc299f0cd9b2d1e160179159cfcvboxsync#define RTDBGSEGIDX_LAST UINT32_C(0xffffffef)
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/** Special segment index that indicates that the offset is a relative
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * virtual address (RVA). I.e. an offset from the start of the module. */
c2046db2cc346cc299f0cd9b2d1e160179159cfcvboxsync#define RTDBGSEGIDX_RVA UINT32_C(0xfffffff0)
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/** Special segment index that indicates that the offset is a absolute. */
c2046db2cc346cc299f0cd9b2d1e160179159cfcvboxsync#define RTDBGSEGIDX_ABS UINT32_C(0xfffffff1)
c2046db2cc346cc299f0cd9b2d1e160179159cfcvboxsync/** The last valid special segment index. */
c2046db2cc346cc299f0cd9b2d1e160179159cfcvboxsync#define RTDBGSEGIDX_SPECIAL_LAST RTDBGSEGIDX_ABS
c2046db2cc346cc299f0cd9b2d1e160179159cfcvboxsync/** The last valid special segment index. */
c2046db2cc346cc299f0cd9b2d1e160179159cfcvboxsync#define RTDBGSEGIDX_SPECIAL_FIRST (RTDBGSEGIDX_LAST + 1U)
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
044af0d1e6474076366759db86f101778c5f20ccvboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
2d8870843ff566fee9bd3a6a5942414254106479vboxsync/** @name RTDBGSYMADDR_FLAGS_XXX
2d8870843ff566fee9bd3a6a5942414254106479vboxsync * Flags used when looking up a symbol by address.
2d8870843ff566fee9bd3a6a5942414254106479vboxsync * @{ */
2d8870843ff566fee9bd3a6a5942414254106479vboxsync/** Less or equal address. (default) */
2d8870843ff566fee9bd3a6a5942414254106479vboxsync#define RTDBGSYMADDR_FLAGS_LESS_OR_EQUAL UINT32_C(0)
2d8870843ff566fee9bd3a6a5942414254106479vboxsync/** Greater or equal address. */
2d8870843ff566fee9bd3a6a5942414254106479vboxsync#define RTDBGSYMADDR_FLAGS_GREATER_OR_EQUAL UINT32_C(1)
2d8870843ff566fee9bd3a6a5942414254106479vboxsync/** Mask of valid flags. */
2d8870843ff566fee9bd3a6a5942414254106479vboxsync#define RTDBGSYMADDR_FLAGS_VALID_MASK UINT32_C(1)
2d8870843ff566fee9bd3a6a5942414254106479vboxsync/** @} */
2d8870843ff566fee9bd3a6a5942414254106479vboxsync
2d8870843ff566fee9bd3a6a5942414254106479vboxsync
044af0d1e6474076366759db86f101778c5f20ccvboxsync/** Max length (including '\\0') of a segment name. */
044af0d1e6474076366759db86f101778c5f20ccvboxsync#define RTDBG_SEGMENT_NAME_LENGTH (128 - 8 - 8 - 8 - 4 - 4)
044af0d1e6474076366759db86f101778c5f20ccvboxsync
044af0d1e6474076366759db86f101778c5f20ccvboxsync/**
044af0d1e6474076366759db86f101778c5f20ccvboxsync * Debug module segment.
044af0d1e6474076366759db86f101778c5f20ccvboxsync */
044af0d1e6474076366759db86f101778c5f20ccvboxsynctypedef struct RTDBGSEGMENT
044af0d1e6474076366759db86f101778c5f20ccvboxsync{
044af0d1e6474076366759db86f101778c5f20ccvboxsync /** The load address.
044af0d1e6474076366759db86f101778c5f20ccvboxsync * RTUINTPTR_MAX if not applicable. */
044af0d1e6474076366759db86f101778c5f20ccvboxsync RTUINTPTR Address;
044af0d1e6474076366759db86f101778c5f20ccvboxsync /** The image relative virtual address of the segment.
044af0d1e6474076366759db86f101778c5f20ccvboxsync * RTUINTPTR_MAX if not applicable. */
044af0d1e6474076366759db86f101778c5f20ccvboxsync RTUINTPTR uRva;
044af0d1e6474076366759db86f101778c5f20ccvboxsync /** The segment size. */
044af0d1e6474076366759db86f101778c5f20ccvboxsync RTUINTPTR cb;
044af0d1e6474076366759db86f101778c5f20ccvboxsync /** The segment flags. (reserved) */
044af0d1e6474076366759db86f101778c5f20ccvboxsync uint32_t fFlags;
044af0d1e6474076366759db86f101778c5f20ccvboxsync /** The segment index. */
044af0d1e6474076366759db86f101778c5f20ccvboxsync RTDBGSEGIDX iSeg;
044af0d1e6474076366759db86f101778c5f20ccvboxsync /** Symbol name. */
044af0d1e6474076366759db86f101778c5f20ccvboxsync char szName[RTDBG_SEGMENT_NAME_LENGTH];
044af0d1e6474076366759db86f101778c5f20ccvboxsync} RTDBGSEGMENT;
044af0d1e6474076366759db86f101778c5f20ccvboxsync/** Pointer to a debug module segment. */
044af0d1e6474076366759db86f101778c5f20ccvboxsynctypedef RTDBGSEGMENT *PRTDBGSEGMENT;
044af0d1e6474076366759db86f101778c5f20ccvboxsync/** Pointer to a const debug module segment. */
044af0d1e6474076366759db86f101778c5f20ccvboxsynctypedef RTDBGSEGMENT const *PCRTDBGSEGMENT;
044af0d1e6474076366759db86f101778c5f20ccvboxsync
044af0d1e6474076366759db86f101778c5f20ccvboxsync
044af0d1e6474076366759db86f101778c5f20ccvboxsync
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/** Max length (including '\\0') of a symbol name. */
26dd99476cfbfbbc56ce97f1a4e97f79ec26dc19vboxsync#define RTDBG_SYMBOL_NAME_LENGTH (512 - 8 - 8 - 8 - 4 - 4 - 8)
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/**
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * Debug symbol.
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsynctypedef struct RTDBGSYMBOL
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync{
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync /** Symbol value (address).
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * This depends a bit who you ask. It will be the same as offSeg when you
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * as RTDbgMod, but the mapping address if you ask RTDbgAs. */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync RTUINTPTR Value;
044af0d1e6474076366759db86f101778c5f20ccvboxsync /** Symbol size. */
044af0d1e6474076366759db86f101778c5f20ccvboxsync RTUINTPTR cb;
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync /** Offset into the segment specified by iSeg. */
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync RTUINTPTR offSeg;
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync /** Segment number. */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync RTDBGSEGIDX iSeg;
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync /** Symbol Flags. (reserved). */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync uint32_t fFlags;
044af0d1e6474076366759db86f101778c5f20ccvboxsync /** Symbol ordinal.
044af0d1e6474076366759db86f101778c5f20ccvboxsync * This is set to UINT32_MAX if the ordinals aren't supported. */
044af0d1e6474076366759db86f101778c5f20ccvboxsync uint32_t iOrdinal;
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync /** Symbol name. */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync char szName[RTDBG_SYMBOL_NAME_LENGTH];
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync} RTDBGSYMBOL;
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/** Pointer to debug symbol. */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsynctypedef RTDBGSYMBOL *PRTDBGSYMBOL;
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/** Pointer to const debug symbol. */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsynctypedef const RTDBGSYMBOL *PCRTDBGSYMBOL;
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync/**
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * Allocate a new symbol structure.
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync *
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * @returns Pointer to a new structure on success, NULL on failure.
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync */
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsyncRTDECL(PRTDBGSYMBOL) RTDbgSymbolAlloc(void);
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync/**
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * Duplicates a symbol structure.
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync *
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * @returns Pointer to duplicate on success, NULL on failure.
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync *
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @param pSymInfo The symbol info to duplicate.
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync */
a1df400bbe9d64aad400442e56eb637019300a5evboxsyncRTDECL(PRTDBGSYMBOL) RTDbgSymbolDup(PCRTDBGSYMBOL pSymInfo);
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync/**
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * Free a symbol structure previously allocated by a RTDbg method.
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync *
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @param pSymInfo The symbol info to free. NULL is ignored.
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync */
a1df400bbe9d64aad400442e56eb637019300a5evboxsyncRTDECL(void) RTDbgSymbolFree(PRTDBGSYMBOL pSymInfo);
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync/** Max length (including '\\0') of a debug info file name. */
044af0d1e6474076366759db86f101778c5f20ccvboxsync#define RTDBG_FILE_NAME_LENGTH (260)
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/**
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * Debug line number information.
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsynctypedef struct RTDBGLINE
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync{
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync /** Address.
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * This depends a bit who you ask. It will be the same as offSeg when you
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * as RTDbgMod, but the mapping address if you ask RTDbgAs. */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync RTUINTPTR Address;
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync /** Offset into the segment specified by iSeg. */
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync RTUINTPTR offSeg;
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync /** Segment number. */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync RTDBGSEGIDX iSeg;
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync /** Line number. */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync uint32_t uLineNo;
044af0d1e6474076366759db86f101778c5f20ccvboxsync /** Symbol ordinal.
044af0d1e6474076366759db86f101778c5f20ccvboxsync * This is set to UINT32_MAX if the ordinals aren't supported. */
044af0d1e6474076366759db86f101778c5f20ccvboxsync uint32_t iOrdinal;
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync /** Filename. */
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync char szFilename[RTDBG_FILE_NAME_LENGTH];
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync} RTDBGLINE;
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/** Pointer to debug line number. */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsynctypedef RTDBGLINE *PRTDBGLINE;
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/** Pointer to const debug line number. */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsynctypedef const RTDBGLINE *PCRTDBGLINE;
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync/**
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync * Allocate a new line number structure.
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync *
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync * @returns Pointer to a new structure on success, NULL on failure.
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync */
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsyncRTDECL(PRTDBGLINE) RTDbgLineAlloc(void);
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync/**
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync * Duplicates a line number structure.
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync *
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync * @returns Pointer to duplicate on success, NULL on failure.
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync *
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync * @param pLine The line number to duplicate.
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync */
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsyncRTDECL(PRTDBGLINE) RTDbgLineDup(PCRTDBGLINE pLine);
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync/**
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync * Free a line number structure previously allocated by a RTDbg method.
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync *
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync * @param pLine The line number to free. NULL is ignored.
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsync */
7d80dfbe5d66fc4c6de6fe109ce96a081496dcd4vboxsyncRTDECL(void) RTDbgLineFree(PRTDBGLINE pLine);
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/** @defgroup grp_rt_dbgcfg RTDbgCfg - Debugging Configuration
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync *
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * The settings used when loading and processing debug info is kept in a
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * RTDBGCFG instance since it's generally shared for a whole debugging session
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * and anyhow would be a major pain to pass as individual parameters to each
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * call. The debugging config API not only keeps the settings information but
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * also provide APIs for making use of it, and in some cases, like for instance
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * symbol severs, retriving and maintaining it.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync *
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @todo Work in progress - APIs are still missing, adding when needed.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync *
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @{
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/** Debugging configuration handle. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsynctypedef struct RTDBGCFGINT *RTDBGCFG;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/** Pointer to a debugging configuration handle. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsynctypedef RTDBGCFG *PRTDBGCFG;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/** NIL debug configuration handle. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync#define NIL_RTDBGCFG ((RTDBGCFG)0)
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/** @name RTDBGCFG_FLAGS_XXX - Debugging configuration flags.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @{ */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/** Use deferred loading. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync#define RTDBGCFG_FLAGS_DEFERRED RT_BIT_64(0)
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/** Don't use the symbol server (http). */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync#define RTDBGCFG_FLAGS_NO_SYM_SRV RT_BIT_64(1)
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/** Don't use system search paths.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * On windows this means not using _NT_ALT_SYMBOL_PATH, _NT_SYMBOL_PATH,
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * _NT_SOURCE_PATH, and _NT_EXECUTABLE_PATH.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * On other systems the effect has yet to be determined. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync#define RTDBGCFG_FLAGS_NO_SYSTEM_PATHS RT_BIT_64(2)
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/** Don't search the debug and image paths recursively. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync#define RTDBGCFG_FLAGS_NO_RECURSIV_SEARCH RT_BIT_64(3)
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/** Don't search the source paths recursively. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync#define RTDBGCFG_FLAGS_NO_RECURSIV_SRC_SEARCH RT_BIT_64(4)
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/** @} */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/**
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * Debugging configuration properties.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync *
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * The search paths are using the DOS convention of semicolon as separator
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * character. The the special 'srv' + asterisk syntax known from the windows
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * debugger search paths are also supported to some extent, as is 'cache' +
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * asterisk.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsynctypedef enum RTDBGCFGPROP
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync{
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** The customary invalid 0 value. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync RTDBGCFGPROP_INVALID = 0,
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** RTDBGCFG_FLAGS_XXX.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * Env: _FLAGS
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * The environment variable can be specified as a unsigned value or one or more
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * mnemonics separated by spaces. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync RTDBGCFGPROP_FLAGS,
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** List of paths to search for symbol files and images.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * Env: _PATH */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync RTDBGCFGPROP_PATH,
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** List of symbol file suffixes (semicolon separated).
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * Env: _SUFFIXES */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync RTDBGCFGPROP_SUFFIXES,
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** List of paths to search for source files.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * Env: _SRC_PATH */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync RTDBGCFGPROP_SRC_PATH,
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** End of valid values. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync RTDBGCFGPROP_END,
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** The customary 32-bit type hack. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync RTDBGCFGPROP_32BIT_HACK = 0x7fffffff
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync} RTDBGCFGPROP;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/**
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * Configuration property change operation.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsynctypedef enum RTDBGCFGOP
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync{
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** Customary invalid 0 value. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync RTDBGCFGOP_INVALID = 0,
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** Replace the current value with the given one. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync RTDBGCFGOP_SET,
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** Append the given value to the existing one. For integer values this is
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * considered a bitwise OR operation. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync RTDBGCFGOP_APPEND,
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** Prepend the given value to the existing one. For integer values this is
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * considered a bitwise OR operation. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync RTDBGCFGOP_PREPEND,
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** Removes the value from the existing one. For interger values the value is
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * complemented and ANDed with the existing one, clearing all the specified
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * flags/bits. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync RTDBGCFGOP_REMOVE,
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** End of valid values. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync RTDBGCFGOP_END,
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync /** Customary 32-bit type hack. */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync RTDBGCFGOP_32BIT_HACK = 0x7fffffff
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync} RTDBGCFGOP;
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/**
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * Initializes a debugging configuration.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync *
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @returns IPRT status code.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @param phDbgCfg Where to return the configuration handle.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @param pszEnvVarPrefix The environment variable prefix. If NULL, the
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * environment is not consulted.
0109a2240391a89f6556b1545e6cc57f9efab060vboxsync * @param fNativePaths Whether to pick up native paths from the
0109a2240391a89f6556b1545e6cc57f9efab060vboxsync * environment.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync *
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @sa RTDbgCfgChangeString, RTDbgCfgChangeUInt.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync */
0109a2240391a89f6556b1545e6cc57f9efab060vboxsyncRTDECL(int) RTDbgCfgCreate(PRTDBGCFG phDbgCfg, const char *pszEnvVarPrefix, bool fNativePaths);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/**
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * Retains a new reference to a debugging config.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync *
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @returns New reference count.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * UINT32_MAX is returned if the handle is invalid (asserted).
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @param hDbgCfg The config handle.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncRTDECL(uint32_t) RTDbgCfgRetain(RTDBGCFG hDbgCfg);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/**
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * Releases a references to a debugging config.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync *
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @returns New reference count, if 0 the config was freed. UINT32_MAX is
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * returned if the handle is invalid (asserted).
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @param hDbgCfg The config handle.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncRTDECL(uint32_t) RTDbgCfgRelease(RTDBGCFG hDbgCfg);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/**
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * Changes a property value by string.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync *
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * For string values the string is used more or less as given. For integer
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * values and flags, it can contains both values (ORed together) or property
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * specific mnemonics (ORed / ~ANDed).
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync *
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @returns IPRT status code.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @retval VERR_DBG_CFG_INVALID_VALUE
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @param hDbgCfg The debugging configuration handle.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @param enmProp The property to change.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @param enmOp How to change the property.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @param pszValue The property value to apply.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncRTDECL(int) RTDbgCfgChangeString(RTDBGCFG hDbgCfg, RTDBGCFGPROP enmProp, RTDBGCFGOP enmOp, const char *pszValue);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/**
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * Changes a property value by unsigned integer (64-bit).
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync *
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * This can only be applied to integer and flag properties.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync *
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @returns IPRT status code.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @retval VERR_DBG_CFG_NOT_UINT_PROP
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @param hDbgCfg The debugging configuration handle.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @param enmProp The property to change.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @param enmOp How to change the property.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @param uValue The property value to apply.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncRTDECL(int) RTDbgCfgChangeUInt(RTDBGCFG hDbgCfg, RTDBGCFGPROP enmProp, RTDBGCFGOP enmOp, uint64_t uValue);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/**
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * Query a property value as string.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync *
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * Integer and flags properties are returned as a list of mnemonics if possible,
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * otherwise as simple hex values.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync *
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @returns IPRT status code.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @retval VERR_BUFFER_OVERFLOW if there isn't sufficient buffer space. Nothing
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * is written.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @param hDbgCfg The debugging configuration handle.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @param enmProp The property to change.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @param pszValue The output buffer.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @param cbValue The size of the output buffer.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncRTDECL(int) RTDbgCfgQueryString(RTDBGCFG hDbgCfg, RTDBGCFGPROP enmProp, char *pszValue, size_t cbValue);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/**
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * Query a property value as unsigned integer (64-bit).
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync *
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * Only integer and flags properties can be queried this way.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync *
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @returns IPRT status code.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @retval VERR_DBG_CFG_NOT_UINT_PROP
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @param hDbgCfg The debugging configuration handle.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @param enmProp The property to change.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync * @param puValue Where to return the value.
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncRTDECL(int) RTDbgCfgQueryUInt(RTDBGCFG hDbgCfg, RTDBGCFGPROP enmProp, uint64_t *puValue);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
d6f8b76ab3b2ec0c270c96f9db6e2568fc41b5fevboxsync/**
d6f8b76ab3b2ec0c270c96f9db6e2568fc41b5fevboxsync * Log callback.
d6f8b76ab3b2ec0c270c96f9db6e2568fc41b5fevboxsync *
d6f8b76ab3b2ec0c270c96f9db6e2568fc41b5fevboxsync * @param hDbgCfg The debug config instance.
d6f8b76ab3b2ec0c270c96f9db6e2568fc41b5fevboxsync * @param iLevel The message level.
d6f8b76ab3b2ec0c270c96f9db6e2568fc41b5fevboxsync * @param pszMsg The message.
d6f8b76ab3b2ec0c270c96f9db6e2568fc41b5fevboxsync * @param pvUser User argument.
d6f8b76ab3b2ec0c270c96f9db6e2568fc41b5fevboxsync */
d6f8b76ab3b2ec0c270c96f9db6e2568fc41b5fevboxsynctypedef DECLCALLBACK(void) FNRTDBGCFGLOG(RTDBGCFG hDbgCfg, uint32_t iLevel, const char *pszMsg, void *pvUser);
d6f8b76ab3b2ec0c270c96f9db6e2568fc41b5fevboxsync/** Pointer to a log callback. */
d6f8b76ab3b2ec0c270c96f9db6e2568fc41b5fevboxsynctypedef FNRTDBGCFGLOG *PFNRTDBGCFGLOG;
d6f8b76ab3b2ec0c270c96f9db6e2568fc41b5fevboxsync
d6f8b76ab3b2ec0c270c96f9db6e2568fc41b5fevboxsync/**
d6f8b76ab3b2ec0c270c96f9db6e2568fc41b5fevboxsync * Sets the log callback for the configuration.
d6f8b76ab3b2ec0c270c96f9db6e2568fc41b5fevboxsync *
d6f8b76ab3b2ec0c270c96f9db6e2568fc41b5fevboxsync * This will fail if there is already a log callback present, unless pfnCallback
d6f8b76ab3b2ec0c270c96f9db6e2568fc41b5fevboxsync * is NULL.
d6f8b76ab3b2ec0c270c96f9db6e2568fc41b5fevboxsync *
d6f8b76ab3b2ec0c270c96f9db6e2568fc41b5fevboxsync * @returns IPRT status code.
d6f8b76ab3b2ec0c270c96f9db6e2568fc41b5fevboxsync * @param hDbgCfg The debugging configuration handle.
d6f8b76ab3b2ec0c270c96f9db6e2568fc41b5fevboxsync * @param pfnCallback The callback function. NULL to unset.
d6f8b76ab3b2ec0c270c96f9db6e2568fc41b5fevboxsync * @param pvUser The user argument.
d6f8b76ab3b2ec0c270c96f9db6e2568fc41b5fevboxsync */
d6f8b76ab3b2ec0c270c96f9db6e2568fc41b5fevboxsyncRTDECL(int) RTDbgCfgSetLogCallback(RTDBGCFG hDbgCfg, PFNRTDBGCFGLOG pfnCallback, void *pvUser);
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync/**
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync * Callback used by the RTDbgCfgOpen function to try out a file that was found.
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync *
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync * @returns On statuses other than VINF_CALLBACK_RETURN and
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync * VERR_CALLBACK_RETURN the search will continue till the end of the
9af7167fa39f1f139899c989da973e59b9cccc3fvboxsync * list. These status codes will not necessarily be propagated to the
9af7167fa39f1f139899c989da973e59b9cccc3fvboxsync * caller in any consistent manner.
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync * @retval VINF_CALLBACK_RETURN if successuflly opened the file and it's time
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync * to return
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync * @retval VERR_CALLBACK_RETURN if we shouldn't stop searching.
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync *
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync * @param hDbgCfg The debugging configuration handle.
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync * @param pszFilename The path to the file that should be tried out.
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync * @param pvUser1 First user parameter.
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync * @param pvUser2 Second user parameter.
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync */
daa94352f51be2329ac8660f70396e03a7cb983bvboxsynctypedef DECLCALLBACK(int) FNDBGCFGOPEN(RTDBGCFG hDbgCfg, const char *pszFilename, void *pvUser1, void *pvUser2);
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync/** Pointer to a open-file callback used to the RTDbgCfgOpen functions. */
daa94352f51be2329ac8660f70396e03a7cb983bvboxsynctypedef FNDBGCFGOPEN *PFNDBGCFGOPEN;
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync
daa94352f51be2329ac8660f70396e03a7cb983bvboxsyncRTDECL(int) RTDbgCfgOpenPeImage(RTDBGCFG hDbgCfg, const char *pszFilename, uint32_t cbImage, uint32_t uTimestamp,
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2);
daa94352f51be2329ac8660f70396e03a7cb983bvboxsyncRTDECL(int) RTDbgCfgOpenPdb70(RTDBGCFG hDbgCfg, const char *pszFilename, PCRTUUID pUuid, uint32_t uAge,
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2);
daa94352f51be2329ac8660f70396e03a7cb983bvboxsyncRTDECL(int) RTDbgCfgOpenPdb20(RTDBGCFG hDbgCfg, const char *pszFilename, uint32_t cbImage, uint32_t uTimestamp, uint32_t uAge,
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2);
daa94352f51be2329ac8660f70396e03a7cb983bvboxsyncRTDECL(int) RTDbgCfgOpenDbg(RTDBGCFG hDbgCfg, const char *pszFilename, uint32_t cbImage, uint32_t uTimestamp,
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2);
daa94352f51be2329ac8660f70396e03a7cb983bvboxsyncRTDECL(int) RTDbgCfgOpenDwo(RTDBGCFG hDbgCfg, const char *pszFilename, uint32_t uCrc32,
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2);
6ba706e9f431401d425d16817fdcd6316f83b584vboxsyncRTDECL(int) RTDbgCfgOpenDsymBundle(RTDBGCFG hDbgCfg, const char *pszFilename, PCRTUUID pUuid,
6ba706e9f431401d425d16817fdcd6316f83b584vboxsync PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2);
e0d6f087507011df5f570f6800a2c332f8970e58vboxsyncRTDECL(int) RTDbgCfgOpenMachOImage(RTDBGCFG hDbgCfg, const char *pszFilename, PCRTUUID pUuid,
e0d6f087507011df5f570f6800a2c332f8970e58vboxsync PFNDBGCFGOPEN pfnCallback, void *pvUser1, void *pvUser2);
6ba706e9f431401d425d16817fdcd6316f83b584vboxsync
d6f8b76ab3b2ec0c270c96f9db6e2568fc41b5fevboxsync
9ec22033341c104cf895501e1c2347b15a21ec1evboxsync/** @name Static symbol cache configuration
9ec22033341c104cf895501e1c2347b15a21ec1evboxsync * @{ */
9ec22033341c104cf895501e1c2347b15a21ec1evboxsync/** The cache subdirectory containing the UUID mappings for .dSYM bundles.
9ec22033341c104cf895501e1c2347b15a21ec1evboxsync * The UUID mappings implemented by IPRT are splitting the image/dsym UUID up
9ec22033341c104cf895501e1c2347b15a21ec1evboxsync * into five 4 digit parts that maps to directories and one twelve digit part
9ec22033341c104cf895501e1c2347b15a21ec1evboxsync * that maps to a symbolic link. The symlink points to the file in the
9ec22033341c104cf895501e1c2347b15a21ec1evboxsync * Contents/Resources/DWARF/ directory of the .dSYM bundle for a .dSYM map, and
9ec22033341c104cf895501e1c2347b15a21ec1evboxsync * to the image file (Contents/MacOS/bundlename for bundles) for image map.
9ec22033341c104cf895501e1c2347b15a21ec1evboxsync *
9ec22033341c104cf895501e1c2347b15a21ec1evboxsync * According to available documentation, both lldb and gdb are able to use these
9ec22033341c104cf895501e1c2347b15a21ec1evboxsync * UUID maps to find debug info while debugging. See:
9ec22033341c104cf895501e1c2347b15a21ec1evboxsync * http://lldb.llvm.org/symbols.html
9ec22033341c104cf895501e1c2347b15a21ec1evboxsync */
9ec22033341c104cf895501e1c2347b15a21ec1evboxsync#define RTDBG_CACHE_UUID_MAP_DIR_DSYMS "dsym-uuids"
9ec22033341c104cf895501e1c2347b15a21ec1evboxsync/** The cache subdirectory containing the UUID mappings for image files. */
9ec22033341c104cf895501e1c2347b15a21ec1evboxsync#define RTDBG_CACHE_UUID_MAP_DIR_IMAGES "image-uuids"
9ec22033341c104cf895501e1c2347b15a21ec1evboxsync/** Suffix used for the cached .dSYM debug files.
9ec22033341c104cf895501e1c2347b15a21ec1evboxsync * In .dSYM bundles only the .dSYM/Contents/Resources/DWARF/debug-file is
9ec22033341c104cf895501e1c2347b15a21ec1evboxsync * copied into the cache, and in order to not clash with the stripped/rich image
9ec22033341c104cf895501e1c2347b15a21ec1evboxsync * file, the cache tool slaps this suffix onto the name. */
9ec22033341c104cf895501e1c2347b15a21ec1evboxsync#define RTDBG_CACHE_DSYM_FILE_SUFFIX ".dwarf"
9ec22033341c104cf895501e1c2347b15a21ec1evboxsync/** @} */
9ec22033341c104cf895501e1c2347b15a21ec1evboxsync
9ec22033341c104cf895501e1c2347b15a21ec1evboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync/** @} */
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/** @defgroup grp_rt_dbgas RTDbgAs - Debug Address Space
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * @{
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync */
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync/**
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * Creates an empty address space.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @returns IPRT status code.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param phDbgAs Where to store the address space handle on success.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param FirstAddr The first address in the address space.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param LastAddr The last address in the address space.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param pszName The name of the address space.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync */
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsyncRTDECL(int) RTDbgAsCreate(PRTDBGAS phDbgAs, RTUINTPTR FirstAddr, RTUINTPTR LastAddr, const char *pszName);
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync/**
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * Variant of RTDbgAsCreate that takes a name format string.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @returns IPRT status code.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param phDbgAs Where to store the address space handle on success.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param FirstAddr The first address in the address space.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param LastAddr The last address in the address space.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param pszNameFmt The name format of the address space.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param va Format arguments.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync */
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsyncRTDECL(int) RTDbgAsCreateV(PRTDBGAS phDbgAs, RTUINTPTR FirstAddr, RTUINTPTR LastAddr, const char *pszNameFmt, va_list va);
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync/**
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * Variant of RTDbgAsCreate that takes a name format string.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @returns IPRT status code.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param phDbgAs Where to store the address space handle on success.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param FirstAddr The first address in the address space.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param LastAddr The last address in the address space.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param pszNameFmt The name format of the address space.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param ... Format arguments.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync */
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsyncRTDECL(int) RTDbgAsCreateF(PRTDBGAS phDbgAs, RTUINTPTR FirstAddr, RTUINTPTR LastAddr, const char *pszNameFmt, ...);
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync/**
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync * Retains a reference to the address space.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync * @returns New reference count, UINT32_MAX on invalid handle (asserted).
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync *
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync * @param hDbgAs The address space handle.
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync *
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync * @remarks Will not take any locks.
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync */
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsyncRTDECL(uint32_t) RTDbgAsRetain(RTDBGAS hDbgAs);
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync/**
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync * Release a reference to the address space.
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync *
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync * When the reference count reaches zero, the address space is destroyed.
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync * That means unlinking all the modules it currently contains, potentially
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * causing some or all of them to be destroyed as they are managed by
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * reference counting.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync * @returns New reference count, UINT32_MAX on invalid handle (asserted).
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync * @param hDbgAs The address space handle. The NIL handle is quietly
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync * ignored and 0 is returned.
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync *
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync * @remarks Will not take any locks.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync */
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsyncRTDECL(uint32_t) RTDbgAsRelease(RTDBGAS hDbgAs);
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync
31771163041e3661403a806eb3382d2a165c003bvboxsync/**
31771163041e3661403a806eb3382d2a165c003bvboxsync * Locks the address space for exclusive access.
31771163041e3661403a806eb3382d2a165c003bvboxsync *
31771163041e3661403a806eb3382d2a165c003bvboxsync * @returns IRPT status code
31771163041e3661403a806eb3382d2a165c003bvboxsync * @param hDbgAs The address space handle.
31771163041e3661403a806eb3382d2a165c003bvboxsync */
31771163041e3661403a806eb3382d2a165c003bvboxsyncRTDECL(int) RTDbgAsLockExcl(RTDBGAS hDbgAs);
31771163041e3661403a806eb3382d2a165c003bvboxsync
31771163041e3661403a806eb3382d2a165c003bvboxsync/**
31771163041e3661403a806eb3382d2a165c003bvboxsync * Counters the actions of one RTDbgAsUnlockExcl call.
31771163041e3661403a806eb3382d2a165c003bvboxsync *
31771163041e3661403a806eb3382d2a165c003bvboxsync * @returns IRPT status code
31771163041e3661403a806eb3382d2a165c003bvboxsync * @param hDbgAs The address space handle.
31771163041e3661403a806eb3382d2a165c003bvboxsync */
31771163041e3661403a806eb3382d2a165c003bvboxsyncRTDECL(int) RTDbgAsUnlockExcl(RTDBGAS hDbgAs);
31771163041e3661403a806eb3382d2a165c003bvboxsync
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync/**
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * Gets the name of an address space.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @returns read only address space name.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * NULL if hDbgAs is invalid.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param hDbgAs The address space handle.
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync *
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync * @remarks Will not take any locks.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync */
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsyncRTDECL(const char *) RTDbgAsName(RTDBGAS hDbgAs);
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync/**
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * Gets the first address in an address space.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @returns The address.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * 0 if hDbgAs is invalid.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param hDbgAs The address space handle.
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync *
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync * @remarks Will not take any locks.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync */
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsyncRTDECL(RTUINTPTR) RTDbgAsFirstAddr(RTDBGAS hDbgAs);
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync/**
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * Gets the last address in an address space.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @returns The address.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * 0 if hDbgAs is invalid.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param hDbgAs The address space handle.
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync *
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync * @remarks Will not take any locks.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync */
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsyncRTDECL(RTUINTPTR) RTDbgAsLastAddr(RTDBGAS hDbgAs);
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync/**
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * Gets the number of modules in the address space.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * This can be used together with RTDbgAsModuleByIndex
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * to enumerate the modules.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @returns The number of modules.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param hDbgAs The address space handle.
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync *
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync * @remarks Will not take any locks.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync */
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsyncRTDECL(uint32_t) RTDbgAsModuleCount(RTDBGAS hDbgAs);
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync/** @name Flags for RTDbgAsModuleLink and RTDbgAsModuleLinkSeg
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync * @{ */
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync/** Replace all conflicting module.
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync * (The conflicting modules will be removed the address space and their
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync * references released.) */
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync#define RTDBGASLINK_FLAGS_REPLACE RT_BIT_32(0)
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync/** Mask containing the valid flags. */
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync#define RTDBGASLINK_FLAGS_VALID_MASK UINT32_C(0x00000001)
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync/** @} */
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync/**
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * Links a module into the address space at the give address.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * The size of the mapping is determined using RTDbgModImageSize().
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @returns IPRT status code.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @retval VERR_OUT_OF_RANGE if the specified address will put the module
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * outside the address space.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @retval VERR_ADDRESS_CONFLICT if the mapping clashes with existing mappings.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param hDbgAs The address space handle.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param hDbgMod The module handle of the module to be linked in.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param ImageAddr The address to link the module at.
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync * @param fFlags See RTDBGASLINK_FLAGS_*.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync */
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsyncRTDECL(int) RTDbgAsModuleLink(RTDBGAS hDbgAs, RTDBGMOD hDbgMod, RTUINTPTR ImageAddr, uint32_t fFlags);
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync/**
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * Links a segment into the address space at the give address.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * The size of the mapping is determined using RTDbgModSegmentSize().
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @returns IPRT status code.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @retval VERR_OUT_OF_RANGE if the specified address will put the module
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * outside the address space.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @retval VERR_ADDRESS_CONFLICT if the mapping clashes with existing mappings.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param hDbgAs The address space handle.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param hDbgMod The module handle.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param iSeg The segment number (0-based) of the segment to be
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * linked in.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param SegAddr The address to link the segment at.
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsync * @param fFlags See RTDBGASLINK_FLAGS_*.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync */
9939c713bffcfc4305d99d994552aa2ad9bce097vboxsyncRTDECL(int) RTDbgAsModuleLinkSeg(RTDBGAS hDbgAs, RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR SegAddr, uint32_t fFlags);
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync/**
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * Unlinks all the mappings of a module from the address space.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @returns IPRT status code.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @retval VERR_NOT_FOUND if the module wasn't found.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param hDbgAs The address space handle.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param hDbgMod The module handle of the module to be unlinked.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync */
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsyncRTDECL(int) RTDbgAsModuleUnlink(RTDBGAS hDbgAs, RTDBGMOD hDbgMod);
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync/**
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * Unlinks the mapping at the specified address.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @returns IPRT status code.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @retval VERR_NOT_FOUND if no module or segment is mapped at that address.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param hDbgAs The address space handle.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param Addr The address within the mapping to be unlinked.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync */
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsyncRTDECL(int) RTDbgAsModuleUnlinkByAddr(RTDBGAS hDbgAs, RTUINTPTR Addr);
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync/**
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * Get a the handle of a module in the address space by is index.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @returns A retained handle to the specified module. The caller must release
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * the returned reference.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * NIL_RTDBGMOD if invalid index or handle.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param hDbgAs The address space handle.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param iModule The index of the module to get.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @remarks The module indexes may change after calls to RTDbgAsModuleLink,
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * RTDbgAsModuleLinkSeg, RTDbgAsModuleUnlink and
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * RTDbgAsModuleUnlinkByAddr.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync */
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsyncRTDECL(RTDBGMOD) RTDbgAsModuleByIndex(RTDBGAS hDbgAs, uint32_t iModule);
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync/**
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * Queries mapping module information by handle.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @returns IPRT status code.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @retval VERR_NOT_FOUND if no mapping was found at the specified address.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param hDbgAs The address space handle.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param Addr Address within the mapping of the module or segment.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param phMod Where to the return the retained module handle.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * Optional.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param pAddr Where to return the base address of the mapping.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * Optional.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param piSeg Where to return the segment index. This is set to
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * NIL if the entire module is mapped as a single
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * mapping. Optional.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync */
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsyncRTDECL(int) RTDbgAsModuleByAddr(RTDBGAS hDbgAs, RTUINTPTR Addr, PRTDBGMOD phMod, PRTUINTPTR pAddr, PRTDBGSEGIDX piSeg);
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync/**
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * Queries mapping module information by name.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @returns IPRT status code.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @retval VERR_NOT_FOUND if no mapping was found at the specified address.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @retval VERR_OUT_OF_RANGE if the name index was out of range.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param hDbgAs The address space handle.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param pszName The module name.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param iName There can be more than one module by the same name
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * in an address space. This argument indicates which
ad27e1d5e48ca41245120c331cc88b50464813cevboxsync * is meant. (0 based)
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param phMod Where to the return the retained module handle.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync */
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsyncRTDECL(int) RTDbgAsModuleByName(RTDBGAS hDbgAs, const char *pszName, uint32_t iName, PRTDBGMOD phMod);
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync/**
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync * Information about a mapping.
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync *
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync * This is used by RTDbgAsModuleGetMapByIndex.
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync */
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsynctypedef struct RTDBGASMAPINFO
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync{
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync /** The mapping address. */
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync RTUINTPTR Address;
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync /** The segment mapped there.
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync * This is NIL_RTDBGSEGIDX if the entire module image is mapped here. */
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync RTDBGSEGIDX iSeg;
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync} RTDBGASMAPINFO;
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync/** Pointer to info about an address space mapping. */
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsynctypedef RTDBGASMAPINFO *PRTDBGASMAPINFO;
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync/** Pointer to const info about an address space mapping. */
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsynctypedef RTDBGASMAPINFO const *PCRTDBGASMAPINFO;
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync/**
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync * Queries mapping information for a module given by index.
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync *
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync * @returns IRPT status code.
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync * @retval VERR_INVALID_HANDLE if hDbgAs is invalid.
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync * @retval VERR_OUT_OF_RANGE if the name index was out of range.
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync * @retval VINF_BUFFER_OVERFLOW if the array is too small and the returned
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync * information is incomplete.
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync *
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync * @param hDbgAs The address space handle.
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync * @param iModule The index of the module to get.
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync * @param paMappings Where to return the mapping information. The buffer
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync * size is given by *pcMappings.
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync * @param pcMappings IN: Size of the paMappings array. OUT: The number of
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync * entries returned.
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync * @param fFlags Flags for reserved for future use. MBZ.
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync *
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync * @remarks See remarks for RTDbgAsModuleByIndex regarding the volatility of the
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync * iModule parameter.
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync */
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsyncRTDECL(int) RTDbgAsModuleQueryMapByIndex(RTDBGAS hDbgAs, uint32_t iModule, PRTDBGASMAPINFO paMappings, uint32_t *pcMappings, uint32_t fFlags);
9b19ad593b379ebfcc8273f85b90763b14b1da63vboxsync
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync/**
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * Adds a symbol to a module in the address space.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @returns IPRT status code. See RTDbgModSymbolAdd for more specific ones.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @retval VERR_INVALID_HANDLE if hDbgAs is invalid.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @retval VERR_NOT_FOUND if no module was found at the specified address.
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * @retval VERR_NOT_SUPPORTED if the module interpret doesn't support adding
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * custom symbols.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param hDbgAs The address space handle.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param pszSymbol The symbol name.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param Addr The address of the symbol.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param cb The size of the symbol.
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsync * @param fFlags Symbol flags.
044af0d1e6474076366759db86f101778c5f20ccvboxsync * @param piOrdinal Where to return the symbol ordinal on success. If
044af0d1e6474076366759db86f101778c5f20ccvboxsync * the interpreter doesn't do ordinals, this will be set to
044af0d1e6474076366759db86f101778c5f20ccvboxsync * UINT32_MAX. Optional
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync */
044af0d1e6474076366759db86f101778c5f20ccvboxsyncRTDECL(int) RTDbgAsSymbolAdd(RTDBGAS hDbgAs, const char *pszSymbol, RTUINTPTR Addr, RTUINTPTR cb, uint32_t fFlags, uint32_t *piOrdinal);
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync/**
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * Query a symbol by address.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @returns IPRT status code. See RTDbgModSymbolAddr for more specific ones.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @retval VERR_INVALID_HANDLE if hDbgAs is invalid.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @retval VERR_NOT_FOUND if the address couldn't be mapped to a module.
2d8870843ff566fee9bd3a6a5942414254106479vboxsync * @retval VERR_INVALID_PARAMETER if incorrect flags.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param hDbgAs The address space handle.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param Addr The address which closest symbol is requested.
2d8870843ff566fee9bd3a6a5942414254106479vboxsync * @param fFlags Symbol search flags, see RTDBGSYMADDR_FLAGS_XXX.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param poffDisp Where to return the distance between the symbol
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * and address. Optional.
88acfa6629a7976c0583c1712d2b5b22a87a5121vboxsync * @param pSymbol Where to return the symbol info.
9d020a0622f95aec3aabaff436a495e88dbbd71avboxsync * @param phMod Where to return the module handle. Optional.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync */
2d8870843ff566fee9bd3a6a5942414254106479vboxsyncRTDECL(int) RTDbgAsSymbolByAddr(RTDBGAS hDbgAs, RTUINTPTR Addr, uint32_t fFlags,
2d8870843ff566fee9bd3a6a5942414254106479vboxsync PRTINTPTR poffDisp, PRTDBGSYMBOL pSymbol, PRTDBGMOD phMod);
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync/**
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * Query a symbol by address.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @returns IPRT status code. See RTDbgModSymbolAddrA for more specific ones.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @retval VERR_INVALID_HANDLE if hDbgAs is invalid.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @retval VERR_NOT_FOUND if the address couldn't be mapped to a module.
2d8870843ff566fee9bd3a6a5942414254106479vboxsync * @retval VERR_INVALID_PARAMETER if incorrect flags.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param hDbgAs The address space handle.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param Addr The address which closest symbol is requested.
2d8870843ff566fee9bd3a6a5942414254106479vboxsync * @param fFlags Symbol search flags, see RTDBGSYMADDR_FLAGS_XXX.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param poffDisp Where to return the distance between the symbol
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * and address. Optional.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * @param ppSymInfo Where to return the pointer to the allocated symbol
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * info. Always set. Free with RTDbgSymbolFree.
9d020a0622f95aec3aabaff436a495e88dbbd71avboxsync * @param phMod Where to return the module handle. Optional.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync */
2d8870843ff566fee9bd3a6a5942414254106479vboxsyncRTDECL(int) RTDbgAsSymbolByAddrA(RTDBGAS hDbgAs, RTUINTPTR Addr, uint32_t fFlags,
2d8870843ff566fee9bd3a6a5942414254106479vboxsync PRTINTPTR poffDisp, PRTDBGSYMBOL *ppSymInfo, PRTDBGMOD phMod);
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync/**
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * Query a symbol by name.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @returns IPRT status code.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @retval VERR_SYMBOL_NOT_FOUND if not found.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param hDbgAs The address space handle.
9d020a0622f95aec3aabaff436a495e88dbbd71avboxsync * @param pszSymbol The symbol name. It is possible to limit the scope
9d020a0622f95aec3aabaff436a495e88dbbd71avboxsync * of the search by prefixing the symbol with a module
9d020a0622f95aec3aabaff436a495e88dbbd71avboxsync * name pattern followed by a bang (!) character.
9d020a0622f95aec3aabaff436a495e88dbbd71avboxsync * RTStrSimplePatternNMatch is used for the matching.
9d020a0622f95aec3aabaff436a495e88dbbd71avboxsync * @param pSymbol Where to return the symbol info.
9d020a0622f95aec3aabaff436a495e88dbbd71avboxsync * @param phMod Where to return the module handle. Optional.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync */
9d020a0622f95aec3aabaff436a495e88dbbd71avboxsyncRTDECL(int) RTDbgAsSymbolByName(RTDBGAS hDbgAs, const char *pszSymbol, PRTDBGSYMBOL pSymbol, PRTDBGMOD phMod);
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync/**
9d020a0622f95aec3aabaff436a495e88dbbd71avboxsync * Query a symbol by name, allocating the returned symbol structure.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @returns IPRT status code.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @retval VERR_SYMBOL_NOT_FOUND if not found.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param hDbgAs The address space handle.
9d020a0622f95aec3aabaff436a495e88dbbd71avboxsync * @param pszSymbol The symbol name. See RTDbgAsSymbolByName for more.
9d020a0622f95aec3aabaff436a495e88dbbd71avboxsync * @param ppSymbol Where to return the pointer to the allocated
9d020a0622f95aec3aabaff436a495e88dbbd71avboxsync * symbol info. Always set. Free with RTDbgSymbolFree.
9d020a0622f95aec3aabaff436a495e88dbbd71avboxsync * @param phMod Where to return the module handle. Optional.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync */
9d020a0622f95aec3aabaff436a495e88dbbd71avboxsyncRTDECL(int) RTDbgAsSymbolByNameA(RTDBGAS hDbgAs, const char *pszSymbol, PRTDBGSYMBOL *ppSymbol, PRTDBGMOD phMod);
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync
044af0d1e6474076366759db86f101778c5f20ccvboxsync/**
044af0d1e6474076366759db86f101778c5f20ccvboxsync * Adds a line number to a module in the address space.
044af0d1e6474076366759db86f101778c5f20ccvboxsync *
682342827b0e80c493c820603508e79e76c42658vboxsync * @returns IPRT status code. See RTDbgModLineAdd for more specific ones.
044af0d1e6474076366759db86f101778c5f20ccvboxsync * @retval VERR_INVALID_HANDLE if hDbgAs is invalid.
044af0d1e6474076366759db86f101778c5f20ccvboxsync * @retval VERR_NOT_FOUND if no module was found at the specified address.
044af0d1e6474076366759db86f101778c5f20ccvboxsync * @retval VERR_NOT_SUPPORTED if the module interpret doesn't support adding
044af0d1e6474076366759db86f101778c5f20ccvboxsync * custom symbols.
044af0d1e6474076366759db86f101778c5f20ccvboxsync *
044af0d1e6474076366759db86f101778c5f20ccvboxsync * @param hDbgAs The address space handle.
044af0d1e6474076366759db86f101778c5f20ccvboxsync * @param pszFile The file name.
044af0d1e6474076366759db86f101778c5f20ccvboxsync * @param uLineNo The line number.
044af0d1e6474076366759db86f101778c5f20ccvboxsync * @param Addr The address of the symbol.
044af0d1e6474076366759db86f101778c5f20ccvboxsync * @param piOrdinal Where to return the line number ordinal on success.
044af0d1e6474076366759db86f101778c5f20ccvboxsync * If the interpreter doesn't do ordinals, this will be
044af0d1e6474076366759db86f101778c5f20ccvboxsync * set to UINT32_MAX. Optional.
044af0d1e6474076366759db86f101778c5f20ccvboxsync */
044af0d1e6474076366759db86f101778c5f20ccvboxsyncRTDECL(int) RTDbgAsLineAdd(RTDBGAS hDbgAs, const char *pszFile, uint32_t uLineNo, RTUINTPTR Addr, uint32_t *piOrdinal);
044af0d1e6474076366759db86f101778c5f20ccvboxsync
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync/**
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync * Query a line number by address.
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync *
682342827b0e80c493c820603508e79e76c42658vboxsync * @returns IPRT status code. See RTDbgModLineAddrA for more specific ones.
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync * @retval VERR_INVALID_HANDLE if hDbgAs is invalid.
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync * @retval VERR_NOT_FOUND if the address couldn't be mapped to a module.
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync *
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync * @param hDbgAs The address space handle.
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync * @param Addr The address which closest symbol is requested.
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync * @param poffDisp Where to return the distance between the line
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync * number and address.
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync * @param pLine Where to return the line number information.
682342827b0e80c493c820603508e79e76c42658vboxsync * @param phMod Where to return the module handle. Optional.
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync */
682342827b0e80c493c820603508e79e76c42658vboxsyncRTDECL(int) RTDbgAsLineByAddr(RTDBGAS hDbgAs, RTUINTPTR Addr, PRTINTPTR poffDisp, PRTDBGLINE pLine, PRTDBGMOD phMod);
5eda82e218d35ae0691febd531e1bfc0324cc4a6vboxsync
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync/**
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * Query a line number by address.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
682342827b0e80c493c820603508e79e76c42658vboxsync * @returns IPRT status code. See RTDbgModLineAddrA for more specific ones.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @retval VERR_INVALID_HANDLE if hDbgAs is invalid.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @retval VERR_NOT_FOUND if the address couldn't be mapped to a module.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync *
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param hDbgAs The address space handle.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param Addr The address which closest symbol is requested.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param poffDisp Where to return the distance between the line
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * number and address.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * @param ppLine Where to return the pointer to the allocated line
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync * number info. Always set. Free with RTDbgLineFree.
682342827b0e80c493c820603508e79e76c42658vboxsync * @param phMod Where to return the module handle. Optional.
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync */
682342827b0e80c493c820603508e79e76c42658vboxsyncRTDECL(int) RTDbgAsLineByAddrA(RTDBGAS hDbgAs, RTUINTPTR Addr, PRTINTPTR poffDisp, PRTDBGLINE *ppLine, PRTDBGMOD phMod);
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync/** @todo Missing some bits here. */
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/** @} */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsync/** @defgroup grp_rt_dbgmod RTDbgMod - Debug Module Interpreter
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync * @{
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync */
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync/**
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * Creates a module based on the default debug info container.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
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.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @returns IPRT status code.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param phDbgMod Where to return the module handle.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @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.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param fFlags Flags reserved for future extensions, MBZ for now.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync */
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsyncRTDECL(int) RTDbgModCreate(PRTDBGMOD phDbgMod, const char *pszName, RTUINTPTR cbSeg, uint32_t fFlags);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncRTDECL(int) RTDbgModCreateFromImage(PRTDBGMOD phDbgMod, const char *pszFilename, const char *pszName,
6ba706e9f431401d425d16817fdcd6316f83b584vboxsync RTLDRARCH enmArch, RTDBGCFG hDbgCfg);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncRTDECL(int) RTDbgModCreateFromMap(PRTDBGMOD phDbgMod, const char *pszFilename, const char *pszName, RTUINTPTR uSubtrahend,
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsync RTDBGCFG hDbgCfg);
830a019ad79a45e6bf7a5419efd5a729a36e599evboxsyncRTDECL(int) RTDbgModCreateFromPeImage(PRTDBGMOD phDbgMod, const char *pszFilename, const char *pszName, RTLDRMOD hLdrMod,
830a019ad79a45e6bf7a5419efd5a729a36e599evboxsync uint32_t cbImage, uint32_t uTimeDateStamp, RTDBGCFG hDbgCfg);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncRTDECL(int) RTDbgModCreateFromDbg(PRTDBGMOD phDbgMod, const char *pszFilename, const char *pszName, uint32_t cbImage,
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync uint32_t uTimeDateStamp, RTDBGCFG hDbgCfg);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncRTDECL(int) RTDbgModCreateFromPdb(PRTDBGMOD phDbgMod, const char *pszFilename, const char *pszName, uint32_t cbImage,
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync PCRTUUID pUuid, uint32_t Age, RTDBGCFG hDbgCfg);
b7a07b07543924f45c1fffd2f90de582038b8ba6vboxsyncRTDECL(int) RTDbgModCreateFromDwo(PRTDBGMOD phDbgMod, const char *pszFilename, const char *pszName, uint32_t cbImage,
daa94352f51be2329ac8660f70396e03a7cb983bvboxsync uint32_t uCrc32, RTDBGCFG hDbgCfg);
2a2b173b54c259e34320ce0acf26f18e9382ce2avboxsyncRTDECL(int) RTDbgModCreateFromMachOImage(PRTDBGMOD phDbgMod, const char *pszFilename, const char *pszName,
2a2b173b54c259e34320ce0acf26f18e9382ce2avboxsync RTLDRARCH enmArch, uint32_t cbImage, uint32_t cSegs, PCRTDBGSEGMENT paSegs,
2a2b173b54c259e34320ce0acf26f18e9382ce2avboxsync PCRTUUID pUuid, RTDBGCFG hDbgCfg, uint32_t fFlags);
2a2b173b54c259e34320ce0acf26f18e9382ce2avboxsync
2a2b173b54c259e34320ce0acf26f18e9382ce2avboxsync/** @name Flags for RTDbgModCreate and friends.
2a2b173b54c259e34320ce0acf26f18e9382ce2avboxsync * @{ */
2a2b173b54c259e34320ce0acf26f18e9382ce2avboxsync/** Overrides the hDbgCfg settings and forces an image and/or symbol file
2a2b173b54c259e34320ce0acf26f18e9382ce2avboxsync * search. RTDbgModCreate will quietly ignore this flag. */
2a2b173b54c259e34320ce0acf26f18e9382ce2avboxsync#define RTDBGMOD_F_NOT_DEFERRED RT_BIT_32(0)
2a2b173b54c259e34320ce0acf26f18e9382ce2avboxsync/** @} */
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync/**
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * Retains another reference to the module.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @returns New reference count, UINT32_MAX on invalid handle (asserted).
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param hDbgMod The module handle.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @remarks Will not take any locks.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync */
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsyncRTDECL(uint32_t) RTDbgModRetain(RTDBGMOD hDbgMod);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync/**
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * Release a reference to the module.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * When the reference count reaches zero, the module is destroyed.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @returns New reference count, UINT32_MAX on invalid handle (asserted).
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param hDbgMod The module handle. The NIL handle is quietly ignored
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * and 0 is returned.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @remarks Will not take any locks.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync */
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsyncRTDECL(uint32_t) RTDbgModRelease(RTDBGMOD hDbgMod);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync
31771163041e3661403a806eb3382d2a165c003bvboxsync/**
31771163041e3661403a806eb3382d2a165c003bvboxsync * Removes all content from the debug module (container), optionally only
31771163041e3661403a806eb3382d2a165c003bvboxsync * leaving segments and image size intact.
31771163041e3661403a806eb3382d2a165c003bvboxsync *
31771163041e3661403a806eb3382d2a165c003bvboxsync * This is only possible on container modules, i.e. created by RTDbgModCreate().
31771163041e3661403a806eb3382d2a165c003bvboxsync *
31771163041e3661403a806eb3382d2a165c003bvboxsync * @returns IPRT status code.
31771163041e3661403a806eb3382d2a165c003bvboxsync * @param hDbgMod The module handle.
31771163041e3661403a806eb3382d2a165c003bvboxsync * @param fLeaveSegments Whether to leave segments (and image size) as is.
31771163041e3661403a806eb3382d2a165c003bvboxsync */
31771163041e3661403a806eb3382d2a165c003bvboxsyncRTDECL(int) RTDbgModRemoveAll(RTDBGMOD hDbgMod, bool fLeaveSegments);
31771163041e3661403a806eb3382d2a165c003bvboxsync
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync/**
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * Gets the module name.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @returns Pointer to a read only string containing the name.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param hDbgMod The module handle.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync */
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsyncRTDECL(const char *) RTDbgModName(RTDBGMOD hDbgMod);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync/**
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync * Gets the name of the debug info file we're using.
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync *
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync * @returns Pointer to a read only string containing the filename, NULL if we
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync * don't use one.
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync *
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync * @param hDbgMod The module handle.
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync */
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsyncRTDECL(const char *) RTDbgModDebugFile(RTDBGMOD hDbgMod);
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync/**
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync * Gets the image filename (as specified by the user).
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync *
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync * @returns Pointer to a read only string containing the filename.
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync *
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync * @param hDbgMod The module handle.
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync */
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsyncRTDECL(const char *) RTDbgModImageFile(RTDBGMOD hDbgMod);
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync/**
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync * Gets the image filename actually used if it differs from RTDbgModImageFile.
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync *
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync * @returns Pointer to a read only string containing the filename, NULL if same
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync * as RTDBgModImageFile.
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync *
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync * @param hDbgMod The module handle.
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync */
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsyncRTDECL(const char *) RTDbgModImageFileUsed(RTDBGMOD hDbgMod);
e9525bea57dc13d82fd3392913aebb33d2cb79e3vboxsync
d90eec53c9dcaa0f3d1054e8734ed46875b9093avboxsync/**
d90eec53c9dcaa0f3d1054e8734ed46875b9093avboxsync * Checks if the loading of the debug info has been postponed.
d90eec53c9dcaa0f3d1054e8734ed46875b9093avboxsync *
d90eec53c9dcaa0f3d1054e8734ed46875b9093avboxsync * @returns true if postponed, false if not or invalid handle.
d90eec53c9dcaa0f3d1054e8734ed46875b9093avboxsync * @param hDbgMod The module handle.
d90eec53c9dcaa0f3d1054e8734ed46875b9093avboxsync */
d90eec53c9dcaa0f3d1054e8734ed46875b9093avboxsyncRTDECL(bool) RTDbgModIsDeferred(RTDBGMOD hDbgMod);
d90eec53c9dcaa0f3d1054e8734ed46875b9093avboxsync
d90eec53c9dcaa0f3d1054e8734ed46875b9093avboxsync/**
d90eec53c9dcaa0f3d1054e8734ed46875b9093avboxsync * Checks if the debug info is exports only.
d90eec53c9dcaa0f3d1054e8734ed46875b9093avboxsync *
d90eec53c9dcaa0f3d1054e8734ed46875b9093avboxsync * @returns true if exports only, false if not or invalid handle.
d90eec53c9dcaa0f3d1054e8734ed46875b9093avboxsync * @param hDbgMod The module handle.
d90eec53c9dcaa0f3d1054e8734ed46875b9093avboxsync */
d90eec53c9dcaa0f3d1054e8734ed46875b9093avboxsyncRTDECL(bool) RTDbgModIsExports(RTDBGMOD hDbgMod);
d90eec53c9dcaa0f3d1054e8734ed46875b9093avboxsync
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync/**
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * Converts an image relative address to a segment:offset address.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @returns Segment index on success.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * NIL_RTDBGSEGIDX is returned if the module handle or the RVA are
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * invalid.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
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.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync */
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsyncRTDECL(RTDBGSEGIDX) RTDbgModRvaToSegOff(RTDBGMOD hDbgMod, RTUINTPTR uRva, PRTUINTPTR poffSeg);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync/**
ad27e1d5e48ca41245120c331cc88b50464813cevboxsync * Image size when mapped if segments are mapped adjacently.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
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 *
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @returns Image mapped size.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * RTUINTPTR_MAX is returned if the handle is invalid.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param hDbgMod The module handle.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync */
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsyncRTDECL(RTUINTPTR) RTDbgModImageSize(RTDBGMOD hDbgMod);
044af0d1e6474076366759db86f101778c5f20ccvboxsync
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync/**
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync * Gets the module tag value if any.
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync *
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync * @returns The tag. 0 if hDbgMod is invalid.
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync *
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync * @param hDbgMod The module handle.
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync */
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsyncRTDECL(uint64_t) RTDbgModGetTag(RTDBGMOD hDbgMod);
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync/**
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync * Tags or untags the module.
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync *
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync * @returns IPRT status code.
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync * @retval VERR_INVALID_HANDLE if hDbgMod is invalid.
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync *
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
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync */
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsyncRTDECL(int) RTDbgModSetTag(RTDBGMOD hDbgMod, uint64_t uTag);
bbb4c0bfd5ea55e99591d8811771257a437053eevboxsync
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync/**
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * Adds a segment to the module. Optional feature.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
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 *
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 *
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.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync */
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsyncRTDECL(int) RTDbgModSegmentAdd(RTDBGMOD hDbgMod, RTUINTPTR uRva, RTUINTPTR cb, const char *pszName,
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync uint32_t fFlags, PRTDBGSEGIDX piSeg);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync/**
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * Gets the number of segments in the module.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
ad27e1d5e48ca41245120c331cc88b50464813cevboxsync * This is can be used to determine the range which can be passed to
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * RTDbgModSegmentByIndex and derivates.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @returns The segment relative address.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * NIL_RTDBGSEGIDX if the handle is invalid.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param hDbgMod The module handle.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync */
044af0d1e6474076366759db86f101778c5f20ccvboxsyncRTDECL(RTDBGSEGIDX) RTDbgModSegmentCount(RTDBGMOD hDbgMod);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync/**
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * Query information about a segment.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * This can be used together with RTDbgModSegmentCount to enumerate segments.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * The index starts a 0 and stops one below RTDbgModSegmentCount.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
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 *
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.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync */
044af0d1e6474076366759db86f101778c5f20ccvboxsyncRTDECL(int) RTDbgModSegmentByIndex(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, PRTDBGSEGMENT pSegInfo);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync/**
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * Gets the size of a segment.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * This is a just a wrapper around RTDbgModSegmentByIndex.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @returns The segment size.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * RTUINTPTR_MAX is returned if either the handle and segment index are
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * invalid.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
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.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync */
4a1654dd5b9f0ae4e149d909843a3ab07b8bec33vboxsyncRTDECL(RTUINTPTR) RTDbgModSegmentSize(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg);
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync/**
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * Gets the image relative address of a segment.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * This is a just a wrapper around RTDbgModSegmentByIndex.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @returns The segment relative address.
a1df400bbe9d64aad400442e56eb637019300a5evboxsync * RTUINTPTR_MAX is returned if either the handle and segment index are
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * invalid.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync *
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param hDbgMod The module handle.
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * @param iSeg The segment index. No special segment indexes
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync * allowed (asserted).
c0e27f622f9bd6d9e77d2d959aab71d69dabf0d3vboxsync */
ca3da10d05961c339b5180fbd40a54587d6bad35vboxsyncRTDECL(RTUINTPTR) RTDbgModSegmentRva(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg);
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync/**
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * Adds a line number to the module.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @returns IPRT status code.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_NOT_SUPPORTED if the module interpret doesn't support adding
ad27e1d5e48ca41245120c331cc88b50464813cevboxsync * custom symbols. This is a common place occurrence.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_INVALID_HANDLE if hDbgMod is invalid.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_SYMBOL_NAME_OUT_OF_RANGE if the symbol name is too long or
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * short.
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_DBG_ADDRESS_WRAP if off+cb wraps around.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_INVALID_PARAMETER if the symbol flags sets undefined bits.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param hDbgMod The module handle.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param pszSymbol The symbol name.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param iSeg The segment index.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param off The segment offset.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param cb The size of the symbol. Can be zero, although this
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * may depend somewhat on the debug interpreter.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param fFlags Symbol flags. Reserved for the future, MBZ.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param piOrdinal Where to return the symbol ordinal on success. If
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * the interpreter doesn't do ordinals, this will be set to
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * UINT32_MAX. Optional.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync */
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsyncRTDECL(int) RTDbgModSymbolAdd(RTDBGMOD hDbgMod, const char *pszSymbol, RTDBGSEGIDX iSeg, RTUINTPTR off,
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync RTUINTPTR cb, uint32_t fFlags, uint32_t *piOrdinal);
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync/**
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * Gets the symbol count.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * This can be used together wtih RTDbgModSymbolByOrdinal or
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * RTDbgModSymbolByOrdinalA to enumerate all the symbols.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @returns The number of symbols in the module.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * UINT32_MAX is returned if the module handle is invalid or some other
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * error occurs.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param hDbgMod The module handle.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsyncRTDECL(uint32_t) RTDbgModSymbolCount(RTDBGMOD hDbgMod);
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync/**
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * Queries symbol information by ordinal number.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @returns IPRT status code.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_SYMBOL_NOT_FOUND if there is no symbol at the given number.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_NO_SYMBOLS if there aren't any symbols.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_INVALID_HANDLE if hDbgMod is invalid.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_NOT_SUPPORTED if lookup by ordinal is not supported.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param hDbgMod The module handle.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param iOrdinal The symbol ordinal number. 0-based. The highest
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * number is RTDbgModSymbolCount() - 1.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param pSymInfo Where to store the symbol information.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync */
a1df400bbe9d64aad400442e56eb637019300a5evboxsyncRTDECL(int) RTDbgModSymbolByOrdinal(RTDBGMOD hDbgMod, uint32_t iOrdinal, PRTDBGSYMBOL pSymInfo);
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync/**
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * Queries symbol information by ordinal number.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @returns IPRT status code.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_NO_SYMBOLS if there aren't any symbols.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_NOT_SUPPORTED if lookup by ordinal is not supported.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_SYMBOL_NOT_FOUND if there is no symbol at the given number.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_NO_MEMORY if RTDbgSymbolAlloc fails.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param hDbgMod The module handle.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param iOrdinal The symbol ordinal number. 0-based. The highest
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * number is RTDbgModSymbolCount() - 1.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param ppSymInfo Where to store the pointer to the returned
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * symbol information. Always set. Free with
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * RTDbgSymbolFree.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync */
a1df400bbe9d64aad400442e56eb637019300a5evboxsyncRTDECL(int) RTDbgModSymbolByOrdinalA(RTDBGMOD hDbgMod, uint32_t iOrdinal, PRTDBGSYMBOL *ppSymInfo);
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync/**
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * Queries symbol information by address.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
ad27e1d5e48ca41245120c331cc88b50464813cevboxsync * The returned symbol is what the debug info interpreter considers the symbol
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * most applicable to the specified address. This usually means a symbol with an
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * address equal or lower than the requested.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @returns IPRT status code.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_SYMBOL_NOT_FOUND if no suitable symbol was found.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_NO_SYMBOLS if there aren't any symbols.
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.
2d8870843ff566fee9bd3a6a5942414254106479vboxsync * @retval VERR_INVALID_PARAMETER if incorrect flags.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
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.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync */
2d8870843ff566fee9bd3a6a5942414254106479vboxsyncRTDECL(int) RTDbgModSymbolByAddr(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, uint32_t fFlags,
2d8870843ff566fee9bd3a6a5942414254106479vboxsync PRTINTPTR poffDisp, PRTDBGSYMBOL pSymInfo);
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync/**
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * Queries symbol information by address.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
ad27e1d5e48ca41245120c331cc88b50464813cevboxsync * The returned symbol is what the debug info interpreter considers the symbol
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * most applicable to the specified address. This usually means a symbol with an
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * address equal or lower than the requested.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @returns IPRT status code.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_SYMBOL_NOT_FOUND if no suitable symbol was found.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_NO_SYMBOLS if there aren't any symbols.
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 RTDbgSymbolAlloc fails.
2d8870843ff566fee9bd3a6a5942414254106479vboxsync * @retval VERR_INVALID_PARAMETER if incorrect flags.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param hDbgMod The module handle.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param iSeg The segment index.
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. Optional.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param ppSymInfo Where to store the pointer to the returned
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * symbol information. Always set. Free with
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * RTDbgSymbolFree.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync */
2d8870843ff566fee9bd3a6a5942414254106479vboxsyncRTDECL(int) RTDbgModSymbolByAddrA(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, uint32_t fFlags,
2d8870843ff566fee9bd3a6a5942414254106479vboxsync PRTINTPTR poffDisp, PRTDBGSYMBOL *ppSymInfo);
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync/**
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * Queries symbol information by symbol name.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @returns IPRT status code.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_NO_SYMBOLS if there aren't any symbols.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_SYMBOL_NOT_FOUND if no suitable symbol was found.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_SYMBOL_NAME_OUT_OF_RANGE if the symbol name is too long or
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * short.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param hDbgMod The module handle.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param pszSymbol The symbol name.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param pSymInfo Where to store the symbol information.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync */
a1df400bbe9d64aad400442e56eb637019300a5evboxsyncRTDECL(int) RTDbgModSymbolByName(RTDBGMOD hDbgMod, const char *pszSymbol, PRTDBGSYMBOL pSymInfo);
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync/**
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * Queries symbol information by symbol name.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @returns IPRT status code.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_NO_SYMBOLS if there aren't any symbols.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_SYMBOL_NOT_FOUND if no suitable symbol was found.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_DBG_SYMBOL_NAME_OUT_OF_RANGE if the symbol name is too long or
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * short.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_NO_MEMORY if RTDbgSymbolAlloc fails.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param hDbgMod The module handle.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param pszSymbol The symbol name.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param ppSymInfo Where to store the pointer to the returned
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * symbol information. Always set. Free with
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * RTDbgSymbolFree.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync */
a1df400bbe9d64aad400442e56eb637019300a5evboxsyncRTDECL(int) RTDbgModSymbolByNameA(RTDBGMOD hDbgMod, const char *pszSymbol, PRTDBGSYMBOL *ppSymInfo);
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync/**
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * Adds a line number to the module.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @returns IPRT status code.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @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 * empty.
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 *
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.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync */
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsyncRTDECL(int) RTDbgModLineAdd(RTDBGMOD hDbgMod, const char *pszFile, uint32_t uLineNo,
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync RTDBGSEGIDX iSeg, RTUINTPTR off, uint32_t *piOrdinal);
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync/**
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * Gets the line number count.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * This can be used together wtih RTDbgModLineByOrdinal or RTDbgModSymbolByLineA
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * to enumerate all the line number information.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
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 *
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @param hDbgMod The module handle.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync */
a1df400bbe9d64aad400442e56eb637019300a5evboxsyncRTDECL(uint32_t) RTDbgModLineCount(RTDBGMOD hDbgMod);
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync/**
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * Queries line number information by ordinal number.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * This can be used to enumerate the line numbers for the module. Use
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * RTDbgModLineCount() to figure the end of the ordinals.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
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 * ordinal.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_INVALID_HANDLE if hDbgMod is invalid.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync
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
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * number.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync */
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsyncRTDECL(int) RTDbgModLineByOrdinal(RTDBGMOD hDbgMod, uint32_t iOrdinal, PRTDBGLINE pLineInfo);
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync/**
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * Queries line number information by ordinal number.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * This can be used to enumerate the line numbers for the module. Use
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * RTDbgModLineCount() to figure the end of the ordinals.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
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 * ordinal.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_INVALID_HANDLE if hDbgMod is invalid.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * @retval VERR_NO_MEMORY if RTDbgLineAlloc fails.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
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.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync */
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsyncRTDECL(int) RTDbgModLineByOrdinalA(RTDBGMOD hDbgMod, uint32_t iOrdinal, PRTDBGLINE *ppLineInfo);
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync/**
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * Queries line number information by address.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
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 *
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 *
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.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync */
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsyncRTDECL(int) RTDbgModLineByAddr(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGLINE pLineInfo);
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync/**
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync * Queries line number information by address.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync *
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 *
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 *
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.
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsync */
df8e6a449f00e1884fbf4a1fc67143614d7d528dvboxsyncRTDECL(int) RTDbgModLineByAddrA(RTDBGMOD hDbgMod, RTDBGSEGIDX iSeg, RTUINTPTR off, PRTINTPTR poffDisp, PRTDBGLINE *ppLineInfo);
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/** @} */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
45c3e41d012100c5f4a3f77e391e4c6da8f5b97avboxsync# endif /* IN_RING3 */
45c3e41d012100c5f4a3f77e391e4c6da8f5b97avboxsync
26645f447bb6a819f33492c84e03e364092ec600vboxsync
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync/** @name Kernel Debug Info API
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync *
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * This is a specialized API for obtaining symbols and structure information
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * about the running kernel. It is relatively OS specific. Its purpose and
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * operation is doesn't map all that well onto RTDbgMod, so a few dedicated
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * functions was created for it.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync *
26645f447bb6a819f33492c84e03e364092ec600vboxsync * @{ */
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync/** Handle to the kernel debug info. */
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsynctypedef struct RTDBGKRNLINFOINT *RTDBGKRNLINFO;
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync/** Pointer to a kernel debug info handle. */
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsynctypedef RTDBGKRNLINFO *PRTDBGKRNLINFO;
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync/** Nil kernel debug info handle. */
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync#define NIL_RTDBGKRNLINFO ((RTDBGKRNLINFO)0)
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync/**
4dcf37df51439573b55cc16f53590c7b68cb1051vboxsync * Opens the kernel debug info.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync *
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * @returns IPRT status code. Can fail for any number of reasons.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync *
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * @param phKrnlInfo Where to return the kernel debug info handle on
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * success.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * @param fFlags Flags reserved for future use. Must be zero.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync */
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsyncRTR0DECL(int) RTR0DbgKrnlInfoOpen(PRTDBGKRNLINFO phKrnlInfo, uint32_t fFlags);
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync/**
4dcf37df51439573b55cc16f53590c7b68cb1051vboxsync * Retains a reference to the kernel debug info handle.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync *
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * @returns New reference count, UINT32_MAX on invalid handle (asserted).
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * @param hKrnlInfo The kernel info handle.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync */
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsyncRTR0DECL(uint32_t) RTR0DbgKrnlInfoRetain(RTDBGKRNLINFO hKrnlInfo);
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync/**
4dcf37df51439573b55cc16f53590c7b68cb1051vboxsync * Releases a reference to the kernel debug info handle, destroying it when the
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * counter reaches zero.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync *
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * @returns New reference count, UINT32_MAX on invalid handle (asserted).
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * @param hKrnlInfo The kernel info handle. NIL_RTDBGKRNLINFO is
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * quietly ignored.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync */
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsyncRTR0DECL(uint32_t) RTR0DbgKrnlInfoRelease(RTDBGKRNLINFO hKrnlInfo);
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync/**
4dcf37df51439573b55cc16f53590c7b68cb1051vboxsync * Queries the offset (in bytes) of a member of a kernel structure.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync *
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * @returns IPRT status code.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * @retval VINF_SUCCESS and offset at @a poffMember.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * @retval VERR_NOT_FOUND if the structure or the member was not found.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * @retval VERR_INVALID_HANDLE if hKrnlInfo is bad.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * @retval VERR_INVALID_POINTER if any of the pointers are bad.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync *
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * @param hKrnlInfo The kernel info handle.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * @param pszStructure The structure name.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * @param pszMember The member name.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * @param poffMember Where to return the offset.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync */
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsyncRTR0DECL(int) RTR0DbgKrnlInfoQueryMember(RTDBGKRNLINFO hKrnlInfo, const char *pszStructure,
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync const char *pszMember, size_t *poffMember);
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync/**
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * Queries the value (usually the address) of a kernel symbol.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync *
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * This may go looking for the symbol in other modules, in which case it will
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * always check the kernel symbol table first.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync *
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * @returns IPRT status code.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * @retval VINF_SUCCESS and value at @a ppvSymbol.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * @retval VERR_SYMBOL_NOT_FOUND
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * @retval VERR_INVALID_HANDLE if hKrnlInfo is bad.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * @retval VERR_INVALID_POINTER if any of the pointers are bad.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync *
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * @param hKrnlInfo The kernel info handle.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * @param pszModule Reserved for future extensions. Pass NULL.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * @param pszSymbol The C name of the symbol.
560a1042a968cf73161ac78555eddc8d16e8bebdvboxsync * @param ppvSymbol Where to return the symbol value, passing NULL is
560a1042a968cf73161ac78555eddc8d16e8bebdvboxsync * OK. This may be modified even on failure, in
560a1042a968cf73161ac78555eddc8d16e8bebdvboxsync * particular, it will be set to NULL when
560a1042a968cf73161ac78555eddc8d16e8bebdvboxsync * VERR_SYMBOL_NOT_FOUND is returned.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync *
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync * @sa RTLdrGetSymbol.
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync */
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsyncRTR0DECL(int) RTR0DbgKrnlInfoQuerySymbol(RTDBGKRNLINFO hKrnlInfo, const char *pszModule,
feffb6492a600891a421e4c1bf0a2bcd2213568dvboxsync const char *pszSymbol, void **ppvSymbol);
26645f447bb6a819f33492c84e03e364092ec600vboxsync/** @} */
26645f447bb6a819f33492c84e03e364092ec600vboxsync
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync/** @} */
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
590bfe12ce22cd3716448fbb9f4dc51664bfe5e2vboxsyncRT_C_DECLS_END
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync#endif
3a4a6501d0ccd629d9951b644d380c7bb2d46086vboxsync