VirtualBox

Changeset 39650 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Dec 16, 2011 11:27:51 PM (13 years ago)
Author:
vboxsync
Message:

DBGF,Main,VBoxManage: added target logger prefixes (release:/debug:). Implemented logger modifier methods in IMachineDebugger. Exposed these methods in VBoxManage debugvm.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/DBGFLog.cpp

    r38838 r39650  
    2626#include <VBox/err.h>
    2727#include <iprt/assert.h>
     28#include <iprt/string.h>
    2829
    2930
     
    3738
    3839/**
     40 * Checkes for logger prefixes and selects the right logger.
     41 *
     42 * @returns Target logger.
     43 * @param   ppsz                Pointer to the string pointer.
     44 */
     45static PRTLOGGER dbgfR3LogResolvedLogger(const char **ppsz)
     46{
     47    PRTLOGGER   pLogger;
     48    const char *psz = *ppsz;
     49    if (!strncmp(psz, "release:", sizeof("release:") - 1))
     50    {
     51        *ppsz += sizeof("release:") - 1;
     52        pLogger = RTLogRelDefaultInstance();
     53    }
     54    else
     55    {
     56        if (!strncmp(psz, "debug:", sizeof("debug:") - 1))
     57            *ppsz += sizeof("debug:") - 1;
     58        pLogger = RTLogDefaultInstance();
     59    }
     60    return pLogger;
     61}
     62
     63
     64/**
    3965 * Changes the logger group settings.
    4066 *
     
    4268 * @param   pVM                 The VM handle.
    4369 * @param   pszGroupSettings    The group settings string. (VBOX_LOG)
     70 *                              By prefixing the string with \"release:\" the
     71 *                              changes will be applied to the release log
     72 *                              instead of the debug log.  The prefix \"debug:\"
     73 *                              is also recognized.
    4474 */
    4575VMMR3DECL(int) DBGFR3LogModifyGroups(PVM pVM, const char *pszGroupSettings)
     
    6191static DECLCALLBACK(int) dbgfR3LogModifyGroups(PVM pVM, const char *pszGroupSettings)
    6292{
    63     int rc = RTLogGroupSettings(NULL, pszGroupSettings);
     93    PRTLOGGER pLogger = dbgfR3LogResolvedLogger(&pszGroupSettings);
     94    if (!pLogger)
     95        return VINF_SUCCESS;
     96
     97    int rc = RTLogGroupSettings(pLogger, pszGroupSettings);
    6498    if (RT_SUCCESS(rc))
    6599        rc = VMMR3UpdateLoggers(pVM);
     
    74108 * @param   pVM                 The VM handle.
    75109 * @param   pszFlagSettings     The group settings string. (VBOX_LOG_FLAGS)
     110 *                              By prefixing the string with \"release:\" the
     111 *                              changes will be applied to the release log
     112 *                              instead of the debug log.  The prefix \"debug:\"
     113 *                              is also recognized.
    76114 */
    77115VMMR3DECL(int) DBGFR3LogModifyFlags(PVM pVM, const char *pszFlagSettings)
     
    93131static DECLCALLBACK(int) dbgfR3LogModifyFlags(PVM pVM, const char *pszFlagSettings)
    94132{
    95     int rc = RTLogFlags(NULL, pszFlagSettings);
     133    PRTLOGGER pLogger = dbgfR3LogResolvedLogger(&pszFlagSettings);
     134    if (!pLogger)
     135        return VINF_SUCCESS;
     136
     137    int rc = RTLogFlags(pLogger, pszFlagSettings);
    96138    if (RT_SUCCESS(rc))
    97139        rc = VMMR3UpdateLoggers(pVM);
     
    106148 * @param   pVM                 The VM handle.
    107149 * @param   pszDestSettings     The destination settings string. (VBOX_LOG_DEST)
     150 *                              By prefixing the string with \"release:\" the
     151 *                              changes will be applied to the release log
     152 *                              instead of the debug log.  The prefix \"debug:\"
     153 *                              is also recognized.
    108154 */
    109155VMMR3DECL(int) DBGFR3LogModifyDestinations(PVM pVM, const char *pszDestSettings)
     
    125171static DECLCALLBACK(int) dbgfR3LogModifyDestinations(PVM pVM, const char *pszDestSettings)
    126172{
     173    PRTLOGGER pLogger = dbgfR3LogResolvedLogger(&pszDestSettings);
     174    if (!pLogger)
     175        return VINF_SUCCESS;
     176
    127177    int rc = RTLogDestinations(NULL, pszDestSettings);
    128178    if (RT_SUCCESS(rc))
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