VirtualBox

Changeset 40767 in vbox


Ignore:
Timestamp:
Apr 5, 2012 9:47:33 AM (12 years ago)
Author:
vboxsync
Message:

also enumerate guest properties during guru meditation

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/HostServices/GuestPropertySvc.h

    r37980 r40767  
    260260     * Takes one 32-bit unsigned integer parameter for the flags.
    261261     */
    262     SET_GLOBAL_FLAGS_HOST = 7
     262    SET_GLOBAL_FLAGS_HOST = 7,
     263
     264    /**
     265     * Return the pointer to a debug info function enumerating all guest properties.
     266     */
     267    GET_DBGF_INFO_FN = 8
    263268};
    264269
  • trunk/src/VBox/HostServices/GuestProperties/service.cpp

    r40633 r40767  
    5252#include <iprt/thread.h>
    5353#include <iprt/time.h>
     54#include <VBox/vmm/dbgf.h>
    5455
    5556#include <memory>  /* for auto_ptr */
     
    359360        return VINF_SUCCESS;
    360361    }
     362
    361363private:
    362364    static DECLCALLBACK(int) reqThreadFn(RTTHREAD ThreadSelf, void *pvUser);
     
    383385    int hostCall(uint32_t eFunction, uint32_t cParms, VBOXHGCMSVCPARM paParms[]);
    384386    int uninit();
     387    void dbgInfoShow(PCDBGFINFOHLP pHlp);
     388    static DECLCALLBACK(void) dbgInfo(void *pvUser, PCDBGFINFOHLP pHlp, const char *pszArgs);
    385389};
    386390
     
    12521256}
    12531257
     1258/**
     1259 * Enumeration data shared between dbgInfoCallback and Service::dbgInfoShow.
     1260 */
     1261typedef struct ENUMDBGINFO
     1262{
     1263    PCDBGFINFOHLP pHlp;
     1264} ENUMDBGINFO;
     1265
     1266static DECLCALLBACK(int) dbgInfoCallback(PRTSTRSPACECORE pStr, void *pvUser)
     1267{
     1268    Property *pProp = (Property *)pStr;
     1269    PCDBGFINFOHLP pHlp = ((ENUMDBGINFO*)pvUser)->pHlp;
     1270
     1271    char szFlags[MAX_FLAGS_LEN];
     1272    int rc = writeFlags(pProp->mFlags, szFlags);
     1273    if (RT_FAILURE(rc))
     1274        RTStrPrintf(szFlags, sizeof(szFlags), "???");
     1275
     1276    pHlp->pfnPrintf(pHlp, "%s: '%s', %RU64",
     1277                    pProp->mName.c_str(), pProp->mValue.c_str(), pProp->mTimestamp);
     1278    if (strlen(szFlags))
     1279        pHlp->pfnPrintf(pHlp, " (%s)", szFlags);
     1280    pHlp->pfnPrintf(pHlp, "\n");
     1281    return 0;
     1282}
     1283
     1284void Service::dbgInfoShow(PCDBGFINFOHLP pHlp)
     1285{
     1286    ENUMDBGINFO EnumData = { pHlp };
     1287    RTStrSpaceEnumerate(&mhProperties, dbgInfoCallback, &EnumData);
     1288}
     1289
     1290/**
     1291 * Handler for debug info.
     1292 *
     1293 * @param   pvUser      user pointer.
     1294 * @param   pHlp        The info helper functions.
     1295 * @param   pszArgs     Arguments, ignored.
     1296 */
     1297void Service::dbgInfo(void *pvUser, PCDBGFINFOHLP pHlp, const char *pszArgs)
     1298{
     1299    SELF *pSelf = reinterpret_cast<SELF *>(pvUser);
     1300    pSelf->dbgInfoShow(pHlp);
     1301}
     1302
    12541303
    12551304/**
     
    13171366                else
    13181367                    rc = VERR_INVALID_PARAMETER;
     1368                break;
     1369
     1370            case GET_DBGF_INFO_FN:
     1371                if (cParms != 2)
     1372                    return VERR_INVALID_PARAMETER;
     1373                paParms[0].u.pointer.addr = (void*)(uintptr_t)dbgInfo;
     1374                paParms[1].u.pointer.addr = (void*)this;
    13191375                break;
    13201376
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r40499 r40767  
    580580                      bool fAttachDetach, bool fIgnoreConnectFailure);
    581581
    582     static DECLCALLBACK(int) configGuestProperties(void *pvConsole);
     582    static DECLCALLBACK(int) configGuestProperties(void *pvConsole, PVM pVM);
    583583    static DECLCALLBACK(int) configGuestControl(void *pvConsole);
    584584    static DECLCALLBACK(void) vmstateChangeCallback(PVM aVM, VMSTATE aState,
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r40706 r40767  
    25712571         */
    25722572
    2573         rc = configGuestProperties(this);
     2573        rc = configGuestProperties(this, pVM);
    25742574#endif /* VBOX_WITH_GUEST_PROPS defined */
    25752575
     
    47364736 * the machine XML and set a couple of initial properties.
    47374737 */
    4738 /* static */ int Console::configGuestProperties(void *pvConsole)
     4738/* static */ int Console::configGuestProperties(void *pvConsole, PVM pVM)
    47394739{
    47404740#ifdef VBOX_WITH_GUEST_PROPS
     
    47604760         * change.
    47614761         */
     4762
     4763        {
     4764            VBOXHGCMSVCPARM Params[2];
     4765            pConsole->m_pVMMDev->hgcmHostCall("VBoxGuestPropSvc", guestProp::GET_DBGF_INFO_FN, 2, &Params[0]);
     4766            PFNDBGFHANDLEREXT pfnHandler = (PFNDBGFHANDLEREXT)(uintptr_t)Params[0].u.pointer.addr;
     4767            void *pService = (void*)Params[1].u.pointer.addr;
     4768            DBGFR3InfoRegisterExternal(pVM, "guestprops", "Display the guest properties", pfnHandler, pService);
     4769        }
    47624770
    47634771        /* Sysprep execution by VBoxService. */
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