VirtualBox

Changeset 7449 in vbox


Ignore:
Timestamp:
Mar 14, 2008 6:12:27 AM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
28887
Message:

Additions/x11: added flow logging statements to the VBoxClient code

Location:
trunk/src/VBox/Additions/x11/xclient
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/xclient/clipboard.cpp

    r7410 r7449  
    1919*   Header Files                                                               *
    2020*******************************************************************************/
    21 #define LOG_GROUP LOG_GROUP_DEV_VMM_BACKDOOR
    2221#include <VBox/HostServices/VBoxClipboardSvc.h>
    2322#include <VBox/log.h>
     
    4039
    4140#include "clipboard.h"
    42 
    43 /* #define DEBUG_CLIPBOARD */
    44 #if !defined(DEBUG_CLIPBOARD) && defined(LOG_TO_BACKDOOR)
    45   /* Disabled unnecessary debug logging in the shared clipboard when
    46      LOG_TO_BACKDOOR is defined (to be removed). */
    47 # undef LogFlow
    48 # define LogFlow(a) do {} while (0)
    49 #endif
    50 
    51 #define TRACE printf("%s: %d\n", __PRETTY_FUNCTION__, __LINE__); Log(("%s: %d\n", __PRETTY_FUNCTION__, __LINE__))
    5241
    5342/** The formats which we support in the guest. These can be deactivated in order to test specific code paths. */
  • trunk/src/VBox/Additions/x11/xclient/clipboard.h

    r7264 r7449  
    2020# define __Additions_linux_clipboard_h
    2121
     22#include <VBox/log.h>
    2223#include "thread.h"                 /* for VBoxGuestThread */
    2324
     
    9091    int init(void)
    9192    {
     93        LogFlowThisFunc(("\n"));
    9294        int rc = mThreadFunction.init();
    9395        if (RT_SUCCESS(rc))
     
    9597        if (RT_SUCCESS(rc))
    9698            mInit = true;
     99        LogFlowThisFunc(("returning %Rrc\n", rc));
    97100        return rc;
    98101    }
     
    103106    void uninit(unsigned cMillies = RT_INDEFINITE_WAIT)
    104107    {
     108        LogFlowThisFunc(("\n"));
    105109        if (mInit)
    106110            mThread.stop(cMillies, NULL);
     111        LogFlowThisFunc(("returning\n"));
    107112    }
    108113
     
    112117    ~VBoxGuestClipboard()
    113118    {
     119        LogFlowThisFunc(("\n"));
    114120        if (mInit)
    115121            try {
    116122                uninit(2000);
    117123            } catch (...) { }
     124        LogFlowThisFunc(("returning\n"));
    118125    }
    119126};
  • trunk/src/VBox/Additions/x11/xclient/displaychange-x11.cpp

    r7332 r7449  
    1616 */
    1717
     18#include <VBox/log.h>
    1819#include <VBox/VBoxGuest.h>
    1920#include <iprt/assert.h>
     
    3233    int rc = VINF_SUCCESS, rcSystem, rcErrno;
    3334
     35    LogFlowThisFunc(("\n"));
    3436    rcSystem = system("VBoxRandR --test");
    3537    if (-1 == rcSystem)
     
    4749    if (RT_SUCCESS(rc))
    4850        mInit = true;
     51    LogFlowThisFunc(("returning %Rrc\n", rc));
    4952    return rc;
    5053}
     
    5255void VBoxGuestDisplayChangeThreadX11::uninit(void)
    5356{
     57    LogFlowThisFunc(("\n"));
    5458    VbglR3CtlFilterMask(0, VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST);
    5559    mInit = false;
     60    LogFlowThisFunc(("returning\n"));
    5661}
    5762
     
    6267{
    6368    mThread = pThread;
     69    LogFlowThisFunc(("\n"));
    6470    while (!mThread->isStopping())
    6571    {
     
    7379            system("VBoxRandR");
    7480    }
     81    LogFlowThisFunc(("returning VINF_SUCCESS\n"));
    7582    return VINF_SUCCESS;
    7683}
     
    8794     *       yield() should give it time to get to one of places mentioned above.
    8895     */
     96    LogFlowThisFunc(("\n"));
    8997    for (int i = 0; (i < 5) && mThread->isRunning(); ++i)
    9098    {
     
    92100        mThread->yield();
    93101    }
     102    LogFlowThisFunc(("returning\n"));
    94103}
    95104
     
    98107    int rc = VINF_SUCCESS;
    99108
     109    LogFlowThisFunc(("\n"));
    100110    if (mInit)
    101111        return VINF_SUCCESS;
     
    111121    if (RT_SUCCESS(rc))
    112122        mInit = true;
     123    LogFlowThisFunc(("returning %Rrc\n, rc"));
    113124    return rc;
    114125}
     
    116127void VBoxGuestDisplayChangeMonitor::uninit(unsigned cMillies /* = RT_INDEFINITE_WAIT */)
    117128{
     129    LogFlowThisFunc(("\n"));
    118130    if (mInit)
    119131    {
     
    121133            mThreadFunction.uninit();
    122134    }
     135    LogFlowThisFunc(("returning\n"));
    123136}
  • trunk/src/VBox/Additions/x11/xclient/displaychange.h

    r6970 r7449  
    1919# define __Additions_client_display_change_h
    2020
     21#include <VBox/log.h>
    2122#include <VBox/VBoxGuest.h>         /* for the R3 guest library functions  */
    2223
     
    4950    ~VBoxGuestDisplayChangeThreadX11()
    5051    {
     52        LogFlowThisFunc(("\n"));
    5153        if (mInit)
    5254        {
     
    5759            catch(...) {}
    5860        }
     61        LogFlowThisFunc(("returning\n"));
    5962    }
    6063    /**
     
    119122    ~VBoxGuestDisplayChangeMonitor()
    120123    {
     124        LogFlowThisFunc(("\n"));
    121125        try
    122126        {
     
    124128        }
    125129        catch(...) {}
     130        LogFlowThisFunc(("returning\n"));
    126131    }
    127132};
  • trunk/src/VBox/Additions/x11/xclient/main.cpp

    r7410 r7449  
    1616 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
    1717 */
    18 
    19 // #define LOG_GROUP LOG_GROUP_DEV_VMM_BACKDOOR
    2018
    2119#include <VBox/VBoxGuest.h>
     
    7371    int rcSystem, rcErrno;
    7472
     73    LogFlowFunc(("\n"));
    7574#ifdef _POSIX_SAVED_IDS
    7675    rcSystem = setuid(getuid());
     
    8483        LogRel(("VBoxClient: failed to drop privileges, error %Rrc.\n", rc));
    8584    }
     85    LogFlowFunc(("returning %Rrc\n", rc));
    8686    return rc;
    8787}
     
    142142    struct sigaction sigAction;
    143143
     144    LogFlowFunc(("\n"));
    144145    sigAction.sa_handler = vboxClientSignalHandler;
    145146    sigemptyset(&sigAction.sa_mask);
     
    154155    sigaction(SIGUSR1, &sigAction, NULL);
    155156    sigaction(SIGUSR2, &sigAction, NULL);
     157    LogFlowFunc(("returning\n"));
    156158}
    157159
  • trunk/src/VBox/Additions/x11/xclient/seamless-host.cpp

    r6959 r7449  
    2121*****************************************************************************/
    2222
    23 #include <iprt/log.h>
     23#include <VBox/log.h>
    2424#include <iprt/err.h>
    2525
     
    3434    int rc = VERR_NOT_SUPPORTED;
    3535
     36    LogFlowThisFunc(("\n"));
    3637    if (mRunning)  /* Assertion */
    3738    {
     
    6364        Log(("VBoxClient (seamless): failed to enable seamless capability on host, rc=%Rrc\n", rc));
    6465    }
     66    LogFlowThisFunc(("returning %Rrc\n", rc));
    6567    return rc;
    6668}
     
    6971void VBoxGuestSeamlessHost::stop(unsigned cMillies /* = RT_INDEFINITE_WAIT */)
    7072{
     73    LogFlowThisFunc(("returning\n"));
    7174    if (!mRunning)  /* Assertion */
    7275    {
     
    7881    VbglR3SeamlessSetCap(false);
    7982    mRunning = false;
     83    LogFlowThisFunc(("returning\n"));
    8084}
    8185
     
    8993    VMMDevSeamlessMode newMode = VMMDev_Seamless_Disabled;
    9094
     95    LogFlowThisFunc(("\n"));
    9196    int rc = VbglR3SeamlessWaitEvent(&newMode);
    9297    if (RT_SUCCESS(rc))
     
    97102            /* A simplified seamless mode, obtained by making the host VM window borderless and
    98103              making the guest desktop transparent. */
    99     #ifdef DEBUG
     104#ifdef DEBUG
    100105                LogRelFunc(("VMMDev_Seamless_Visible_Region request received (VBoxClient).\n"));
    101     #endif
     106#endif
    102107                mState = ENABLE;
    103108                mObserver->notify();
     
    111116                /* fall through to case VMMDev_Seamless_Disabled */
    112117            case VMMDev_Seamless_Disabled:
    113     #ifdef DEBUG
     118#ifdef DEBUG
    114119                LogRelFunc(("VMMDev_Seamless_Disabled set (VBoxClient).\n"));
    115     #endif
     120#endif
    116121                mState = DISABLE;
    117122                mObserver->notify();
     
    122127        LogFunc(("VbglR3SeamlessWaitEvent returned %Rrc (VBoxClient)\n", rc));
    123128    }
     129    LogFlowThisFunc(("returning %Rrc\n", rc));
    124130    return rc;
    125131}
     
    130136void VBoxGuestSeamlessHost::updateRects(std::auto_ptr<std::vector<RTRECT> > pRects)
    131137{
     138    LogFlowThisFunc(("\n"));
    132139    if (0 == pRects.get())  /* Assertion */
    133140    {
     
    136143    }
    137144    VbglR3SeamlessSendRects(pRects.get()->size(), pRects.get()->empty() ? NULL : &pRects.get()->front());
     145    LogFlowThisFunc(("returning\n"));
    138146}
    139147
     
    146154int VBoxGuestSeamlessHostThread::threadFunction(VBoxGuestThread *pThread)
    147155{
     156    LogFlowThisFunc(("\n"));
    148157    if (0 != mHost)
    149158    {
     
    159168        }
    160169    }
     170    LogFlowThisFunc(("returning VINF_SUCCESS\n"));
    161171    return VINF_SUCCESS;
    162172}
     
    167177void VBoxGuestSeamlessHostThread::stop(void)
    168178{
     179    LogFlowThisFunc(("\n"));
    169180    if (0 != mHost)
    170181    {
     
    181192        }
    182193    }
     194    LogFlowThisFunc(("returning\n"));
    183195}
  • trunk/src/VBox/Additions/x11/xclient/seamless-host.h

    r6959 r7449  
    2222#include <vector>                   /* for vector */
    2323
     24#include <VBox/log.h>
    2425#include <VBox/VBoxGuest.h>         /* for the R3 guest library functions  */
    2526
     
    121122    int init(VBoxGuestSeamlessObserver *pObserver)
    122123    {
     124        LogFlowThisFunc(("\n"));
    123125        if (mObserver != 0)  /* Assertion */
    124126        {
     
    127129        }
    128130        mObserver = pObserver;
     131        LogFlowThisFunc(("returning VINF_SUCCESS\n"));
    129132        return VINF_SUCCESS;
    130133    }
     
    161164    ~VBoxGuestSeamlessHost()
    162165    {
     166        LogFlowThisFunc(("\n"));
    163167        if (mRunning)  /* Assertion */
    164168        {
     
    170174            catch(...) {}
    171175        }
     176        LogFlowThisFunc(("returning\n"));
    172177    }
    173178};
  • trunk/src/VBox/Additions/x11/xclient/seamless-x11.cpp

    r7446 r7449  
    2121*****************************************************************************/
    2222
    23 #include <iprt/log.h>
    2423#include <iprt/err.h>
    2524#include <iprt/assert.h>
     25#include <VBox/log.h>
    2626#include <VBox/VBoxGuest.h>
    2727
     
    4141                                    const char *aPropName, unsigned long *nItems)
    4242{
     43    LogFlowFunc(("\n"));
    4344    Atom propNameAtom = XInternAtom (aDpy, aPropName,
    4445                                     True /* only_if_exists */);
     
    5960        return NULL;
    6061
     62    LogFlowFunc(("returning\n"));
    6163    return propVal;
    6264}
     
    7173    int rc = VINF_SUCCESS;
    7274
     75    LogFlowThisFunc(("\n"));
    7376    if (0 != mObserver)  /* Assertion */
    7477    {
     
    8285    }
    8386    mObserver = pObserver;
     87    LogFlowThisFunc(("returning %Rrc\n", rc));
    8488    return rc;
    8589}
     
    99103    int error, event;
    100104
     105    LogFlowThisFunc(("\n"));
    101106    mSupportsShape = XShapeQueryExtension(mDisplay, &event, &error);
    102107    mEnabled = true;
    103108    monitorClientList();
    104109    rebuildWindowTree();
     110    LogFlowThisFunc(("returning %Rrc\n", rc));
    105111    return rc;
    106112}
     
    110116void VBoxGuestSeamlessX11::stop(void)
    111117{
     118    LogFlowThisFunc(("\n"));
    112119    mEnabled = false;
    113120    unmonitorClientList();
    114121    freeWindowTree();
     122    LogFlowThisFunc(("returning\n"));
    115123}
    116124
    117125void VBoxGuestSeamlessX11::monitorClientList(void)
    118126{
     127    LogFlowThisFunc(("called\n"));
    119128    XSelectInput(mDisplay, DefaultRootWindow(mDisplay.get()), SubstructureNotifyMask);
    120129}
     
    122131void VBoxGuestSeamlessX11::unmonitorClientList(void)
    123132{
     133    LogFlowThisFunc(("called\n"));
    124134    XSelectInput(mDisplay, DefaultRootWindow(mDisplay.get()), 0);
    125135}
     
    131141void VBoxGuestSeamlessX11::rebuildWindowTree(void)
    132142{
     143    LogFlowThisFunc(("called\n"));
    133144    freeWindowTree();
    134145    addClients(DefaultRootWindow(mDisplay.get()));
     
    153164    unsigned cChildren;
    154165
     166    LogFlowThisFunc(("\n"));
    155167    if (!XQueryTree(mDisplay.get(), hRoot, &hRealRoot, &hParent, &phChildrenRaw, &cChildren))
    156168        return;
     
    158170    for (unsigned i = 0; i < cChildren; ++i)
    159171        addClientWindow(phChildren.get()[i]);
     172    LogFlowThisFunc(("returning\n"));
    160173}
    161174
     
    163176void VBoxGuestSeamlessX11::addClientWindow(const Window hWin)
    164177{
     178    LogFlowThisFunc(("\n"));
    165179    XWindowAttributes winAttrib;
    166180    bool fAddWin = true;
     
    208222                                winAttrib.width, winAttrib.height, cRects, rects);
    209223    }
     224    LogFlowThisFunc(("returning\n"));
    210225}
    211226
     
    223238    bool rc = false;
    224239
     240    LogFlowThisFunc(("\n"));
    225241    windowTypeRaw = XXGetProperty(mDisplay, hWin, XA_ATOM, WM_TYPE_PROP, &ulCount);
    226242    if (windowTypeRaw != NULL)
     
    231247            rc = true;
    232248    }
     249    LogFlowThisFunc(("returning %s\n", rc ? "true" : "false"));
    233250    return rc;
    234251}
     
    241258{
    242259    /* We use post-increment in the operation to prevent the iterator from being invalidated. */
     260    LogFlowThisFunc(("\n"));
    243261    for (VBoxGuestWindowList::iterator it = mGuestWindows.begin(); it != mGuestWindows.end();
    244262                 mGuestWindows.removeWindow(it++))
     
    246264        XShapeSelectInput(mDisplay, it->first, 0);
    247265    }
     266    LogFlowThisFunc(("returning\n"));
    248267}
    249268
     
    258277    XEvent event;
    259278
     279    LogFlowThisFunc(("\n"));
    260280    /* Start by sending information about the current window setup to the host.  We do this
    261281       here because we want to send all such information from a single thread. */
     
    279299        break;
    280300    }
     301    LogFlowThisFunc(("returning\n"));
    281302}
    282303
     
    288309void VBoxGuestSeamlessX11::doConfigureEvent(const XConfigureEvent *event)
    289310{
     311    LogFlowThisFunc(("\n"));
    290312    VBoxGuestWindowList::iterator iter;
    291313
     
    303325        }
    304326    }
     327    LogFlowThisFunc(("returning\n"));
    305328}
    306329
     
    312335void VBoxGuestSeamlessX11::doMapEvent(const XMapEvent *event)
    313336{
     337    LogFlowThisFunc(("\n"));
    314338    VBoxGuestWindowList::iterator iter;
    315339
     
    319343        addClientWindow(event->window);
    320344    }
     345    LogFlowThisFunc(("returning\n"));
    321346}
    322347
     
    329354void VBoxGuestSeamlessX11::doShapeEvent(const XShapeEvent *event)
    330355{
     356    LogFlowThisFunc(("\n"));
    331357    VBoxGuestWindowList::iterator iter;
    332358
     
    342368        iter->second->mapRects = rects;
    343369    }
     370    LogFlowThisFunc(("returning\n"));
    344371}
    345372
     
    351378void VBoxGuestSeamlessX11::doUnmapEvent(const XUnmapEvent *event)
    352379{
     380    LogFlowThisFunc(("\n"));
    353381    VBoxGuestWindowList::iterator iter;
    354382
     
    358386        mGuestWindows.removeWindow(iter);
    359387    }
     388    LogFlowThisFunc(("returning\n"));
    360389}
    361390
     
    365394std::auto_ptr<std::vector<RTRECT> > VBoxGuestSeamlessX11::getRects(void)
    366395{
     396    LogFlowThisFunc(("\n"));
    367397    unsigned cRects = 0;
    368398    std::auto_ptr<std::vector<RTRECT> > apRects(new std::vector<RTRECT>);
     
    408438    }
    409439    mcRects = cRects;
     440    LogFlowThisFunc(("returning\n"));
    410441    return apRects;
    411442}
     
    418449bool VBoxGuestSeamlessX11::interruptEvent(void)
    419450{
     451    bool rc = false;
     452
     453    LogFlowThisFunc(("\n"));
    420454    /* Message contents set to zero. */
    421455    XClientMessageEvent clientMessage = { ClientMessage, 0, 0, 0, 0, 0, 8 };
     
    425459    {
    426460        XFlush(mDisplay);
    427         return true;
    428     }
    429     return false;
    430 }
     461        rc = true;
     462    }
     463    LogFlowThisFunc(("returning %s\n", rc ? "true" : "false"));
     464    return rc;
     465}
  • trunk/src/VBox/Additions/x11/xclient/seamless-x11.h

    r7106 r7449  
    2020# define __Additions_linux_seamless_x11_h
    2121
     22#include <VBox/log.h>
     23
    2224#include "seamless-guest.h"
    2325
     
    136138    bool init(char *name = NULL)
    137139    {
     140        LogFlowThisFunc(("\n"));
    138141        mDisplay = XOpenDisplay(name);
     142        LogFlowThisFunc(("returning\n"));
    139143        return (mDisplay != NULL);
    140144    }
     
    144148    int close(void)
    145149    {
     150        LogFlowThisFunc(("\n"));
    146151        int rc = XCloseDisplay(mDisplay);
    147152        mDisplay = NULL;
     153        LogFlowThisFunc(("returning\n"));
    148154        return rc;
    149155    }
     
    229235                   VBoxGuestX11Pointer<XRectangle> rects)
    230236    {
     237        LogFlowThisFunc(("\n"));
    231238        VBoxGuestWinInfo *pInfo = new VBoxGuestWinInfo(isMapped, x, y, w, h, cRects,
    232239                                                       rects);
    233240        mWindows.insert(std::pair<Window, VBoxGuestWinInfo *>(hWin, pInfo));
     241        LogFlowThisFunc(("returning\n"));
    234242    }
    235243
    236244    void removeWindow(iterator it)
    237245    {
     246        LogFlowThisFunc(("called\n"));
    238247        delete it->second;
    239248        mWindows.erase(it);
     
    242251    void removeWindow(Window hWin)
    243252    {
     253        LogFlowThisFunc(("called\n"));
    244254        removeWindow(find(hWin));
    245255    }
  • trunk/src/VBox/Additions/x11/xclient/seamless.h

    r7264 r7449  
    1818#ifndef __Additions_xclient_seamless_h
    1919# define __Additions_xclient_seamless_h
     20
     21#include <VBox/log.h>
    2022
    2123#include "seamless-host.h"
     
    5355        int rc = VINF_SUCCESS;
    5456
     57        LogFlowThisFunc(("\n"));
    5558        rc = mGuest->start();
    5659        if (RT_SUCCESS(rc))
     
    6265            mGuest->stop();
    6366        }
     67        LogFlowThisFunc(("returning %Rrc\n", rc));
    6468        return rc;
    6569    }
     
    140144        int rc = VINF_SUCCESS;
    141145
     146        LogFlowThisFunc(("\n"));
    142147        if (isInitialised)  /* Assertion */
    143148        {
     
    165170            LogFunc(("returning %Rrc (VBoxClient)\n", rc));
    166171        }
     172        LogFlowThisFunc(("returning %Rrc\n", rc));
    167173        return rc;
    168174    }
     
    170176    void uninit(unsigned cMillies = RT_INDEFINITE_WAIT)
    171177    {
     178        LogFlowThisFunc(("\n"));
    172179        if (isInitialised)
    173180        {
     
    177184            isInitialised = false;
    178185        }
     186        LogFlowThisFunc(("returning\n"));
    179187    }
    180188
  • trunk/src/VBox/Additions/x11/xclient/thread.cpp

    r6897 r7449  
    1616 */
    1717
     18#include <VBox/log.h>
    1819#include <iostream>   /* For std::exception */
    1920
     
    2526    int rc = VINF_SUCCESS;
    2627
     28    LogFlowThisFunc(("\n"));
    2729    if (NIL_RTTHREAD == mSelf)  /* Assertion */
    2830    {
     
    4446        }
    4547    }
     48    LogFlowThisFunc(("returning %Rrc\n", rc));
    4649    return rc;
    4750}
     
    5053VBoxGuestThread::~VBoxGuestThread(void)
    5154{
     55    LogFlowThisFunc(("\n"));
    5256    if (NIL_RTTHREAD != mSelf)
    5357    {
     
    5963        catch(...) {}
    6064    }
     65    LogFlowThisFunc(("returning\n"));
    6166}
    6267
     
    6469int VBoxGuestThread::start(void)
    6570{
     71    int rc = VINF_SUCCESS;
     72
     73    LogFlowThisFunc(("returning\n"));
    6674    if (NIL_RTTHREAD != mSelf)  /* Assertion */
    6775    {
     
    7078    }
    7179    mExit = false;
    72     return RTThreadCreate(&mSelf, threadFunction, reinterpret_cast<void *>(this),
     80    rc = RTThreadCreate(&mSelf, threadFunction, reinterpret_cast<void *>(this),
    7381                          mStack, mType, mFlags, mName);
     82    LogFlowThisFunc(("returning %Rrc\n", rc));
     83    return rc;
    7484}
    7585
     
    8494{
    8595    int rc = VINF_SUCCESS;
     96
     97    LogFlowFunc(("\n"));
    8698    PSELF pSelf = reinterpret_cast<PSELF>(pvUser);
    8799    pSelf->mRunning = true;
     
    101113    }
    102114    pSelf->mRunning = false;
     115    LogFlowFunc(("returning %Rrc\n", rc));
    103116    return rc;
    104117}
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