VirtualBox

Changeset 32360 in vbox


Ignore:
Timestamp:
Sep 9, 2010 3:11:45 PM (14 years ago)
Author:
vboxsync
Message:

Main/ConsoleImpl: Setup CoreDumper (Solaris only for now).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r32194 r32360  
    4040#   include <stdlib.h>
    4141#   include <string.h>
     42#elif defined(RT_OS_SOLARIS)
     43#   include <iprt/coredumper.h>
    4244#endif
    4345
     
    53805382    rc = consoleInitReleaseLog(mMachine);
    53815383    if (FAILED(rc)) return rc;
     5384
     5385#ifdef RT_OS_SOLARIS
     5386    /* setup host core dumper for the VM */
     5387    Bstr value;
     5388    HRESULT hrc = mMachine->GetExtraData(Bstr("VBoxInternal2/CoreDumpEnabled"), value.asOutParam());
     5389    if (SUCCEEDED(hrc) && value == "1")
     5390    {
     5391        Bstr coreDumpDir, coreDumpReplaceSys, coreDumpLive;
     5392        mMachine->GetExtraData(Bstr("VBoxInternal2/CoreDumpDir"), coreDumpDir.asOutParam());
     5393        mMachine->GetExtraData(Bstr("VBoxInternal2/CoreDumpReplaceSystemDump"), coreDumpReplaceSys.asOutParam());
     5394        mMachine->GetExtraData(Bstr("VBoxInternal2/CoreDumpLive"), coreDumpLive.asOutParam());
     5395
     5396        uint32_t fCoreFlags = 0;
     5397        if (   coreDumpReplaceSys.isEmpty() == false
     5398            && Utf8Str(coreDumpReplaceSys).toUInt32() == 1)
     5399        {
     5400            fCoreFlags |= RTCOREDUMPER_FLAGS_REPLACE_SYSTEM_DUMP;
     5401        }
     5402
     5403        if (   coreDumpLive.isEmpty() == false
     5404            && Utf8Str(coreDumpLive).toUInt32() == 1)
     5405        {
     5406            fCoreFlags |= RTCOREDUMPER_FLAGS_LIVE_CORE;
     5407        }
     5408
     5409        const char *pszDumpDir = Utf8Str(coreDumpDir).c_str();
     5410        if (   pszDumpDir
     5411            && *pszDumpDir == '\0')
     5412            pszDumpDir = NULL;
     5413
     5414        int vrc = VERR_GENERAL_FAILURE;
     5415        if (   pszDumpDir
     5416            && !RTDirExists(pszDumpDir))
     5417        {
     5418            /*
     5419             * Try create the directory.
     5420             */
     5421            vrc = RTDirCreateFullPath(pszDumpDir, 0777);
     5422            if (RT_FAILURE(vrc))
     5423                return setError(E_FAIL, "Failed to setup CoreDumper. Couldn't create dump directory '%s' (%Rrc)\n", pszDumpDir, vrc);
     5424        }
     5425
     5426        vrc = RTCoreDumperSetup(pszDumpDir, fCoreFlags);
     5427        if (RT_FAILURE(vrc))
     5428            return setError(E_FAIL, "Failed to setup CoreDumper (%Rrc)", vrc);
     5429        else
     5430            LogRel(("CoreDumper setup successful. pszDumpDir=%s fFlags=%#x\n", pszDumpDir ? pszDumpDir : ".", fCoreFlags));
     5431    }
     5432#endif
    53825433
    53835434    /* pass the progress object to the caller if requested */
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