Changeset 21110 in vbox
- Timestamp:
- Jul 1, 2009 1:02:58 AM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 49373
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/dbg.h
r20801 r21110 473 473 * and address. Optional. 474 474 * @param pSymInfo Where to return the symbol info. 475 */ 476 RTDECL(int) RTDbgAsSymbolByAddr(RTDBGAS hDbgAs, RTUINTPTR Addr, PRTINTPTR poffDisp, PRTDBGSYMBOL pSymInfo); 475 * @param phMod Where to return the module handle. Optional. 476 */ 477 RTDECL(int) RTDbgAsSymbolByAddr(RTDBGAS hDbgAs, RTUINTPTR Addr, PRTINTPTR poffDisp, PRTDBGSYMBOL pSymInfo, PRTDBGMOD phMod); 477 478 478 479 /** … … 489 490 * @param ppSymInfo Where to return the pointer to the allocated symbol 490 491 * info. Always set. Free with RTDbgSymbolFree. 491 */ 492 RTDECL(int) RTDbgAsSymbolByAddrA(RTDBGAS hDbgAs, RTUINTPTR Addr, PRTINTPTR poffDisp, PRTDBGSYMBOL *ppSymInfo); 492 * @param phMod Where to return the module handle. Optional. 493 */ 494 RTDECL(int) RTDbgAsSymbolByAddrA(RTDBGAS hDbgAs, RTUINTPTR Addr, PRTINTPTR poffDisp, PRTDBGSYMBOL *ppSymInfo, PRTDBGMOD phMod); 493 495 494 496 /** … … 499 501 * 500 502 * @param hDbgAs The address space handle. 501 * @param pszSymbol The symbol name. 502 * @param pSymInfo Where to return the symbol info. 503 */ 504 RTDECL(int) RTDbgAsSymbolByName(RTDBGAS hDbgAs, const char *pszSymbol, PRTDBGSYMBOL pSymInfo); 505 506 /** 507 * Query a symbol by name. 503 * @param pszSymbol The symbol name. It is possible to limit the scope 504 * of the search by prefixing the symbol with a module 505 * name pattern followed by a bang (!) character. 506 * RTStrSimplePatternNMatch is used for the matching. 507 * @param pSymbol Where to return the symbol info. 508 * @param phMod Where to return the module handle. Optional. 509 */ 510 RTDECL(int) RTDbgAsSymbolByName(RTDBGAS hDbgAs, const char *pszSymbol, PRTDBGSYMBOL pSymbol, PRTDBGMOD phMod); 511 512 /** 513 * Query a symbol by name, allocating the returned symbol structure. 508 514 * 509 515 * @returns IPRT status code. … … 511 517 * 512 518 * @param hDbgAs The address space handle. 513 * @param pszSymbol The symbol name. 514 * @param ppSymInfo Where to return the pointer to the allocated symbol 515 * info. Always set. Free with RTDbgSymbolFree. 516 */ 517 RTDECL(int) RTDbgAsSymbolByNameA(RTDBGAS hDbgAs, const char *pszSymbol, PRTDBGSYMBOL *ppSymInfo); 519 * @param pszSymbol The symbol name. See RTDbgAsSymbolByName for more. 520 * @param ppSymbol Where to return the pointer to the allocated 521 * symbol info. Always set. Free with RTDbgSymbolFree. 522 * @param phMod Where to return the module handle. Optional. 523 */ 524 RTDECL(int) RTDbgAsSymbolByNameA(RTDBGAS hDbgAs, const char *pszSymbol, PRTDBGSYMBOL *ppSymbol, PRTDBGMOD phMod); 518 525 519 526 /** -
trunk/src/VBox/Runtime/common/dbg/dbgas.cpp
r20744 r21110 1183 1183 * and address. Optional. 1184 1184 * @param pSymbol Where to return the symbol info. 1185 */ 1186 RTDECL(int) RTDbgAsSymbolByAddr(RTDBGAS hDbgAs, RTUINTPTR Addr, PRTINTPTR poffDisp, PRTDBGSYMBOL pSymbol) 1185 * @param phMod Where to return the module handle. Optional. 1186 */ 1187 RTDECL(int) RTDbgAsSymbolByAddr(RTDBGAS hDbgAs, RTUINTPTR Addr, PRTINTPTR poffDisp, PRTDBGSYMBOL pSymbol, PRTDBGMOD phMod) 1187 1188 { 1188 1189 /* … … 1197 1198 RTDBGMOD hMod = rtDbgAsModuleByAddr(pDbgAs, Addr, &iSeg, &offSeg, &MapAddr); 1198 1199 if (hMod == NIL_RTDBGMOD) 1200 { 1201 if (phMod) 1202 *phMod = NIL_RTDBGMOD; 1199 1203 return VERR_NOT_FOUND; 1204 } 1200 1205 1201 1206 /* … … 1205 1210 if (RT_SUCCESS(rc)) 1206 1211 rtDbgAsAdjustSymbolValue(pSymbol, hMod, MapAddr, iSeg); 1207 RTDbgModRelease(hMod); 1212 if (phMod) 1213 *phMod = hMod; 1214 else 1215 RTDbgModRelease(hMod); 1208 1216 return rc; 1209 1217 } … … 1223 1231 * @param ppSymbol Where to return the pointer to the allocated 1224 1232 * symbol info. Always set. Free with RTDbgSymbolFree. 1225 */ 1226 RTDECL(int) RTDbgAsSymbolByAddrA(RTDBGAS hDbgAs, RTUINTPTR Addr, PRTINTPTR poffDisp, PRTDBGSYMBOL *ppSymbol) 1233 * @param phMod Where to return the module handle. Optional. 1234 */ 1235 RTDECL(int) RTDbgAsSymbolByAddrA(RTDBGAS hDbgAs, RTUINTPTR Addr, PRTINTPTR poffDisp, PRTDBGSYMBOL *ppSymbol, PRTDBGMOD phMod) 1227 1236 { 1228 1237 /* … … 1237 1246 RTDBGMOD hMod = rtDbgAsModuleByAddr(pDbgAs, Addr, &iSeg, &offSeg, &MapAddr); 1238 1247 if (hMod == NIL_RTDBGMOD) 1248 { 1249 if (phMod) 1250 *phMod = NIL_RTDBGMOD; 1239 1251 return VERR_NOT_FOUND; 1252 } 1240 1253 1241 1254 /* … … 1245 1258 if (RT_SUCCESS(rc)) 1246 1259 rtDbgAsAdjustSymbolValue(*ppSymbol, hMod, MapAddr, iSeg); 1247 RTDbgModRelease(hMod); 1260 if (phMod) 1261 *phMod = hMod; 1262 else 1263 RTDbgModRelease(hMod); 1248 1264 return rc; 1249 1265 } … … 1270 1286 while (iMod-- > 0) 1271 1287 { 1272 RTDBGMOD hMod = paModules[iMod];1288 RTDBGMOD hMod = (RTDBGMOD)pDbgAs->paModules[iMod].Core.Key; 1273 1289 paModules[iMod] = hMod; 1274 1290 RTDbgModRetain(hMod); … … 1355 1371 * 1356 1372 * @param hDbgAs The address space handle. 1357 * @param pszSymbol The symbol name. 1373 * @param pszSymbol The symbol name. It is possible to limit the scope 1374 * of the search by prefixing the symbol with a module 1375 * name pattern followed by a bang (!) character. 1376 * RTStrSimplePatternNMatch is used for the matching. 1358 1377 * @param pSymbol Where to return the symbol info. 1359 */ 1360 RTDECL(int) RTDbgAsSymbolByName(RTDBGAS hDbgAs, const char *pszSymbol, PRTDBGSYMBOL pSymbol) 1378 * @param phMod Where to return the module handle. Optional. 1379 */ 1380 RTDECL(int) RTDbgAsSymbolByName(RTDBGAS hDbgAs, const char *pszSymbol, PRTDBGSYMBOL pSymbol, PRTDBGMOD phMod) 1361 1381 { 1362 1382 /* … … 1367 1387 AssertPtrReturn(pszSymbol, VERR_INVALID_POINTER); 1368 1388 AssertPtrReturn(pSymbol, VERR_INVALID_POINTER); 1389 1390 /* 1391 * Look for module pattern. 1392 */ 1393 const char *pachModPat = NULL; 1394 size_t cchModPat = 0; 1395 const char *pszBang = strchr(pszSymbol, '!'); 1396 if (pszBang) 1397 { 1398 pachModPat = pszSymbol; 1399 cchModPat = pszBang - pszSymbol; 1400 pszSymbol = pszBang + 1; 1401 if (!*pszSymbol) 1402 return VERR_DBG_SYMBOL_NAME_OUT_OF_RANGE; 1403 /* Note! Zero length module -> no pattern -> escape for symbol with '!'. */ 1404 } 1369 1405 1370 1406 /* … … 1378 1414 for (uint32_t i = 0; i < cModules; i++) 1379 1415 { 1380 i nt rc = RTDbgModSymbolByName(paModules[i], pszSymbol, pSymbol);1381 if (RT_SUCCESS(rc))1416 if ( cchModPat == 0 1417 || RTStrSimplePatternNMatch(pachModPat, cchModPat, RTDbgModName(paModules[i]), RTSTR_MAX)) 1382 1418 { 1383 if (rtDbgAsFindMappingAndAdjustSymbolValue(pDbgAs, paModules[i], pSymbol)) 1419 int rc = RTDbgModSymbolByName(paModules[i], pszSymbol, pSymbol); 1420 if (RT_SUCCESS(rc)) 1384 1421 { 1385 for (; i < cModules; i++) 1386 RTDbgModRelease(paModules[i]); 1387 RTMemTmpFree(paModules); 1388 return rc; 1422 if (rtDbgAsFindMappingAndAdjustSymbolValue(pDbgAs, paModules[i], pSymbol)) 1423 { 1424 if (phMod) 1425 RTDbgModRetain(*phMod = paModules[i]); 1426 for (; i < cModules; i++) 1427 RTDbgModRelease(paModules[i]); 1428 RTMemTmpFree(paModules); 1429 return rc; 1430 } 1389 1431 } 1390 1432 } … … 1398 1440 1399 1441 /** 1400 * Query a symbol by name .1442 * Query a symbol by name, allocating the returned symbol structure. 1401 1443 * 1402 1444 * @returns IPRT status code. … … 1404 1446 * 1405 1447 * @param hDbgAs The address space handle. 1406 * @param pszSymbol The symbol name. 1448 * @param pszSymbol The symbol name. See RTDbgAsSymbolByName for more. 1407 1449 * @param ppSymbol Where to return the pointer to the allocated 1408 1450 * symbol info. Always set. Free with RTDbgSymbolFree. 1409 */ 1410 RTDECL(int) RTDbgAsSymbolByNameA(RTDBGAS hDbgAs, const char *pszSymbol, PRTDBGSYMBOL *ppSymbol) 1451 * @param phMod Where to return the module handle. Optional. 1452 */ 1453 RTDECL(int) RTDbgAsSymbolByNameA(RTDBGAS hDbgAs, const char *pszSymbol, PRTDBGSYMBOL *ppSymbol, PRTDBGMOD phMod) 1411 1454 { 1412 1455 /* … … 1418 1461 RTDBGAS_VALID_RETURN_RC(pDbgAs, VERR_INVALID_HANDLE); 1419 1462 AssertPtrReturn(pszSymbol, VERR_INVALID_POINTER); 1463 1464 /* 1465 * Look for module pattern. 1466 */ 1467 const char *pachModPat = NULL; 1468 size_t cchModPat = 0; 1469 const char *pszBang = strchr(pszSymbol, '!'); 1470 if (pszBang) 1471 { 1472 pachModPat = pszSymbol; 1473 cchModPat = pszBang - pszSymbol; 1474 pszSymbol = pszBang + 1; 1475 if (!*pszSymbol) 1476 return VERR_DBG_SYMBOL_NAME_OUT_OF_RANGE; 1477 /* Note! Zero length module -> no pattern -> escape for symbol with '!'. */ 1478 } 1420 1479 1421 1480 /* … … 1429 1488 for (uint32_t i = 0; i < cModules; i++) 1430 1489 { 1431 i nt rc = RTDbgModSymbolByNameA(paModules[i], pszSymbol, ppSymbol);1432 if (RT_SUCCESS(rc))1490 if ( cchModPat == 0 1491 || RTStrSimplePatternNMatch(pachModPat, cchModPat, RTDbgModName(paModules[i]), RTSTR_MAX)) 1433 1492 { 1434 if (rtDbgAsFindMappingAndAdjustSymbolValue(pDbgAs, paModules[i], *ppSymbol)) 1493 int rc = RTDbgModSymbolByNameA(paModules[i], pszSymbol, ppSymbol); 1494 if (RT_SUCCESS(rc)) 1435 1495 { 1436 for (; i < cModules; i++) 1437 RTDbgModRelease(paModules[i]); 1438 RTMemTmpFree(paModules); 1439 return rc; 1496 if (rtDbgAsFindMappingAndAdjustSymbolValue(pDbgAs, paModules[i], *ppSymbol)) 1497 { 1498 if (phMod) 1499 RTDbgModRetain(*phMod = paModules[i]); 1500 for (; i < cModules; i++) 1501 RTDbgModRelease(paModules[i]); 1502 RTMemTmpFree(paModules); 1503 return rc; 1504 } 1440 1505 } 1441 1442 RTDbgSymbolFree(*ppSymbol);1443 *ppSymbol = NULL;1444 1506 } 1445 1507 RTDbgModRelease(paModules[i]); -
trunk/src/VBox/Runtime/common/dbg/dbgmodcontainer.cpp
r21046 r21110 176 176 ("iSeg=%#x cSegs=%#x\n", pThis->cSegs), 177 177 VERR_DBG_INVALID_SEGMENT_INDEX); 178 AssertMsgReturn( pThis->paSegs[iSeg].cb < off,178 AssertMsgReturn(off < pThis->paSegs[iSeg].cb, 179 179 ("off=%RTptr cbSeg=%RTptr\n", off, pThis->paSegs[iSeg].cb), 180 180 VERR_DBG_INVALID_SEGMENT_OFFSET); … … 303 303 VERR_DBG_INVALID_SEGMENT_INDEX); 304 304 AssertMsgReturn( iSeg >= RTDBGSEGIDX_SPECIAL_FIRST 305 || pThis->paSegs[iSeg].cb <= off,305 || off <= pThis->paSegs[iSeg].cb, 306 306 ("off=%RTptr cbSeg=%RTptr\n", off, pThis->paSegs[iSeg].cb), 307 307 VERR_DBG_INVALID_SEGMENT_OFFSET); … … 541 541 PRTDBGMODCTN pThis = (PRTDBGMODCTN)pMod->pvDbgPriv; 542 542 PCRTDBGMODCTNSEGMENT paSeg = pThis->paSegs; 543 uint32_t const 543 uint32_t const cSegs = pThis->cSegs; 544 544 if (cSegs <= 7) 545 545 {
Note:
See TracChangeset
for help on using the changeset viewer.