- Timestamp:
- May 22, 2013 3:30:41 PM (12 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Debugger/DBGCEmulateCodeView.cpp
r46217 r46221 3897 3897 else 3898 3898 rc = DBGCCmdHlpPrintf(pCmdHlp, "%DV %s - %RGv", &AddrVar, Symbol.szName, -offDisp); 3899 if ( (RTGCINTPTR)Symbol.cb > -offDisp)3900 rc = DBGCCmdHlpPrintf(pCmdHlp, " LB %RGv\n", Symbol.cb + offDisp);3899 if (Symbol.cb > 0) 3900 rc = DBGCCmdHlpPrintf(pCmdHlp, " (LB %RGv)\n", Symbol.cb); 3901 3901 else 3902 3902 rc = DBGCCmdHlpPrintf(pCmdHlp, "\n"); -
trunk/src/VBox/Runtime/common/dbg/dbgas.cpp
r46165 r46221 1304 1304 1305 1305 /** 1306 * Creates a snapshot of the module table on the temporary heap. 1307 * 1308 * The caller must release all the module handles before freeing the table 1309 * using RTMemTmpFree. 1310 * 1311 * @returns Module table snaphot. 1312 * @param pDbgAs The address space instance data. 1313 * @param pcModules Where to return the number of modules. 1314 */ 1315 static PRTDBGMOD rtDbgAsSnapshotModuleTable(PRTDBGASINT pDbgAs, uint32_t *pcModules) 1316 { 1317 RTDBGAS_LOCK_READ(pDbgAs); 1318 1319 uint32_t iMod = *pcModules = pDbgAs->cModules; 1320 PRTDBGMOD pahModules = (PRTDBGMOD)RTMemTmpAlloc(sizeof(pahModules[0]) * RT_MAX(iMod, 1)); 1321 if (pahModules) 1322 { 1323 while (iMod-- > 0) 1324 { 1325 RTDBGMOD hMod = (RTDBGMOD)pDbgAs->papModules[iMod]->Core.Key; 1326 pahModules[iMod] = hMod; 1327 RTDbgModRetain(hMod); 1328 } 1329 } 1330 1331 RTDBGAS_UNLOCK_READ(pDbgAs); 1332 return pahModules; 1333 } 1334 1335 1336 /** 1306 1337 * Query a symbol by address. 1307 1338 * … … 1327 1358 PRTDBGASINT pDbgAs = hDbgAs; 1328 1359 RTDBGAS_VALID_RETURN_RC(pDbgAs, VERR_INVALID_HANDLE); 1360 if (phMod) 1361 *phMod = NIL_RTDBGMOD; 1329 1362 1330 1363 RTDBGSEGIDX iSeg = NIL_RTDBGSEGIDX; /* shut up gcc */ … … 1334 1367 if (hMod == NIL_RTDBGMOD) 1335 1368 { 1336 if (phMod) 1337 *phMod = NIL_RTDBGMOD; 1338 return VERR_NOT_FOUND; 1369 /* 1370 * Check for absolute symbols. Requires iterating all modules. 1371 */ 1372 uint32_t cModules; 1373 PRTDBGMOD pahModules = rtDbgAsSnapshotModuleTable(pDbgAs, &cModules); 1374 if (!pahModules) 1375 return VERR_NO_TMP_MEMORY; 1376 1377 int rc; 1378 RTINTPTR offBestDisp = RTINTPTR_MAX; 1379 uint32_t iBest = UINT32_MAX; 1380 for (uint32_t i = 0; i < cModules; i++) 1381 { 1382 RTINTPTR offDisp; 1383 rc = RTDbgModSymbolByAddr(pahModules[i], RTDBGSEGIDX_ABS, Addr, fFlags, &offDisp, pSymbol); 1384 if (RT_SUCCESS(rc) && RT_ABS(offDisp) < offBestDisp) 1385 { 1386 offBestDisp = RT_ABS(offDisp); 1387 iBest = i; 1388 } 1389 } 1390 1391 if (iBest == UINT32_MAX) 1392 rc = VERR_NOT_FOUND; 1393 else 1394 { 1395 rc = RTDbgModSymbolByAddr(pahModules[iBest], RTDBGSEGIDX_ABS, Addr, fFlags, poffDisp, pSymbol); 1396 if (RT_SUCCESS(rc)) 1397 { 1398 rtDbgAsAdjustSymbolValue(pSymbol, hMod, MapAddr, iSeg); 1399 if (phMod) 1400 RTDbgModRetain(*phMod = pahModules[iBest]); 1401 } 1402 } 1403 1404 for (uint32_t i = 0; i < cModules; i++) 1405 RTDbgModRelease(pahModules[i]); 1406 RTMemTmpFree(pahModules); 1407 return rc; 1339 1408 } 1340 1409 … … 1404 1473 } 1405 1474 RT_EXPORT_SYMBOL(RTDbgAsSymbolByAddrA); 1406 1407 1408 /**1409 * Creates a snapshot of the module table on the temporary heap.1410 *1411 * The caller must release all the module handles before freeing the table1412 * using RTMemTmpFree.1413 *1414 * @returns Module table snaphot.1415 * @param pDbgAs The address space instance data.1416 * @param pcModules Where to return the number of modules.1417 */1418 DECLINLINE(PRTDBGMOD) rtDbgAsSnapshotModuleTable(PRTDBGASINT pDbgAs, uint32_t *pcModules)1419 {1420 RTDBGAS_LOCK_READ(pDbgAs);1421 1422 uint32_t iMod = *pcModules = pDbgAs->cModules;1423 PRTDBGMOD pahModules = (PRTDBGMOD)RTMemTmpAlloc(sizeof(pahModules[0]) * RT_MAX(iMod, 1));1424 if (pahModules)1425 {1426 while (iMod-- > 0)1427 {1428 RTDBGMOD hMod = (RTDBGMOD)pDbgAs->papModules[iMod]->Core.Key;1429 pahModules[iMod] = hMod;1430 RTDbgModRetain(hMod);1431 }1432 }1433 1434 RTDBGAS_UNLOCK_READ(pDbgAs);1435 return pahModules;1436 }1437 1475 1438 1476
Note:
See TracChangeset
for help on using the changeset viewer.