VirtualBox

Changeset 235 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jan 23, 2007 1:10:43 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
17761
Message:

Main: Implemented runtime error notifications in IConsole (VMSetRuntimeError and friends).

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

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

    r1 r235  
    33113311    while (it != mCallbacks.end())
    33123312        (*it++)->OnKeyboardLedsChange(fNumLock, fCapsLock, fScrollLock);
     3313}
     3314
     3315/**
     3316 *  @note Locks this object for reading.
     3317 */
     3318void Console::onRuntimeError (BOOL aFatal, INPTR BSTR aErrorID, INPTR BSTR aMessage)
     3319{
     3320    AutoCaller autoCaller (this);
     3321    AssertComRCReturnVoid (autoCaller.rc());
     3322
     3323    AutoReaderLock alock (this);
     3324
     3325    CallbackList::iterator it = mCallbacks.begin();
     3326    while (it != mCallbacks.end())
     3327        (*it++)->OnRuntimeError (aFatal, aErrorID, aMessage);
    33133328}
    33143329
     
    53225337#undef STR_CONV
    53235338
    5324     /*
    5325      * Register VM state change handler
    5326      */
    5327     rc = VMR3AtStateRegister(pVM, Console::vmstateChangeCallback, pConsole);
    5328     AssertRC (rc);
    5329 
    5330     /*
    5331      * Save the VM pointer in the machine object.
    5332      */
     5339    /* Register VM state change handler */
     5340    int rc2 = VMR3AtStateRegister (pVM, Console::vmstateChangeCallback, pConsole);
     5341    AssertRC (rc2);
     5342    if (VBOX_SUCCESS (rc))
     5343        rc = rc2;
     5344
     5345    /* Register VM runtime error handler */
     5346    rc2 = VMR3AtRuntimeErrorRegister (pVM, Console::setVMRuntimeErrorCallback, pConsole);
     5347    AssertRC (rc2);
     5348    if (VBOX_SUCCESS (rc))
     5349        rc = rc2;
     5350
     5351    /* Save the VM pointer in the machine object */
    53335352    pConsole->mpVM = pVM;
    53345353
     
    57095728    AssertReturnVoid (task);
    57105729
     5730    /* we ignore RT_SRC_POS_DECL arguments to avoid confusion of end-users */
    57115731    HRESULT hrc = setError (E_FAIL, tr ("%N.\n"
    5712                                         "At '%s' (%d) in %s.\n"
    5713                                         "VBox status code: %d %Vrc\n"),
     5732                                        "VBox status code: %d (%Vrc)"),
    57145733                                    tr (pszFormat), &args,
    5715                                     pszFile, iLine, pszFunction,
    57165734                                    rc, rc);
    57175735    task->mProgress->notifyComplete (hrc);
    57185736}
    57195737
    5720 
     5738/**
     5739 * VM runtime error callback function.
     5740 * See VMSetRuntimeError for the detailed description of parameters.
     5741 *
     5742 * @param   pVM             The VM handle.
     5743 * @param   pvUser          The user argument.
     5744 * @param   fFatal          Whether it is a fatal error or not.
     5745 * @param   pszErrorID      Error ID string.
     5746 * @param   pszFormat       Error message format string.
     5747 * @param   args            Error message arguments.
     5748 * @thread EMT.
     5749 */
     5750/* static */ DECLCALLBACK(void)
     5751Console::setVMRuntimeErrorCallback (PVM pVM, void *pvUser, bool fFatal,
     5752                                    const char *pszErrorID,
     5753                                    const char *pszFormat, va_list args)
     5754{
     5755    LogFlowFuncEnter();
     5756
     5757    Console *that = static_cast <Console *> (pvUser);
     5758    AssertReturnVoid (that);
     5759
     5760    Utf8Str message = Utf8StrFmt (pszFormat, args);
     5761
     5762    LogRel (("Console: VM runtime error: fatal=%RTbool, "
     5763             "errorID=%s message=\"%s\"\n",
     5764             fFatal, pszErrorID, message.raw()));
     5765
     5766    that->onRuntimeError (BOOL (fFatal), Bstr (pszErrorID), Bstr (message));
     5767
     5768    LogFlowFuncLeave();
     5769}
    57215770
    57225771/**
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r132 r235  
    24352435                    <li><i>fatal</i></li>
    24362436                    <li><i>non-fatal with retry</i></li>
    2437                     <li><i>non-fatal without retry</i></li>
     2437                    <li><i>non-fatal warnings</i></li>
    24382438                </ul>
    24392439               
     
    24462446                Resuming the execution can lead to unpredictable results.
    24472447               
    2448                 <b>Non-fatal</b> errors are indicated by the
     2448                <b>Non-fatal</b> errors and warnings are indicated by the
    24492449                @a fatal parameter set to <tt>false</tt>. If the virtual machine
    24502450                is in the Paused state by the time the error notification is
    2451                 received, it means that the user can retry the machine
     2451                received, it means that the user can <i>try to resume</i> the machine
    24522452                execution after attempting to solve the probem that caused the
    24532453                error. In this case, the notification handler is supposed
     
    24582458                the machine execution using the <link to="IConsole::resume()"/>
    24592459                call. If the machine execution is not Paused during this
    2460                 notification, then it means this notification is a warning (for
    2461                 example, about a fatal condition that can happen very soon); no
    2462                 any immediate action is required from the user, the machine
     2460                notification, then it means this notification is a <i>warning</i>
     2461                (for example, about a fatal condition that can happen very soon);
     2462                no immediate action is required from the user, the machine
    24632463                continues its normal execution.
    24642464
     
    24712471                Currently, the following error identificators are known:
    24722472                <ul>
    2473                 <li>"HostMemoryLow"</li>
    2474                 <li>"HostAudioNotResponding"</li>
    2475                 <li>"VDIStorageFull"</li>
     2473                <li><tt>"HostMemoryLow"</tt></li>
     2474                <li><tt>"HostAudioNotResponding"</tt></li>
     2475                <li><tt>"VDIStorageFull"</tt></li>
    24762476                </ul>
    24772477
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r1 r235  
    189189    void onAdditionsStateChange();
    190190    void onAdditionsOutdated();
    191     void onKeyboardLedsChange(bool fNumLock, bool fCapsLock, bool fScrollLock);
     191    void onKeyboardLedsChange (bool fNumLock, bool fCapsLock, bool fScrollLock);
     192    void onRuntimeError (BOOL aFatal, INPTR BSTR aErrorID, INPTR BSTR aMessage);
    192193
    193194    static const PDMDRVREG DrvStatusReg;
     
    375376                        const char *pszFormat, va_list args);
    376377
     378    static DECLCALLBACK(void)
     379    setVMRuntimeErrorCallback (PVM pVM, void *pvUser, bool fFatal,
     380                               const char *pszErrorID,
     381                               const char *pszFormat, va_list args);
     382
    377383    HRESULT                     captureUSBDevices (PVM pVM);
    378384    void                        releaseAllUSBDevices (void);
Note: See TracChangeset for help on using the changeset viewer.

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