VirtualBox

Changeset 45984 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
May 11, 2013 12:46:30 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
85642
Message:

RTDbgCfg: Debugging configuration, like symbol search paths and such.

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

Legend:

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

    r44399 r45984  
    139139int dbgfR3AsInit(PUVM pUVM)
    140140{
     141    Assert(pUVM->pVM);
     142
    141143    /*
    142144     * Create the semaphore.
     
    144146    int rc = RTSemRWCreate(&pUVM->dbgf.s.hAsDbLock);
    145147    AssertRCReturn(rc, rc);
     148
     149    /*
     150     * Create the debugging config instance and set it up.
     151     */
     152    rc = RTDbgCfgCreate(&pUVM->dbgf.s.hDbgCfg, NULL);
     153    AssertRCReturn(rc, rc);
     154
     155    static struct
     156    {
     157        RTDBGCFGPROP    enmProp;
     158        const char     *pszEnvName;
     159        const char     *pszCfgName;
     160    } const s_aProps[] =
     161    {
     162        { RTDBGCFGPROP_FLAGS,               "VBOXDBG_FLAGS",            "Flags"             },
     163        { RTDBGCFGPROP_PATH,                "VBOXDBG_PATH",             "Path"              },
     164        { RTDBGCFGPROP_SUFFIXES,            "VBOXDBG_SUFFIXES",         "Suffixes"          },
     165        { RTDBGCFGPROP_SRC_PATH,            "VBOXDBG_SRC_PATH",         "SrcPath"           },
     166    };
     167    PCFGMNODE pCfgDbgf = CFGMR3GetChild(CFGMR3GetRootU(pUVM), "/DBGF");
     168    for (unsigned i = 0; i < RT_ELEMENTS(s_aProps); i++)
     169    {
     170        const char *pszEnvValue = RTEnvGet(s_aProps[i].pszEnvName);
     171        if (pszEnvValue)
     172        {
     173            rc = RTDbgCfgChangeString(pUVM->dbgf.s.hDbgCfg, s_aProps[i].enmProp, RTDBGCFGOP_PREPEND, pszEnvValue);
     174            if (RT_FAILURE(rc))
     175                return VMR3SetError(pUVM, rc, RT_SRC_POS,
     176                                    "DBGF Config Error: %s=%s -> %Rrc", s_aProps[i].pszEnvName, pszEnvValue, rc);
     177        }
     178
     179        char *pszCfgValue;
     180        int rc = CFGMR3QueryStringAllocDef(pCfgDbgf, s_aProps[i].pszCfgName, &pszCfgValue, NULL);
     181        if (RT_FAILURE(rc))
     182            return VMR3SetError(pUVM, rc, RT_SRC_POS,
     183                                "DBGF Config Error: Querying /DBGF/%s -> %Rrc", s_aProps[i].pszCfgName, rc);
     184        if (pszCfgValue)
     185        {
     186            rc = RTDbgCfgChangeString(pUVM->dbgf.s.hDbgCfg, s_aProps[i].enmProp, RTDBGCFGOP_PREPEND, pszCfgValue);
     187            if (RT_FAILURE(rc))
     188                return VMR3SetError(pUVM, rc, RT_SRC_POS,
     189                                    "DBGF Config Error: /DBGF/%s=%s -> %Rrc", s_aProps[i].pszCfgName, pszCfgValue, rc);
     190        }
     191    }
    146192
    147193    /*
     
    419465    {
    420466        RTDBGMOD hDbgMod;
    421         int rc = RTDbgModCreateFromImage(&hDbgMod, pszFilename, pszName, 0 /*fFlags*/);
     467        int rc = RTDbgModCreateFromImage(&hDbgMod, pszFilename, pszName, pVM->pUVM->dbgf.s.hDbgCfg);
    422468        if (RT_SUCCESS(rc))
    423469        {
     
    740786
    741787/**
    742  * Callback function used by DBGFR3AsLoadImage.
    743  *
    744  * @returns VBox status code.
    745  * @param   pszFilename     The filename under evaluation.
    746  * @param   pvUser          Use arguments (DBGFR3ASLOADOPENDATA).
    747  */
    748 static DECLCALLBACK(int) dbgfR3AsLoadImageOpen(const char *pszFilename, void *pvUser)
    749 {
    750     DBGFR3ASLOADOPENDATA *pData = (DBGFR3ASLOADOPENDATA *)pvUser;
    751     return RTDbgModCreateFromImage(&pData->hMod, pszFilename, pData->pszModName, pData->fFlags);
    752 }
    753 
    754 
    755 /**
    756788 * Load symbols from an executable module into the specified address space.
    757789 *
     
    785817        return VERR_INVALID_HANDLE;
    786818
    787     /*
    788      * Do the work.
    789      */
    790     DBGFR3ASLOADOPENDATA Data;
    791     Data.pszModName = pszModName;
    792     Data.uSubtrahend = 0;
    793     Data.fFlags = 0;
    794     Data.hMod = NIL_RTDBGMOD;
    795     int rc = dbgfR3AsSearchCfgPath(pUVM, pszFilename, "ImagePath", dbgfR3AsLoadImageOpen, &Data);
    796     if (RT_FAILURE(rc))
    797         rc = dbgfR3AsSearchEnvPath(pszFilename, "VBOXDBG_IMAGE_PATH", dbgfR3AsLoadImageOpen, &Data);
    798     if (RT_FAILURE(rc))
    799         rc = dbgfR3AsSearchCfgPath(pUVM, pszFilename, "Path", dbgfR3AsLoadImageOpen, &Data);
    800     if (RT_FAILURE(rc))
    801         rc = dbgfR3AsSearchEnvPath(pszFilename, "VBOXDBG_PATH", dbgfR3AsLoadImageOpen, &Data);
     819    RTDBGMOD hDbgMod;
     820    int rc = RTDbgModCreateFromImage(&hDbgMod, pszFilename, pszModName, pUVM->dbgf.s.hDbgCfg);
    802821    if (RT_SUCCESS(rc))
    803822    {
    804         rc = DBGFR3AsLinkModule(pUVM, hRealAS, Data.hMod, pModAddress, iModSeg, 0);
     823        rc = DBGFR3AsLinkModule(pUVM, hRealAS, hDbgMod, pModAddress, iModSeg, 0);
    805824        if (RT_FAILURE(rc))
    806             RTDbgModRelease(Data.hMod);
     825            RTDbgModRelease(hDbgMod);
    807826    }
    808827
    809828    RTDbgAsRelease(hRealAS);
    810829    return rc;
    811 }
    812 
    813 
    814 /**
    815  * Callback function used by DBGFR3AsLoadMap.
    816  *
    817  * @returns VBox status code.
    818  * @param   pszFilename     The filename under evaluation.
    819  * @param   pvUser          Use arguments (DBGFR3ASLOADOPENDATA).
    820  */
    821 static DECLCALLBACK(int) dbgfR3AsLoadMapOpen(const char *pszFilename, void *pvUser)
    822 {
    823     DBGFR3ASLOADOPENDATA *pData = (DBGFR3ASLOADOPENDATA *)pvUser;
    824     return RTDbgModCreateFromMap(&pData->hMod, pszFilename, pData->pszModName, pData->uSubtrahend, pData->fFlags);
    825830}
    826831
     
    862867        return VERR_INVALID_HANDLE;
    863868
    864     /*
    865      * Do the work.
    866      */
    867     DBGFR3ASLOADOPENDATA Data;
    868     Data.pszModName = pszModName;
    869     Data.uSubtrahend = uSubtrahend;
    870     Data.fFlags = 0;
    871     Data.hMod = NIL_RTDBGMOD;
    872     int rc = dbgfR3AsSearchCfgPath(pUVM, pszFilename, "MapPath", dbgfR3AsLoadMapOpen, &Data);
    873     if (RT_FAILURE(rc))
    874         rc = dbgfR3AsSearchEnvPath(pszFilename, "VBOXDBG_MAP_PATH", dbgfR3AsLoadMapOpen, &Data);
    875     if (RT_FAILURE(rc))
    876         rc = dbgfR3AsSearchCfgPath(pUVM, pszFilename, "Path", dbgfR3AsLoadMapOpen, &Data);
    877     if (RT_FAILURE(rc))
    878         rc = dbgfR3AsSearchEnvPath(pszFilename, "VBOXDBG_PATH", dbgfR3AsLoadMapOpen, &Data);
     869    RTDBGMOD hDbgMod;
     870    int rc = RTDbgModCreateFromMap(&hDbgMod, pszFilename, pszModName, uSubtrahend, pUVM->dbgf.s.hDbgCfg);
    879871    if (RT_SUCCESS(rc))
    880872    {
    881         rc = DBGFR3AsLinkModule(pUVM, hRealAS, Data.hMod, pModAddress, iModSeg, 0);
     873        rc = DBGFR3AsLinkModule(pUVM, hRealAS, hDbgMod, pModAddress, iModSeg, 0);
    882874        if (RT_FAILURE(rc))
    883             RTDbgModRelease(Data.hMod);
     875            RTDbgModRelease(hDbgMod);
    884876    }
    885877
  • trunk/src/VBox/VMM/VMMR3/PATM.cpp

    r45620 r45984  
    41484148        return VERR_PATCHING_REFUSED;
    41494149
    4150 #if 0 /* DONT COMMIT ENABLED! */
     4150#if 1 /* DONT COMMIT ENABLED! */
    41514151    /* Blacklisted NT4SP1 areas - debugging why we sometimes crash early on, */
    41524152    if (  0
  • trunk/src/VBox/VMM/include/DBGFInternal.h

    r44528 r45984  
    2525#include <iprt/string.h>
    2626#include <iprt/avl.h>
     27#include <iprt/dbg.h>
    2728#include <VBox/vmm/dbgf.h>
    2829
     
    307308    /** Alignment padding. */
    308309    bool                        afAlignment1[2];
     310    /** Debug configuration. */
     311    R3PTRTYPE(RTDBGCFG)         hDbgCfg;
    309312
    310313    /** The register database lock. */
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