VirtualBox

Changeset 32574 in vbox


Ignore:
Timestamp:
Sep 16, 2010 5:44:29 PM (14 years ago)
Author:
vboxsync
Message:

Additions/VBoxGuestLib+Additions/VBoxControl: Guest core dumps (VbglR3WriteCoreDump), untested.

Location:
trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/VBoxGuest.h

    r32323 r32574  
    240240
    241241
    242 /** IOCTL to VBoxGuest to interrupt (cancel) any pending WAITEVENTs and return.
    243  * Handled inside the guest additions and not seen by the host at all.
    244  * @see VBOXGUEST_IOCTL_WAITEVENT */
    245 #define VBOXGUEST_IOCTL_CANCEL_ALL_WAITEVENTS       VBOXGUEST_IOCTL_CODE_(5, 0)
    246 
    247 
    248 
    249242/** IOCTL to VBoxGuest to perform a VMM request
    250243 * @remark  The data buffer for this IOCtl has an variable size, keep this in mind
     
    265258#pragma pack()
    266259
     260/** IOCTL to VBoxGuest to interrupt (cancel) any pending WAITEVENTs and return.
     261 * Handled inside the guest additions and not seen by the host at all.
     262 * @see VBOXGUEST_IOCTL_WAITEVENT */
     263#define VBOXGUEST_IOCTL_CANCEL_ALL_WAITEVENTS       VBOXGUEST_IOCTL_CODE_(5, 0)
     264
     265/** IOCTL to VBoxGuest to perform backdoor logging.
     266 * The argument is a string buffer of the specified size. */
     267#define VBOXGUEST_IOCTL_LOG(Size)                   VBOXGUEST_IOCTL_CODE_(6, (Size))
    267268
    268269/** IOCTL to VBoxGuest to check memory ballooning.
     
    303304AssertCompileSize(VBoxGuestChangeBalloonInfo, 16);
    304305
    305 
    306 /** IOCTL to VBoxGuest to perform backdoor logging.
    307  * The argument is a string buffer of the specified size. */
    308 #define VBOXGUEST_IOCTL_LOG(Size)                   VBOXGUEST_IOCTL_CODE_(6, (Size))
     306/** IOCTL to VBoxGuest to write guest core. */
     307#define VBOXGUEST_IOCTL_WRITE_CORE_DUMP             VBOXGUEST_IOCTL_CODE(9, sizeof(VBoxGuestWriteCoreDump))
     308
     309/** Input and output buffer layout of the VBOXGUEST_IOCTL_WRITE_CORE
     310 *  request. */
     311typedef struct VBoxGuestWriteCoreDump
     312{
     313    /** Flags (reserved, MBZ). */
     314    uint32_t fFlags;
     315} VBoxGuestWriteCoreDump;
     316AssertCompileSize(VBoxGuestWriteCoreDump, 4);
    309317
    310318
  • trunk/include/VBox/VBoxGuestLib.h

    r31430 r32574  
    471471VBGLR3DECL(int)     VbglR3MemBalloonRefresh(uint32_t *pcChunks, bool *pfHandleInR3);
    472472VBGLR3DECL(int)     VbglR3MemBalloonChange(void *pv, bool fInflate);
     473/** @}  */
     474
     475/** @name Core Dump
     476 * @{ */
     477VBGLR3DECL(int)     VbglR3WriteCoreDump(void);
     478
    473479/** @}  */
    474480
  • trunk/src/VBox/Additions/common/VBoxControl/VBoxControl.cpp

    r32208 r32574  
    8282    GUEST_SHAREDFOLDERS,
    8383#endif
     84    WRITE_CORE_DUMP,
    8485    TAKE_SNAPSHOT,
    8586    SAVE_STATE,
     
    132133#endif
    133134
     135    if (eWhich == WRITE_CORE_DUMP || eWhich == USAGE_ALL)
     136        doUsage("", g_pszProgName, "writecoredump");
    134137    if (eWhich == TAKE_SNAPSHOT || eWhich == USAGE_ALL)
    135138        doUsage("", g_pszProgName, "takesnapshot");
     
    14061409 * @callback_method_impl{FNVBOXCTRLCMDHANDLER, Command: takesnapshot}
    14071410 */
     1411static RTEXITCODE handleWriteCoreDump(int argc, char *argv[])
     1412{
     1413    int rc = VbglR3WriteCoreDump();
     1414    if (RT_SUCCESS(rc))
     1415    {
     1416        RTPrintf("Successfully taking guest core\n");
     1417        return RTEXITCODE_SUCCESS;
     1418    }
     1419    else
     1420    {
     1421        VBoxControlError("Error while taking guest core. rc=%Rrc\n", rc);
     1422        return RTEXITCODE_FAILURE;
     1423    }
     1424}
     1425
     1426/**
     1427 * @callback_method_impl{FNVBOXCTRLCMDHANDLER, Command: takesnapshot}
     1428 */
    14081429static RTEXITCODE handleTakeSnapshot(int argc, char *argv[])
    14091430{
     
    14841505#ifdef VBOX_WITH_SHARED_FOLDERS
    14851506    { "sharedfolder",           handleSharedFolder },
     1507#endif
     1508#if !defined(VBOX_CONTROL_TEST)
     1509    { "writecoredump",          handleWriteCoreDump },
    14861510#endif
    14871511    { "takesnapshot",           handleTakeSnapshot },
  • trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp

    r32449 r32574  
    19901990
    19911991
     1992/**
     1993 * Handle a request for writing a core dump of the guest on the host.
     1994 *
     1995 * @returns VBox status code.
     1996 *
     1997 * @param pDevExt               The device extension.
     1998 * @param pInfo                 The output buffer.
     1999 */
     2000static int VBoxGuestCommonIOCtl_WriteCoreDump(PVBOXGUESTDEVEXT pDevExt, VBoxGuestWriteCoreDump *pInfo)
     2001{
     2002    VMMDevReqWriteCoreDump *pReq = NULL;
     2003    int rc = VbglGRAlloc((VMMDevRequestHeader **)&pReq, sizeof(*pReq), VMMDevReq_WriteCoreDump);
     2004    if (RT_FAILURE(rc))
     2005    {
     2006        Log(("VBoxGuestCommonIOCtl: WRITE_CORE_DUMP: failed to allocate %u (%#x) bytes to cache the request. rc=%Rrc!!\n",
     2007             sizeof(*pReq), sizeof(*pReq), rc));
     2008        return rc;
     2009    }
     2010
     2011    pReq->fFlags = pInfo->fFlags;
     2012    rc = VbglGRPerform(&pReq->header);
     2013    if (RT_FAILURE(rc))
     2014        Log(("VBoxGuestCommonIOCtl: WRITE_CORE_DUMP: VbglGRPerform failed, rc=%Rrc!\n", rc));
     2015
     2016    VbglGRFree(&pReq->header);
     2017    return rc;
     2018}
     2019
     2020
    19922021#ifdef VBOX_WITH_VRDP_SESSION_HANDLING
    19932022/**
     
    22132242                break;
    22142243
     2244            case VBOXGUEST_IOCTL_WRITE_CORE_DUMP:
     2245                CHECKRET_MIN_SIZE("WRITE_CORE_DUMP", sizeof(VBoxGuestWriteCoreDump));
     2246                rc = VBoxGuestCommonIOCtl_WriteCoreDump(pDevExt, (VBoxGuestWriteCoreDump *)pvData);
     2247                break;
     2248
    22152249#ifdef VBOX_WITH_VRDP_SESSION_HANDLING
    22162250            case VBOXGUEST_IOCTL_ENABLE_VRDP_SESSION:
  • trunk/src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk

    r31520 r32574  
    9494        VBoxGuestR3LibBalloon.cpp \
    9595        VBoxGuestR3LibClipboard.cpp \
     96        VBoxGuestR3LibCoreDump.cpp \
    9697        VBoxGuestR3LibCpuHotPlug.cpp \
    9798        VBoxGuestR3LibCredentials.cpp \
Note: See TracChangeset for help on using the changeset viewer.

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