VirtualBox

Changeset 8823 in vbox for trunk/src/VBox/VMM/DBGF.cpp


Ignore:
Timestamp:
May 14, 2008 9:51:07 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
30830
Message:

Don't loop forever in DBGFR3Term if the debugger and EMT race each other.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/DBGF.cpp

    r8797 r8823  
    159159        &&  pVM->dbgf.s.PingPong.enmSpeaker == RTPINGPONGSPEAKER_PONG)
    160160    {
    161         do  rc = RTSemPingWait(&pVM->dbgf.s.PingPong, 5000);
    162         while (pVM->dbgf.s.fAttached);
     161        RTThreadSleep(32); /* Don't want that assertion if we can help it. */
     162        while (   pVM->dbgf.s.fAttached
     163               && pVM->dbgf.s.PingPong.enmSpeaker == RTPINGPONGSPEAKER_PONG)
     164            if (RTSemPingWait(&pVM->dbgf.s.PingPong, 5000) != VERR_TIMEOUT)
     165                break;
    163166    }
    164167
     
    827830DBGFR3DECL(int) DBGFR3Detach(PVM pVM)
    828831{
     832    LogFlowFunc(("\n"));
     833
    829834    /*
    830835     * Check if attached.
     
    839844     * Send detach command.
    840845     */
     846    DBGFCMD enmCmd;
    841847    if (pVM->dbgf.s.PingPong.enmSpeaker == RTPINGPONGSPEAKER_PONG)
    842848    {
    843         dbgfr3SetCmd(pVM, DBGFCMD_DETACH_DEBUGGER);
     849        enmCmd = dbgfr3SetCmd(pVM, DBGFCMD_DETACH_DEBUGGER);
    844850        int rc = RTSemPong(&pVM->dbgf.s.PingPong);
    845851        if (VBOX_FAILURE(rc))
     
    848854            return rc;
    849855        }
     856        LogFunc(("enmCmd=%d (pong -> ping)\n", enmCmd));
    850857    }
    851858    else
    852         dbgfr3SetCmd(pVM, DBGFCMD_DETACH_DEBUGGER);
     859    {
     860        enmCmd = dbgfr3SetCmd(pVM, DBGFCMD_DETACH_DEBUGGER);
     861        LogFunc(("enmCmd=%d (ping)\n", enmCmd));
     862    }
    853863
    854864    /*
     
    866876     * Destroy the ping-pong construct and return.
    867877     */
    868     pVM->dbgf.s.fAttached = false;
     878    ASMAtomicWriteBool(&pVM->dbgf.s.fAttached, false);
    869879    RTThreadSleep(10);
    870880    rc = RTSemPingPongDestroy(&pVM->dbgf.s.PingPong);
    871881    AssertRC(rc);
    872882
     883    LogFlowFunc(("returns VINF_SUCCESS\n"));
    873884    return VINF_SUCCESS;
    874885}
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