Changeset 61572 in vbox for trunk/src/VBox
- Timestamp:
- Jun 8, 2016 12:03:35 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Debugger/DBGPlugInLinux.cpp
r61558 r61572 1411 1411 } 1412 1412 1413 1414 /** 1415 * @copydoc DBGFOSREG::pfnInit 1416 */ 1417 static DECLCALLBACK(int) dbgDiggerLinuxInit(PUVM pUVM, void *pvData) 1418 { 1419 PDBGDIGGERLINUX pThis = (PDBGDIGGERLINUX)pvData; 1420 Assert(!pThis->fValid); 1421 1422 /* 1423 * Assume 64-bit kernels all live way beyond 32-bit address space. 1424 */ 1425 pThis->f64Bit = pThis->AddrLinuxBanner.FlatPtr > UINT32_MAX; 1413 /** 1414 * Tries to find and load the kernel symbol table with the given needle. 1415 * 1416 * @returns VBox status code. 1417 * @param pThis The Linux digger data. 1418 * @param pUVM The user mode VM handle. 1419 * @param pabNeedle The needle to use for searching. 1420 * @param cbNeedle Size of the needle in bytes. 1421 */ 1422 static int dbgDiggerLinuxFindSymbolTableFromNeedle(PDBGDIGGERLINUX pThis, PUVM pUVM, uint8_t const *pabNeedle, size_t cbNeedle) 1423 { 1424 int rc = VINF_SUCCESS; 1426 1425 1427 1426 /* … … 1433 1432 while (cbLeft > 4096) 1434 1433 { 1435 static const uint8_t s_abNeedle[] = "kobj";1436 1434 DBGFADDRESS HitAddr; 1437 intrc = DBGFR3MemScan(pUVM, 0 /*idCpu*/, &CurAddr, cbLeft, 1 /*uAlign*/,1438 s_abNeedle, sizeof(s_abNeedle) - 1, &HitAddr);1435 rc = DBGFR3MemScan(pUVM, 0 /*idCpu*/, &CurAddr, cbLeft, 1 /*uAlign*/, 1436 pabNeedle, cbNeedle, &HitAddr); 1439 1437 if (RT_FAILURE(rc)) 1440 1438 break; 1441 if (dbgDiggerLinuxIsLikelyNameFragment(pUVM, &HitAddr, s_abNeedle, sizeof(s_abNeedle) - 1))1439 if (dbgDiggerLinuxIsLikelyNameFragment(pUVM, &HitAddr, pabNeedle, cbNeedle)) 1442 1440 { 1443 1441 /* There will be another hit near by. */ 1444 1442 DBGFR3AddrAdd(&HitAddr, 1); 1445 1443 rc = DBGFR3MemScan(pUVM, 0 /*idCpu*/, &HitAddr, LNX_MAX_KALLSYMS_NAMES_SIZE, 1 /*uAlign*/, 1446 s_abNeedle, sizeof(s_abNeedle) - 1, &HitAddr);1444 pabNeedle, cbNeedle, &HitAddr); 1447 1445 if ( RT_SUCCESS(rc) 1448 && dbgDiggerLinuxIsLikelyNameFragment(pUVM, &HitAddr, s_abNeedle, sizeof(s_abNeedle) - 1))1446 && dbgDiggerLinuxIsLikelyNameFragment(pUVM, &HitAddr, pabNeedle, cbNeedle)) 1449 1447 { 1450 1448 /* … … 1468 1466 * Advance. 1469 1467 */ 1470 RTGCUINTPTR cbDistance = HitAddr.FlatPtr - CurAddr.FlatPtr + sizeof(s_abNeedle) - 1;1468 RTGCUINTPTR cbDistance = HitAddr.FlatPtr - CurAddr.FlatPtr + cbNeedle; 1471 1469 if (RT_UNLIKELY(cbDistance >= cbLeft)) 1472 1470 { … … 1477 1475 DBGFR3AddrAdd(&CurAddr, cbDistance); 1478 1476 1477 } 1478 1479 return rc; 1480 } 1481 /** 1482 * @copydoc DBGFOSREG::pfnInit 1483 */ 1484 static DECLCALLBACK(int) dbgDiggerLinuxInit(PUVM pUVM, void *pvData) 1485 { 1486 PDBGDIGGERLINUX pThis = (PDBGDIGGERLINUX)pvData; 1487 Assert(!pThis->fValid); 1488 1489 /* 1490 * Assume 64-bit kernels all live way beyond 32-bit address space. 1491 */ 1492 pThis->f64Bit = pThis->AddrLinuxBanner.FlatPtr > UINT32_MAX; 1493 1494 static const uint8_t s_abNeedle[] = "kobj"; 1495 int rc = dbgDiggerLinuxFindSymbolTableFromNeedle(pThis, pUVM, s_abNeedle, sizeof(s_abNeedle) - 1); 1496 if (RT_FAILURE(rc)) 1497 { 1498 /* Try alternate needle (seen on older x86 Linux kernels). */ 1499 static const uint8_t s_abNeedleAlt[] = "kobjec"; 1500 dbgDiggerLinuxFindSymbolTableFromNeedle(pThis, pUVM, s_abNeedleAlt, sizeof(s_abNeedleAlt) - 1); 1479 1501 } 1480 1502
Note:
See TracChangeset
for help on using the changeset viewer.