VirtualBox

Ignore:
Timestamp:
May 25, 2013 7:51:19 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
86000
Message:

IPRT: Changed RTLDRSEG::pchName to pszName and make sure it's always set to something. Started on implementing a codeview reader.

Location:
trunk/src/VBox/Runtime/common/dbg
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/dbg/dbgmod.cpp

    r46199 r46266  
    280280        if (RT_SUCCESS(rc))
    281281            rc = rtDbgModDebugInterpreterRegister(&g_rtDbgModVtDbgDwarf);
     282#if 0 /* NOTE!! EXPERIMENTAL, SHOULDN'T BE ENABLED IN SVN YET!! */
     283        if (RT_SUCCESS(rc))
     284            rc = rtDbgModDebugInterpreterRegister(&g_rtDbgModVtDbgCodeView);
     285#endif
    282286#ifdef RT_OS_WINDOWS
    283287        if (RT_SUCCESS(rc))
  • trunk/src/VBox/Runtime/common/dbg/dbgmoddbghelp.cpp

    r46164 r46266  
    366366
    367367    Log(("Segment %.*s: LinkAddress=%#llx RVA=%#llx cb=%#llx\n",
    368          pSeg->cchName, pSeg->pchName, (uint64_t)pSeg->LinkAddress, (uint64_t)pSeg->RVA, pSeg->cb));
     368         pSeg->cchName, pSeg->pszName, (uint64_t)pSeg->LinkAddress, (uint64_t)pSeg->RVA, pSeg->cb));
     369
     370    Assert(pSeg->cchName > 0);
     371    Assert(!pSeg->pszName[pSeg->cchName]);
    369372
    370373    if (!pSeg->RVA)
    371374        pArgs->uModAddr = pSeg->LinkAddress;
    372375
    373     NOREF(hLdrMod);
    374     char *pszName = (char *)pSeg->pchName;
    375     if (pszName[pSeg->cchName])
    376     {
    377         pszName = (char *)alloca(pSeg->cchName + 1);
    378         memcpy(pszName, pSeg->pchName, pSeg->cchName);
    379         pszName[pSeg->cchName] = '\0';
    380     }
    381 
    382376    RTLDRADDR cb = RT_MAX(pSeg->cb, pSeg->cbMapped);
    383     return RTDbgModSegmentAdd(pArgs->hCnt, pSeg->RVA, cb, pszName, 0 /*fFlags*/, NULL);
     377    return RTDbgModSegmentAdd(pArgs->hCnt, pSeg->RVA, cb, pSeg->pszName, 0 /*fFlags*/, NULL);
    384378}
    385379
  • trunk/src/VBox/Runtime/common/dbg/dbgmoddeferred.cpp

    r46164 r46266  
    467467
    468468
     469/** @interface_method_impl{RTDBGMODVTIMG,pfnReadAt} */
     470static DECLCALLBACK(int) rtDbgModDeferredImg_ReadAt(PRTDBGMODINT pMod, uint32_t iDbgInfoHint, RTFOFF off, void *pvBuf, size_t cb)
     471{
     472    int rc = rtDbgModDeferredDoIt(pMod, false /*fForceRetry*/);
     473    if (RT_SUCCESS(rc))
     474        rc = pMod->pImgVt->pfnReadAt(pMod, iDbgInfoHint, off, pvBuf, cb);
     475    return rc;
     476}
     477
     478
    469479/** @interface_method_impl{RTDBGMODVTIMG,pfnUnmapPart} */
    470480static DECLCALLBACK(int) rtDbgModDeferredImg_UnmapPart(PRTDBGMODINT pMod, size_t cb, void const **ppvMap)
     
    580590    /*.pfnMapPart = */                  rtDbgModDeferredImg_MapPart,
    581591    /*.pfnUnmapPart = */                rtDbgModDeferredImg_UnmapPart,
     592    /*.pfnReadAt = */                   rtDbgModDeferredImg_ReadAt,
    582593    /*.pfnGetFormat = */                rtDbgModDeferredImg_GetFormat,
    583594    /*.pfnGetArch = */                  rtDbgModDeferredImg_GetArch,
  • trunk/src/VBox/Runtime/common/dbg/dbgmoddwarf.cpp

    r46261 r46266  
    11771177    PRTDBGMODDWARF pThis = (PRTDBGMODDWARF)pvUser;
    11781178    Log(("Segment %.*s: LinkAddress=%#llx RVA=%#llx cb=%#llx\n",
    1179          pSeg->cchName, pSeg->pchName, (uint64_t)pSeg->LinkAddress, (uint64_t)pSeg->RVA, pSeg->cb));
     1179         pSeg->cchName, pSeg->pszName, (uint64_t)pSeg->LinkAddress, (uint64_t)pSeg->RVA, pSeg->cb));
    11801180    NOREF(hLdrMod);
    11811181
     
    11931193    PRTDBGMODDWARF pThis = (PRTDBGMODDWARF)pvUser;
    11941194    Log(("Segment %.*s: LinkAddress=%#llx RVA=%#llx cb=%#llx\n",
    1195          pSeg->cchName, pSeg->pchName, (uint64_t)pSeg->LinkAddress, (uint64_t)pSeg->RVA, pSeg->cb));
     1195         pSeg->cchName, pSeg->pszName, (uint64_t)pSeg->LinkAddress, (uint64_t)pSeg->RVA, pSeg->cb));
    11961196    NOREF(hLdrMod);
    1197     AssertReturn(!pSeg->pchName[pSeg->cchName], VERR_DWARF_IPE);
     1197    Assert(pSeg->cchName > 0);
     1198    Assert(!pSeg->pszName[pSeg->cchName]);
    11981199
    11991200    /* If the segment doesn't have a mapping, just add a dummy so the indexing
    12001201       works out correctly (same as for the image). */
    12011202    if (pSeg->RVA == NIL_RTLDRADDR)
    1202         return RTDbgModSegmentAdd(pThis->hCnt, 0, 0, pSeg->pchName, 0 /*fFlags*/, NULL);
     1203        return RTDbgModSegmentAdd(pThis->hCnt, 0, 0, pSeg->pszName, 0 /*fFlags*/, NULL);
    12031204
    12041205    /* The link address is 0 for all segments in a relocatable ELF image. */
    12051206    RTLDRADDR cb = RT_MAX(pSeg->cb, pSeg->cbMapped);
    1206     return RTDbgModSegmentAdd(pThis->hCnt, pSeg->RVA, cb, pSeg->pchName, 0 /*fFlags*/, NULL);
     1207    return RTDbgModSegmentAdd(pThis->hCnt, pSeg->RVA, cb, pSeg->pszName, 0 /*fFlags*/, NULL);
    12071208}
    12081209
  • trunk/src/VBox/Runtime/common/dbg/dbgmodexports.cpp

    r46199 r46266  
    7979    PRTDBGMODEXPORTARGS pArgs = (PRTDBGMODEXPORTARGS)pvUser;
    8080    Log(("Segment %.*s: LinkAddress=%#llx RVA=%#llx cb=%#llx\n",
    81          pSeg->cchName, pSeg->pchName, (uint64_t)pSeg->LinkAddress, (uint64_t)pSeg->RVA, pSeg->cb));
     81         pSeg->cchName, pSeg->pszName, (uint64_t)pSeg->LinkAddress, (uint64_t)pSeg->RVA, pSeg->cb));
    8282    NOREF(hLdrMod);
    8383
     
    8888        pArgs->uImageBase = pSeg->LinkAddress;
    8989
    90     /* Make sure the name is terminated before we add it. */
    91     char *pszName = (char *)pSeg->pchName;
    92     if (pszName[pSeg->cchName])
    93     {
    94         pszName = (char *)alloca(pSeg->cchName + 1);
    95         memcpy(pszName, pSeg->pchName, pSeg->cchName);
    96         pszName[pSeg->cchName] = '\0';
    97     }
    98 
    9990    /* Add dummy segments for segments that doesn't get mapped. */
    10091    if (pSeg->LinkAddress == NIL_RTLDRADDR)
    101         return RTDbgModSegmentAdd(pArgs->pDbgMod, 0, 0, pszName, 0 /*fFlags*/, NULL);
     92        return RTDbgModSegmentAdd(pArgs->pDbgMod, 0, 0, pSeg->pszName, 0 /*fFlags*/, NULL);
    10293
    10394    RTLDRADDR cb = RT_MAX(pSeg->cb, pSeg->cbMapped);
    104     return RTDbgModSegmentAdd(pArgs->pDbgMod, pSeg->RVA, cb, pszName, 0 /*fFlags*/, NULL);
     95    return RTDbgModSegmentAdd(pArgs->pDbgMod, pSeg->RVA, cb, pSeg->pszName, 0 /*fFlags*/, NULL);
    10596}
    10697
  • trunk/src/VBox/Runtime/common/dbg/dbgmodldr.cpp

    r46164 r46266  
    7474    PRTDBGMODLDR pThis = (PRTDBGMODLDR)pMod->pvImgPriv;
    7575    return RTLdrGetFormat(pThis->hLdrMod);
     76}
     77
     78
     79/** @interface_method_impl{RTDBGMODVTIMG,pfnReadAt} */
     80static DECLCALLBACK(int) rtDbgModLdr_ReadAt(PRTDBGMODINT pMod, uint32_t iDbgInfoHint, RTFOFF off, void *pvBuf, size_t cb)
     81{
     82    PRTDBGMODLDR pThis = (PRTDBGMODLDR)pMod->pvImgPriv;
     83    return rtLdrReadAt(pThis->hLdrMod, pvBuf, UINT32_MAX /** @todo iDbgInfo*/, off, cb);
    7684}
    7785
     
    205213    /*.pfnMapPart = */                  rtDbgModLdr_MapPart,
    206214    /*.pfnUnmapPart = */                rtDbgModLdr_UnmapPart,
     215    /*.pfnReadAt = */                   rtDbgModLdr_ReadAt,
    207216    /*.pfnGetFormat = */                rtDbgModLdr_GetFormat,
    208217    /*.pfnGetArch = */                  rtDbgModLdr_GetArch,
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