dbg.h revision 60c09b27d103d1f742cbd8a2fae8a254cba386a6
/** @file
* Debugger Interfaces. (VBoxDbg)
*
* This header covers all external interfaces of the Debugger module.
* However, it does not cover the DBGF interface since that part of the
* VMM. Use dbgf.h for that.
*/
/*
* Copyright (C) 2006-2007 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
#ifndef ___VBox_dbg_h
#define ___VBox_dbg_h
#ifdef IN_RING3
#endif
#ifdef IN_RING3 /* The debugger stuff is ring-3 only. */
/** @def VBOX_WITH_DEBUGGER
* The build is with debugger module. Test if this is defined before registering
* external debugger commands. This is normally defined in Config.kmk.
*/
#ifdef DOXYGEN_RUNNING
# define VBOX_WITH_DEBUGGER
#endif
/**
* DBGC variable category.
*
* Used to describe an argument to a command or function and a functions
* return value.
*/
typedef enum DBGCVARCAT
{
/** Any type is fine. */
DBGCVAR_CAT_ANY = 0,
/** Any kind of pointer or number. */
/** Any kind of pointer or number, no range. */
/** Any kind of pointer. */
/** Any kind of pointer with no range option. */
/** GC pointer. */
/** GC pointer with no range option. */
/** Numeric argument. */
/** Numeric argument with no range option. */
/** String. */
/** Symbol. */
/** Option. */
/** Option + string. */
/** Option + number. */
} DBGCVARCAT;
/**
* DBGC variable type.
*/
typedef enum DBGCVARTYPE
{
/** unknown... */
DBGCVAR_TYPE_UNKNOWN = 0,
/** Flat GC pointer. */
/** Segmented GC pointer. */
/** Physical GC pointer. */
/** Flat HC pointer. */
/** Physical HC pointer. */
/** Number. */
/** String. */
/** Symbol. */
/** Special type used when querying symbols. */
} DBGCVARTYPE;
/** @todo Rename to DBGCVAR_IS_xyz. */
/** Checks if the specified variable type is of a pointer persuasion. */
#define DBGCVAR_ISPOINTER(enmType) ((enmType) >= DBGCVAR_TYPE_GC_FLAT && enmType <= DBGCVAR_TYPE_HC_PHYS)
/** Checks if the specified variable type is of a pointer persuasion. */
/** Checks if the specified variable type is of a pointer persuasion and of the guest context sort. */
#define DBGCVAR_ISGCPOINTER(enmType) ((enmType) >= DBGCVAR_TYPE_GC_FLAT && (enmType) <= DBGCVAR_TYPE_GC_PHYS)
/** Checks if the specified variable type is of a pointer persuasion and of the host context sort. */
#define DBGCVAR_ISHCPOINTER(enmType) ((enmType) >= DBGCVAR_TYPE_HC_FLAT && (enmType) <= DBGCVAR_TYPE_HC_PHYS)
/**
* DBGC variable range type.
*/
typedef enum DBGCVARRANGETYPE
{
/** No range appliable or no range specified. */
DBGCVAR_RANGE_NONE = 0,
/** Number of elements. */
/** Number of bytes. */
/**
* Variable descriptor.
*/
typedef struct DBGCVARDESC
{
/** The minimal number of times this argument may occur.
* Use 0 here to inidicate that the argument is optional. */
unsigned cTimesMin;
/** Maximum number of occurrences.
* Use ~0 here to indicate infinite. */
unsigned cTimesMax;
/** Argument category. */
/** Flags, DBGCVD_FLAGS_* */
unsigned fFlags;
/** Argument name. */
const char *pszName;
/** Argument name. */
const char *pszDescription;
} DBGCVARDESC;
/** Pointer to an argument descriptor. */
typedef DBGCVARDESC *PDBGCVARDESC;
/** Pointer to a const argument descriptor. */
typedef const DBGCVARDESC *PCDBGCVARDESC;
/** Variable descriptor flags.
* @{ */
/** Indicates that the variable depends on the previous being present. */
/** @} */
/**
* DBGC variable.
*/
typedef struct DBGCVAR
{
/** Pointer to the argument descriptor. */
/** Pointer to the next argument. */
/** Argument type. */
/** Type specific. */
union
{
/** Flat GC Address. (DBGCVAR_TYPE_GC_FLAT) */
/** Far (16:32) GC Address. (DBGCVAR_TYPE_GC_FAR) */
/** Physical GC Address. (DBGCVAR_TYPE_GC_PHYS) */
/** Flat HC Address. (DBGCVAR_TYPE_HC_FLAT) */
void *pvHCFlat;
/** Physical GC Address. (DBGCVAR_TYPE_HC_PHYS) */
/** String. (DBGCVAR_TYPE_STRING)
* The basic idea is the the this is a pointer to the expression we're
* parsing, so no messing with freeing. */
const char *pszString;
/** Number. (DBGCVAR_TYPE_NUMBER) */
} u;
/** Range type. */
/** Range. The use of the content depends on the enmRangeType. */
} DBGCVAR;
/** Pointer to a command argument. */
/** Pointer to a const command argument. */
/**
* Macro for initializing a DBGC variable with defaults.
* The result is an unknown variable type without any range.
*/
#define DBGCVAR_INIT(pVar) \
do { \
} while (0)
/**
* Macro for initializing a DBGC variable with a HC physical address.
*/
do { \
DBGCVAR_INIT(pVar); \
} while (0)
/**
* Macro for initializing a DBGC variable with a HC flat address.
*/
do { \
DBGCVAR_INIT(pVar); \
} while (0)
/**
* Macro for initializing a DBGC variable with a GC physical address.
*/
do { \
DBGCVAR_INIT(pVar); \
} while (0)
/**
* Macro for initializing a DBGC variable with a GC flat address.
*/
do { \
DBGCVAR_INIT(pVar); \
} while (0)
/**
* Macro for initializing a DBGC variable with a GC flat address.
*/
do { \
DBGCVAR_INIT(pVar); \
} while (0)
/**
* Macro for initializing a DBGC variable with a GC far address.
*/
do { \
DBGCVAR_INIT(pVar); \
} while (0)
/**
* Macro for initializing a DBGC variable with a number.
*/
do { \
DBGCVAR_INIT(pVar); \
} while (0)
/**
* Macro for initializing a DBGC variable with a string.
*/
do { \
DBGCVAR_INIT(pVar); \
} while (0)
/**
* Macro for initializing a DBGC variable with a symbol.
*/
do { \
DBGCVAR_INIT(pVar); \
} while (0)
/**
* Macro for setting the range of a DBGC variable.
* @param pVar The variable.
* @param _enmRangeType The range type.
* @param Value The range length value.
*/
do { \
} while (0)
/**
* Macro for setting the range of a DBGC variable.
* @param a_pVar The variable.
* @param a_cbRange The range, in bytes.
*/
/**
* Macro for resetting the range a DBGC variable.
* @param a_pVar The variable.
*/
#define DBGCVAR_ZAP_RANGE(a_pVar) \
do { \
} while (0)
/**
* Macro for assigning one DBGC variable to another.
* @param a_pResult The result (target) variable.
* @param a_pVar The source variable.
*/
do { \
} while (0)
/** Pointer to a command descriptor. */
/** Pointer to a const command descriptor. */
/** Pointer to a function descriptor. */
/** Pointer to a const function descriptor. */
typedef const struct DBGCFUNC *PCDBGCFUNC;
/** Pointer to helper functions for commands. */
typedef struct DBGCCMDHLP *PDBGCCMDHLP;
/**
* Helper functions for commands.
*/
typedef struct DBGCCMDHLP
{
/** Magic value (DBGCCMDHLP_MAGIC). */
/**
* Command helper for writing formatted text to the debug console.
*
* @returns VBox status.
* @param pCmdHlp Pointer to the command callback structure.
* @param pcb Where to store the number of bytes written.
* @param pszFormat The format string. This may use all IPRT extensions as
* well as the debugger ones.
* @param ... Arguments specified in the format string.
*/
DECLCALLBACKMEMBER(int, pfnPrintf)(PDBGCCMDHLP pCmdHlp, size_t *pcbWritten, const char *pszFormat, ...);
/**
* Command helper for writing formatted text to the debug console.
*
* @returns VBox status.
* @param pCmdHlp Pointer to the command callback structure.
* @param pcb Where to store the number of bytes written.
* @param pszFormat The format string. This may use all IPRT extensions as
* well as the debugger ones.
* @param args Arguments specified in the format string.
*/
DECLCALLBACKMEMBER(int, pfnPrintfV)(PDBGCCMDHLP pCmdHlp, size_t *pcbWritten, const char *pszFormat, va_list args);
/**
* Command helper for formatting a string with debugger format specifiers.
*
* @returns The number of bytes written.
* @param pCmdHlp Pointer to the command callback structure.
* @param pszBuf The output buffer.
* @param cbBuf The size of the output buffer.
* @param pszFormat The format string. This may use all IPRT extensions as
* well as the debugger ones.
* @param ... Arguments specified in the format string.
*/
DECLCALLBACKMEMBER(size_t, pfnStrPrintf)(PDBGCCMDHLP pCmdHlp, char *pszBuf, size_t cbBuf, const char *pszFormat, ...);
/**
* Command helper for formatting a string with debugger format specifiers.
*
* @returns The number of bytes written.
* @param pCmdHlp Pointer to the command callback structure.
* @param pszBuf The output buffer.
* @param cbBuf The size of the output buffer.
* @param pszFormat The format string. This may use all IPRT extensions as
* well as the debugger ones.
* @param va Arguments specified in the format string.
*/
/**
* Command helper for formatting and error message for a VBox status code.
*
* @returns VBox status code appropriate to return from a command.
* @param pCmdHlp Pointer to the command callback structure.
* @param rc The VBox status code.
* @param pszFormat Format string for additional messages. Can be NULL.
* @param ... Format arguments, optional.
*/
/**
* Command helper for formatting and error message for a VBox status code.
*
* @returns VBox status code appropriate to return from a command.
* @param pCmdHlp Pointer to the command callback structure.
* @param rc The VBox status code.
* @param pcb Where to store the number of bytes written.
* @param pszFormat Format string for additional messages. Can be NULL.
* @param args Format arguments, optional.
*/
DECLCALLBACKMEMBER(int, pfnVBoxErrorV)(PDBGCCMDHLP pCmdHlp, int rc, const char *pszFormat, va_list args);
/**
* Command helper for reading memory specified by a DBGC variable.
*
* @returns VBox status code appropriate to return from a command.
* @param pCmdHlp Pointer to the command callback structure.
* @param pVM VM handle if GC or physical HC address.
* @param pvBuffer Where to store the read data.
* @param cbRead Number of bytes to read.
* @param pVarPointer DBGC variable specifying where to start reading.
* @param pcbRead Where to store the number of bytes actually read.
* This optional, but it's useful when read GC virtual memory where a
* page in the requested range might not be present.
* If not specified not-present failure or end of a HC physical page
* will cause failure.
*/
DECLCALLBACKMEMBER(int, pfnMemRead)(PDBGCCMDHLP pCmdHlp, PVM pVM, void *pvBuffer, size_t cbRead, PCDBGCVAR pVarPointer, size_t *pcbRead);
/**
* Command helper for writing memory specified by a DBGC variable.
*
* @returns VBox status code appropriate to return from a command.
* @param pCmdHlp Pointer to the command callback structure.
* @param pVM VM handle if GC or physical HC address.
* @param pvBuffer What to write.
* @param cbWrite Number of bytes to write.
* @param pVarPointer DBGC variable specifying where to start reading.
* @param pcbWritten Where to store the number of bytes written.
* This is optional. If NULL be aware that some of the buffer
* might have been written to the specified address.
*/
DECLCALLBACKMEMBER(int, pfnMemWrite)(PDBGCCMDHLP pCmdHlp, PVM pVM, const void *pvBuffer, size_t cbWrite, PCDBGCVAR pVarPointer, size_t *pcbWritten);
/**
* Executes command an expression.
* (Hopefully the parser and functions are fully reentrant.)
*
* @returns VBox status code appropriate to return from a command.
* @param pCmdHlp Pointer to the command callback structure.
* @param pszExpr The expression. Format string with the format DBGC extensions.
* @param ... Format arguments.
*/
/**
* Evaluates an expression.
* (Hopefully the parser and functions are fully reentrant.)
*
* @returns VBox status code appropriate to return from a command.
* @param pCmdHlp Pointer to the command callback structure.
* @param pResult Where to store the result.
* @param pszExpr The expression. Format string with the format DBGC extensions.
* @param va Format arguments.
*/
DECLCALLBACKMEMBER(int, pfnEvalV)(PDBGCCMDHLP pCmdHlp, PDBGCVAR pResult, const char *pszExpr, va_list va);
/**
* Print an error and fail the current command.
*
* @returns VBox status code to pass upwards.
*
* @param pCmdHlp Pointer to the command callback structure.
* @param pCmd The failing command.
* @param pszFormat The error message format string.
* @param va Format arguments.
*/
DECLCALLBACKMEMBER(int, pfnFailV)(PDBGCCMDHLP pCmdHlp, PCDBGCCMD pCmd, const char *pszFormat, va_list va);
/**
* Print an error and fail the current command.
*
* @returns VBox status code to pass upwards.
*
* @param pCmdHlp Pointer to the command callback structure.
* @param pCmd The failing command.
* @param rc The status code indicating the failure. This will
* be appended to the message after a colon (': ').
* @param pszFormat The error message format string.
* @param va Format arguments.
*
* @see DBGCCmdHlpFailRc
*/
DECLCALLBACKMEMBER(int, pfnFailRcV)(PDBGCCMDHLP pCmdHlp, PCDBGCCMD pCmd, int rc, const char *pszFormat, va_list va);
/**
* Parser error.
*
* @returns VBox status code to pass upwards.
*
* @param pCmdHlp Pointer to the command callback structure.
* @param pCmd The failing command, can be NULL but shouldn't.
* @param iArg The offending argument, -1 when lazy.
* @param pszExpr The expression.
* @param iLine The line number.
*/
DECLCALLBACKMEMBER(int, pfnParserError)(PDBGCCMDHLP pCmdHlp, PCDBGCCMD pCmd, int iArg, const char *pszExpr, unsigned iLine);
/**
* Converts a DBGC variable to a DBGF address structure.
*
* @returns VBox status code.
* @param pCmdHlp Pointer to the command callback structure.
* @param pVar The variable to convert.
* @param pAddress The target address.
*/
DECLCALLBACKMEMBER(int, pfnVarToDbgfAddr)(PDBGCCMDHLP pCmdHlp, PCDBGCVAR pVar, PDBGFADDRESS pAddress);
/**
* Converts a DBGF address structure to a DBGC variable.
*
* @returns VBox status code.
* @param pCmdHlp Pointer to the command callback structure.
* @param pAddress The source address.
* @param pResult The result variable.
*/
DECLCALLBACKMEMBER(int, pfnVarFromDbgfAddr)(PDBGCCMDHLP pCmdHlp, PCDBGFADDRESS pAddress, PDBGCVAR pResult);
/**
* Converts a DBGC variable to a 64-bit number.
*
* @returns VBox status code.
* @param pCmdHlp Pointer to the command callback structure.
* @param pVar The variable to convert.
* @param pu64Number Where to store the number.
*/
/**
* Converts a DBGC variable to a boolean.
*
* @returns VBox status code.
* @param pCmdHlp Pointer to the command callback structure.
* @param pVar The variable to convert.
* @param pf Where to store the boolean.
*/
/**
* Get the range of a variable in bytes, resolving symbols if necessary.
*
* @returns VBox status code.
* @param pCmdHlp Pointer to the command callback structure.
* @param pVar The variable to convert.
* @param cbElement Conversion factor for element ranges.
* @param cbDefault The default range.
* @param pcbRange The length of the range.
*/
DECLCALLBACKMEMBER(int, pfnVarGetRange)(PDBGCCMDHLP pCmdHlp, PCDBGCVAR pVar, uint64_t cbElement, uint64_t cbDefault,
/**
* Converts a variable to one with the specified type.
*
* This preserves the range.
*
* @returns VBox status code.
* @param pCmdHlp Pointer to the command callback structure.
* @param pVar The variable to convert.
* @param enmToType The target type.
* @param fConvSyms If @c true, then attempt to resolve symbols.
* @param pResult The output variable. Can be the same as @a pVar.
*/
DECLCALLBACKMEMBER(int, pfnVarConvert)(PDBGCCMDHLP pCmdHlp, PCDBGCVAR pVar, DBGCVARTYPE enmToType, bool fConvSyms,
/**
* Gets a DBGF output helper that directs the output to the debugger
* console.
*
* @returns Pointer to the helper structure.
* @param pCmdHlp Pointer to the command callback structure.
*/
/**
* Gets the ID currently selected CPU.
*
* @returns Current CPU ID.
* @param pCmdHlp Pointer to the command callback structure.
*/
/**
* Gets the mode the currently selected CPU is running in, in the current
* context.
*
* @returns Current CPU mode.
* @param pCmdHlp Pointer to the command callback structure.
*/
/** End marker (DBGCCMDHLP_MAGIC). */
} DBGCCMDHLP;
/** Magic value for DBGCCMDHLP::u32Magic. (Fyodor Mikhaylovich Dostoyevsky) */
#ifdef IN_RING3
/**
* @copydoc DBGCCMDHLP::pfnPrintf
*/
{
int rc;
return rc;
}
/**
* @copydoc DBGCCMDHLP::pfnStrPrintf
*/
DECLINLINE(size_t) DBGCCmdHlpStrPrintf(PDBGCCMDHLP pCmdHlp, char *pszBuf, size_t cbBuf, const char *pszFormat, ...)
{
return cch;
}
/**
* @copydoc FNDBGCHLPVBOXERROR
*/
{
return rc;
}
/**
* @copydoc FNDBGCHLPMEMREAD
*/
DECLINLINE(int) DBGCCmdHlpMemRead(PDBGCCMDHLP pCmdHlp, PVM pVM, void *pvBuffer, size_t cbRead, PCDBGCVAR pVarPointer, size_t *pcbRead)
{
}
/**
* Evaluates an expression.
* (Hopefully the parser and functions are fully reentrant.)
*
* @returns VBox status code appropriate to return from a command.
* @param pCmdHlp Pointer to the command callback structure.
* @param pResult Where to store the result.
* @param pszExpr The expression. Format string with the format DBGC extensions.
* @param ... Format arguments.
*/
{
int rc;
return rc;
}
/**
* Print an error and fail the current command.
*
* @returns VBox status code to pass upwards.
*
* @param pCmdHlp Pointer to the command callback structure.
* @param pCmd The failing command.
* @param pszFormat The error message format string.
* @param ... Format arguments.
*/
{
int rc;
return rc;
}
/**
* Print an error and fail the current command.
*
* Usage example:
* @code
int rc = VMMR3Something(pVM);
if (RT_FAILURE(rc))
return DBGCCmdHlpFailRc(pCmdHlp, pCmd, rc, "VMMR3Something");
return VINF_SUCCESS;
* @endcode
*
* @returns VBox status code to pass upwards.
*
* @param pCmdHlp Pointer to the command callback structure.
* @param pCmd The failing command.
* @param rc The status code indicating the failure.
* @param pszFormat The error message format string.
* @param ... Format arguments.
*/
DECLINLINE(int) DBGCCmdHlpFailRc(PDBGCCMDHLP pCmdHlp, PCDBGCCMD pCmd, int rc, const char *pszFormat, ...)
{
return rc;
}
/**
* @copydoc DBGCCMDHLP::pfnParserError
*/
DECLINLINE(int) DBGCCmdHlpParserError(PDBGCCMDHLP pCmdHlp, PCDBGCCMD pCmd, int iArg, const char *pszExpr, unsigned iLine)
{
}
/** Assert+return like macro for checking parser sanity.
* Returns with failure if the precodition is not met. */
do { \
if (!(expr)) \
} while (0)
/** Assert+return like macro that the VM handle is present.
* Returns with failure if the VM handle is NIL. */
do { \
if (!(pVM)) \
} while (0)
/**
* @copydoc DBGCCMDHLP::pfnVarToDbgfAddr
*/
{
}
/**
* @copydoc DBGCCMDHLP::pfnVarToDbgfAddr
*/
DECLINLINE(int) DBGCCmdHlpVarFromDbgfAddr(PDBGCCMDHLP pCmdHlp, PCDBGFADDRESS pAddress, PDBGCVAR pResult)
{
}
/**
* Converts an variable to a flat address.
*
* @returns VBox status code.
* @param pCmdHlp Pointer to the command callback structure.
* @param pVar The variable to convert.
* @param pFlatPtr Where to store the flat address.
*/
{
if (RT_SUCCESS(rc))
return rc;
}
/**
* @copydoc DBGCCMDHLP::pfnVarToNumber
*/
{
}
/**
* @copydoc DBGCCMDHLP::pfnVarToBool
*/
{
}
/**
* @copydoc DBGCCMDHLP::pfnVarGetRange
*/
DECLINLINE(int) DBGCCmdHlpVarGetRange(PDBGCCMDHLP pCmdHlp, PCDBGCVAR pVar, uint64_t cbElement, uint64_t cbDefault, uint64_t *pcbRange)
{
}
/**
* @copydoc DBGCCMDHLP::pfnVarConvert
*/
DECLINLINE(int) DBGCCmdHlpConvert(PDBGCCMDHLP pCmdHlp, PCDBGCVAR pVar, DBGCVARTYPE enmToType, bool fConvSyms, PDBGCVAR pResult)
{
}
/**
* @copydoc DBGCCMDHLP::pfnGetDbgfOutputHlp
*/
{
}
/**
* @copydoc DBGCCMDHLP::pfnGetCurrentCpu
*/
{
}
/**
* @copydoc DBGCCMDHLP::pfnGetCpuMode
*/
{
}
#endif /* IN_RING3 */
/**
* Command handler.
*
* The console will call the handler for a command once it's finished
* parsing the user input. The command handler function is responsible
* for executing the command itself.
*
* @returns VBox status.
* @param pCmd Pointer to the command descriptor (as registered).
* @param pCmdHlp Pointer to command helper functions.
* @param pVM Pointer to the current VM (if any).
* @param paArgs Pointer to (readonly) array of arguments.
* @param cArgs Number of arguments in the array.
*/
typedef DECLCALLBACK(int) FNDBGCCMD(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
/** Pointer to a FNDBGCCMD() function. */
typedef FNDBGCCMD *PFNDBGCCMD;
/**
* DBGC command descriptor.
*/
typedef struct DBGCCMD
{
/** Command string. */
const char *pszCmd;
/** Minimum number of arguments. */
unsigned cArgsMin;
/** Max number of arguments. */
unsigned cArgsMax;
/** Argument descriptors (array). */
/** Number of argument descriptors. */
unsigned cArgDescs;
/** flags. (reserved for now) */
unsigned fFlags;
/** Handler function. */
/** Command syntax. */
const char *pszSyntax;
/** Command description. */
const char *pszDescription;
} DBGCCMD;
/** DBGCCMD Flags.
* @{
*/
/** @} */
/**
* Function handler.
*
* The console will call the handler for a command once it's finished
* parsing the user input. The command handler function is responsible
* for executing the command itself.
*
* @returns VBox status.
* @param pCmd Pointer to the command descriptor (as registered).
* @param pCmdHlp Pointer to command helper functions.
* @param pVM Pointer to the current VM (if any).
* @param paArgs Pointer to (readonly) array of arguments.
* @param cArgs Number of arguments in the array.
* @param pResult Where to return the result.
*/
typedef DECLCALLBACK(int) FNDBGCFUNC(PCDBGCFUNC pFunc, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs,
/** Pointer to a FNDBGCFUNC() function. */
typedef FNDBGCFUNC *PFNDBGCFUNC;
/**
* DBGC function descriptor.
*/
typedef struct DBGCFUNC
{
/** Command string. */
const char *pszFuncNm;
/** Minimum number of arguments. */
unsigned cArgsMin;
/** Max number of arguments. */
unsigned cArgsMax;
/** Argument descriptors (array). */
/** Number of argument descriptors. */
unsigned cArgDescs;
/** flags. (reserved for now) */
unsigned fFlags;
/** Handler function. */
/** Function syntax. */
const char *pszSyntax;
/** Function description. */
const char *pszDescription;
} DBGCFUNC;
/** Pointer to a DBGC backend. */
/**
* Checks if there is input.
*
* @returns true if there is input ready.
* @returns false if there not input ready.
* @param pBack Pointer to the backend structure supplied by
* the backend. The backend can use this to find
* it's instance data.
* @param cMillies Number of milliseconds to wait on input data.
*/
/** Pointer to a FNDBGCBACKINPUT() callback. */
typedef FNDBGCBACKINPUT *PFNDBGCBACKINPUT;
/**
* Read input.
*
* @returns VBox status code.
* @param pBack Pointer to the backend structure supplied by
* the backend. The backend can use this to find
* it's instance data.
* @param pvBuf Where to put the bytes we read.
* @param cbBuf Maximum nymber of bytes to read.
* @param pcbRead Where to store the number of bytes actually read.
* If NULL the entire buffer must be filled for a
* successful return.
*/
typedef DECLCALLBACK(int) FNDBGCBACKREAD(PDBGCBACK pBack, void *pvBuf, size_t cbBuf, size_t *pcbRead);
/** Pointer to a FNDBGCBACKREAD() callback. */
typedef FNDBGCBACKREAD *PFNDBGCBACKREAD;
/**
* Write (output).
*
* @returns VBox status code.
* @param pBack Pointer to the backend structure supplied by
* the backend. The backend can use this to find
* it's instance data.
* @param pvBuf What to write.
* @param cbBuf Number of bytes to write.
* @param pcbWritten Where to store the number of bytes actually written.
* If NULL the entire buffer must be successfully written.
*/
typedef DECLCALLBACK(int) FNDBGCBACKWRITE(PDBGCBACK pBack, const void *pvBuf, size_t cbBuf, size_t *pcbWritten);
/** Pointer to a FNDBGCBACKWRITE() callback. */
typedef FNDBGCBACKWRITE *PFNDBGCBACKWRITE;
/**
* Ready / busy notification.
*
* @param pBack Pointer to the backend structure supplied by
* the backend. The backend can use this to find
* it's instance data.
* @param fReady Whether it's ready (true) or busy (false).
*/
/** Pointer to a FNDBGCBACKSETREADY() callback. */
typedef FNDBGCBACKSETREADY *PFNDBGCBACKSETREADY;
/**
* The communication backend provides the console with a number of callbacks
* which can be used
*/
typedef struct DBGCBACK
{
/** Check for input. */
/** Read input. */
/** Write output. */
/** Ready / busy notification. */
} DBGCBACK;
/**
* Make a console instance.
*
* This will not return until either an 'exit' command is issued or a error code
* indicating connection loss is encountered.
*
* @returns VINF_SUCCESS if console termination caused by the 'exit' command.
* @returns The VBox status code causing the console termination.
*
* @param pVM VM Handle.
* @param pBack Pointer to the backend structure. This must contain
* a full set of function pointers to service the console.
* @param fFlags Reserved, must be zero.
* @remark A forced termination of the console is easiest done by forcing the
* callbacks to return fatal failures.
*/
/**
* Register one or more external commands.
*
* @returns VBox status.
* @param paCommands Pointer to an array of command descriptors.
* The commands must be unique. It's not possible
* to register the same commands more than once.
* @param cCommands Number of commands.
*/
/**
* Deregister one or more external commands previously registered by
* DBGCRegisterCommands().
*
* @returns VBox status.
* @param paCommands Pointer to an array of command descriptors
* as given to DBGCRegisterCommands().
* @param cCommands Number of commands.
*/
/**
* Spawns a new thread with a TCP based debugging console service.
*
* @returns VBox status.
* @param pVM VM handle.
* @param ppvData Where to store the pointer to instance data.
*/
/**
* Terminates any running TCP base debugger console service.
*
* @returns VBox status.
* @param pVM VM handle.
* @param pvData Instance data set by DBGCTcpCreate().
*/
/** @defgroup grp_dbgc_plug_in The DBGC Plug-in Interface
* @{
*/
/** The plug-in module name prefix. */
#define DBGC_PLUG_IN_PREFIX "DBGCPlugIn"
/** The name of the plug-in entry point (FNDBGCPLUGIN) */
#define DBGC_PLUG_IN_ENTRYPOINT "DBGCPlugInEntry"
/**
* DBGC plug-in operations.
*/
typedef enum DBGCPLUGINOP
{
/** The usual invalid first value. */
/** Initialize the plug-in, register all the stuff.
* The plug-in will be unloaded on failure.
* uArg: The VirtualBox version (major+minor). */
/** Terminate the plug-ing, deregister all the stuff.
* The plug-in will be unloaded after this call regardless of the return
* code. */
/** The usual 32-bit hack. */
DBGCPLUGINOP_32BIT_HACK = 0x7fffffff
} DBGCPLUGINOP;
/**
* DBGC plug-in main entry point.
*
* @returns VBox status code.
*
* @param enmOperation The operation.
* @param pVM The VM handle. This may be NULL.
* @param uArg Extra argument.
*/
/** Pointer to a FNDBGCPLUGIN. */
typedef FNDBGCPLUGIN *PFNDBGCPLUGIN;
/** @copydoc FNDBGCPLUGIN */
#endif /* IN_RING3 */
/** @} */
#endif