VirtualBox

Changeset 48696 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Sep 26, 2013 12:22:48 AM (11 years ago)
Author:
vboxsync
Message:

DBGC: Added unload command as well as loadimage32 and loadimage64 for mac os x and efi debugging.

Location:
trunk/src/VBox/Debugger
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Debugger/DBGCCommands.cpp

    r47281 r48696  
    6262static FNDBGCCMD dbgcCmdLoadMap;
    6363static FNDBGCCMD dbgcCmdLoadSeg;
     64static FNDBGCCMD dbgcCmdUnload;
    6465static FNDBGCCMD dbgcCmdSet;
    6566static FNDBGCCMD dbgcCmdUnset;
     
    196197    {  1,           1,          DBGCVAR_CAT_SYMBOL,     0,                              "var",          "Variable name." },
    197198    {  1,           1,          DBGCVAR_CAT_ANY,        0,                              "value",        "Value to assign to the variable." },
     199};
     200
     201/** loadplugin, unloadplugin. */
     202static const DBGCVARDESC    g_aArgUnload[] =
     203{
     204    /* cTimesMin,   cTimesMax,  enmCategory,            fFlags,                         pszName,        pszDescription */
     205    {  1,           ~0U,        DBGCVAR_CAT_STRING,     0,                              "modname",      "Unloads all mappings of the given modules in the active address space." },
    198206};
    199207
     
    230238                                                                                                                                                 "Loads the symbols of an executable image at the specified address. "
    231239                                                                                                                                                 /*"Optionally giving the module a name other than the file name stem."*/ }, /** @todo implement line breaks */
     240    { "loadimage32",2,        3,        &g_aArgLoadImage[0], RT_ELEMENTS(g_aArgLoadImage), 0, dbgcCmdLoadImage, "<filename> <address> [name]", "loadimage variant for selecting 32-bit images (mach-o)." },
     241    { "loadimage64",2,        3,        &g_aArgLoadImage[0], RT_ELEMENTS(g_aArgLoadImage), 0, dbgcCmdLoadImage, "<filename> <address> [name]", "loadimage variant for selecting 64-bit images (mach-o)." },
    232242    { "loadmap",    2,        5,        &g_aArgLoadMap[0],   RT_ELEMENTS(g_aArgLoadMap),   0, dbgcCmdLoadMap,   "<filename> <address> [name] [subtrahend] [seg]",
    233243                                                                                                                                       "Loads the symbols from a map file, usually at a specified address. "
     
    250260    { "showvars",   0,        0,        NULL,                0,                            0, dbgcCmdShowVars,  "",                     "List all the defined variables." },
    251261    { "stop",       0,        0,        NULL,                0,                            0, dbgcCmdStop,      "",                     "Stop execution." },
     262    { "unload",     1,       ~0U,       &g_aArgUnload[0],    RT_ELEMENTS(g_aArgUnload),    0, dbgcCmdUnload,    "<modname1> [modname2..N]", "Unloads one or more modules in the current address space." },
    252263    { "unloadplugin", 1,     ~0U,       &g_aArgPlugIn[0],    RT_ELEMENTS(g_aArgPlugIn),    0, dbgcCmdUnloadPlugIn, "<plugin1> [plugin2..N]", "Unloads one or more plugins." },
    253264    { "unset",      1,       ~0U,       &g_aArgUnset[0],     RT_ELEMENTS(g_aArgUnset),     0, dbgcCmdUnset,     "<var1> [var1..[varN]]",  "Unsets (delete) one or more global variables." },
     
    13051316
    13061317    /*
     1318     * Determine the desired image arch from the load command used.
     1319     */
     1320    RTLDRARCH enmArch = RTLDRARCH_WHATEVER;
     1321    if (pCmd->pszCmd[sizeof("loadimage") - 1] == '3')
     1322        enmArch = RTLDRARCH_X86_32;
     1323    else if (pCmd->pszCmd[sizeof("loadimage") - 1] == '6')
     1324        enmArch = RTLDRARCH_AMD64;
     1325
     1326    /*
    13071327     * Try create a module for it.
    13081328     */
    13091329    PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp);
    1310     rc = DBGFR3AsLoadImage(pUVM, pDbgc->hDbgAs, pszFilename, pszModName, &ModAddress, NIL_RTDBGSEGIDX, 0 /*fFlags*/);
     1330    rc = DBGFR3AsLoadImage(pUVM, pDbgc->hDbgAs, pszFilename, pszModName, enmArch, &ModAddress, NIL_RTDBGSEGIDX, 0 /*fFlags*/);
    13111331    if (RT_FAILURE(rc))
    13121332        return DBGCCmdHlpVBoxError(pCmdHlp, rc, "DBGFR3ModuleLoadImage(,,'%s','%s',%Dv,)\n",
    13131333                                   pszFilename, pszModName, &paArgs[1]);
    13141334
    1315     NOREF(pCmd);
    13161335    return VINF_SUCCESS;
    13171336}
     
    14171436     */
    14181437    PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp);
    1419     rc = DBGFR3AsLoadImage(pUVM, pDbgc->hDbgAs, pszFilename, pszModName, &ModAddress, iModSeg, 0 /*fFlags*/);
     1438    rc = DBGFR3AsLoadImage(pUVM, pDbgc->hDbgAs, pszFilename, pszModName, RTLDRARCH_WHATEVER, &ModAddress, iModSeg, 0 /*fFlags*/);
    14201439    if (RT_FAILURE(rc))
    14211440        return DBGCCmdHlpVBoxError(pCmdHlp, rc, "DBGFR3ModuleLoadImage(,,'%s','%s',%Dv,)\n",
    14221441                                   pszFilename, pszModName, &paArgs[1]);
     1442
     1443    NOREF(pCmd);
     1444    return VINF_SUCCESS;
     1445}
     1446
     1447
     1448/**
     1449 * @interface_method_impl{FNDBCCMD, The 'unload' command.}
     1450 */
     1451static DECLCALLBACK(int) dbgcCmdUnload(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
     1452{
     1453    PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp);
     1454
     1455    /*
     1456     * Validate the parsing and make sense of the input.
     1457     * This is a mess as usual because we don't trust the parser yet.
     1458     */
     1459    AssertReturn(    cArgs >= 1
     1460                 &&  paArgs[0].enmType == DBGCVAR_TYPE_STRING,
     1461                 VERR_DBGC_PARSE_INCORRECT_ARG_TYPE);
     1462    for (unsigned i = 0; i < cArgs; i++)
     1463    {
     1464        AssertReturn(paArgs[i].enmType == DBGCVAR_TYPE_STRING, VERR_DBGC_PARSE_INCORRECT_ARG_TYPE);
     1465
     1466        int rc = DBGFR3AsUnlinkModuleByName(pUVM, pDbgc->hDbgAs, paArgs[i].u.pszString);
     1467        if (RT_FAILURE(rc))
     1468            return DBGCCmdHlpVBoxError(pCmdHlp, rc, "DBGFR3AsUnlinkModuleByName(,,'%s')\n", paArgs[i].u.pszString);
     1469    }
    14231470
    14241471    NOREF(pCmd);
     
    14461493    if (!RT_C_IS_ALPHA(*pszVar) || *pszVar == '_')
    14471494        return DBGCCmdHlpPrintf(pCmdHlp,
    1448             "syntax error: Invalid variable name '%s'. Variable names must match regex '[_a-zA-Z][_a-zA-Z0-9*'!", paArgs[0].u.pszString);
     1495                                "syntax error: Invalid variable name '%s'. Variable names must match regex '[_a-zA-Z][_a-zA-Z0-9*'!",
     1496                                paArgs[0].u.pszString);
    14491497
    14501498    while (RT_C_IS_ALNUM(*pszVar) || *pszVar == '_')
     
    14521500    if (*pszVar)
    14531501        return DBGCCmdHlpPrintf(pCmdHlp,
    1454             "syntax error: Invalid variable name '%s'. Variable names must match regex '[_a-zA-Z][_a-zA-Z0-9*]'!", paArgs[0].u.pszString);
     1502                                "syntax error: Invalid variable name '%s'. Variable names must match regex '[_a-zA-Z][_a-zA-Z0-9*]'!",
     1503                                paArgs[0].u.pszString);
    14551504
    14561505
  • trunk/src/VBox/Debugger/testcase/tstDBGCStubs.cpp

    r47569 r48696  
    130130    return NIL_RTDBGCFG;
    131131}
    132 VMMR3DECL(int) DBGFR3AsLoadImage(PUVM pUVM, RTDBGAS hAS, const char *pszFilename, const char *pszModName, PCDBGFADDRESS pModAddress, RTDBGSEGIDX iModSeg, uint32_t fFlags)
     132VMMR3DECL(int) DBGFR3AsLoadImage(PUVM pUVM, RTDBGAS hAS, const char *pszFilename, const char *pszModName, RTLDRARCH enmArch,
     133                                 PCDBGFADDRESS pModAddress, RTDBGSEGIDX iModSeg, uint32_t fFlags)
    133134{
    134135    return VERR_INTERNAL_ERROR;
    135136}
    136137VMMR3DECL(int) DBGFR3AsLoadMap(PUVM pUVM, RTDBGAS hAS, const char *pszFilename, const char *pszModName, PCDBGFADDRESS pModAddress, RTDBGSEGIDX iModSeg, RTGCUINTPTR uSubtrahend, uint32_t fFlags)
     138{
     139    return VERR_INTERNAL_ERROR;
     140}
     141VMMR3DECL(int) DBGFR3AsUnlinkModuleByName(PUVM pUVM, RTDBGAS hDbgAs, const char *pszModName)
    137142{
    138143    return VERR_INTERNAL_ERROR;
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