Changeset 88956 in vbox
- Timestamp:
- May 9, 2021 1:09:47 PM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 144292
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/build/VBoxDD.d
r88944 r88956 18 18 provider vboxdd 19 19 { 20 probe hgcmcall__enter(void *pvCmd, u nsigned int idFunction, unsigned int idClient, unsigned int cbCmd);20 probe hgcmcall__enter(void *pvCmd, uint32_t idFunction, uint32_t idClient, uint32_t cbCmd); 21 21 probe hgcmcall__completed__req(void *pvCmd, int rc); 22 22 probe hgcmcall__completed__emt(void *pvCmd, int rc); 23 probe hgcmcall__completed__done(void *pvCmd, u nsigned int idFunction, unsigned int idClient, int rc);23 probe hgcmcall__completed__done(void *pvCmd, uint32_t idFunction, uint32_t idClient, int rc); 24 24 25 25 probe ahci__req__submit(void *pvReq, int iTxDir, uint64_t offStart, uint64_t cbXfer); -
trunk/src/bldprogs/VBoxTpG.cpp
r82968 r88956 45 45 * Structures and Typedefs * 46 46 *********************************************************************************************************************************/ 47 typedef struct VTGPROBE *PVTGPROBE; 47 48 48 49 typedef struct VTGATTRS … … 69 70 /** The type flags. */ 70 71 uint32_t fType; 72 /** The argument number (0-based) for complaining/whatever. */ 73 uint16_t iArgNo; 74 /** The probe the argument belongs to (for complaining/whatever). */ 75 PVTGPROBE pProbe; 76 /** The absolute source position. */ 77 size_t offSrc; 71 78 } VTGARG; 72 79 typedef VTGARG *PVTGARG; … … 82 89 uint32_t offArgList; 83 90 uint32_t iProbe; 91 size_t iLine; 84 92 } VTGPROBE; 85 typedef VTGPROBE *PVTGPROBE;86 93 87 94 typedef struct VTGPROVIDER … … 1294 1301 * 1295 1302 * @returns RTEXITCODE_FAILURE. 1296 * @param pStrm The stream. 1297 * @param cb The offset from the current position to the 1298 * point of failure. 1299 * @param pszMsg The message to display. 1300 */ 1301 static RTEXITCODE parseError(PSCMSTREAM pStrm, size_t cb, const char *pszMsg) 1302 { 1303 if (cb) 1304 ScmStreamSeekRelative(pStrm, -(ssize_t)cb); 1303 * @param pStrm The stream. 1304 * @param fAbs Absolute or relative offset. 1305 * @param offSeek When @a fAbs is @c false, the offset from the current 1306 * position to the point of failure. When @a fAbs is @c 1307 * true, it's the absolute position. 1308 * @param pszFormat The message format string. 1309 * @param va Format arguments. 1310 */ 1311 static RTEXITCODE parseErrorExV(PSCMSTREAM pStrm, bool fAbs, size_t offSeek, const char *pszFormat, va_list va) 1312 { 1313 if (fAbs) 1314 ScmStreamSeekAbsolute(pStrm, offSeek); 1315 else if (offSeek != 0) 1316 ScmStreamSeekRelative(pStrm, -(ssize_t)offSeek); 1305 1317 size_t const off = ScmStreamTell(pStrm); 1306 1318 size_t const iLine = ScmStreamTellLine(pStrm); … … 1308 1320 size_t const offLine = ScmStreamTell(pStrm); 1309 1321 1310 RTPrintf("%s:%d:%zd: error: %s.\n", g_pszScript, iLine + 1, off - offLine + 1, pszMsg); 1322 va_list va2; 1323 va_copy(va2, va); 1324 RTPrintf("%s:%d:%zd: error: %N.\n", g_pszScript, iLine + 1, off - offLine + 1, pszFormat, &va2); 1325 va_end(va2); 1311 1326 1312 1327 size_t cchLine; … … 1325 1340 * 1326 1341 * @returns RTEXITCODE_FAILURE. 1327 * @param pStrm The stream. 1328 * @param cb The offset from the current position to the 1329 * point of failure. 1330 * @param pszMsg The message to display. 1331 */ 1332 static RTEXITCODE parseErrorAbs(PSCMSTREAM pStrm, size_t off, const char *pszMsg) 1333 { 1334 ScmStreamSeekAbsolute(pStrm, off); 1335 return parseError(pStrm, 0, pszMsg); 1342 * @param pStrm The stream. 1343 * @param off The offset from the current position to the point of 1344 * failure. 1345 * @param pszFormat The message format string. 1346 * @param ... Format arguments. 1347 */ 1348 static RTEXITCODE parseError(PSCMSTREAM pStrm, size_t off, const char *pszFormat, ...) 1349 { 1350 va_list va; 1351 va_start(va, pszFormat); 1352 RTEXITCODE rcExit = parseErrorExV(pStrm, false, off, pszFormat, va); 1353 va_end(va); 1354 return rcExit; 1355 } 1356 1357 1358 /** 1359 * Parser error with line and position, absolute version. 1360 * 1361 * @returns RTEXITCODE_FAILURE. 1362 * @param pStrm The stream. 1363 * @param off The offset from the current position to the point of 1364 * failure. 1365 * @param pszFormat The message format string. 1366 * @param ... Format arguments. 1367 */ 1368 static RTEXITCODE parseErrorAbs(PSCMSTREAM pStrm, size_t off, const char *pszFormat, ...) 1369 { 1370 va_list va; 1371 va_start(va, pszFormat); 1372 RTEXITCODE rcExit = parseErrorExV(pStrm, true /*fAbs*/, off, pszFormat, va); 1373 va_end(va); 1374 return rcExit; 1375 } 1376 1377 1378 /** 1379 * Parser warning with line and position. 1380 * 1381 * @param pStrm The stream. 1382 * @param fAbs Absolute or relative offset. 1383 * @param offSeek When @a fAbs is @c false, the offset from the current 1384 * position to the point of failure. When @a fAbs is @c 1385 * true, it's the absolute position. 1386 * @param pszFormat The message format string. 1387 * @param va Format arguments. 1388 */ 1389 static void parseWarnExV(PSCMSTREAM pStrm, bool fAbs, size_t offSeek, const char *pszFormat, va_list va) 1390 { 1391 /* Save the stream position. */ 1392 size_t const offOrg = ScmStreamTell(pStrm); 1393 1394 if (fAbs) 1395 ScmStreamSeekAbsolute(pStrm, offSeek); 1396 else if (offSeek != 0) 1397 ScmStreamSeekRelative(pStrm, -(ssize_t)offSeek); 1398 size_t const off = ScmStreamTell(pStrm); 1399 size_t const iLine = ScmStreamTellLine(pStrm); 1400 ScmStreamSeekByLine(pStrm, iLine); 1401 size_t const offLine = ScmStreamTell(pStrm); 1402 1403 va_list va2; 1404 va_copy(va2, va); 1405 RTPrintf("%s:%d:%zd: warning: %N.\n", g_pszScript, iLine + 1, off - offLine + 1, pszFormat, &va2); 1406 va_end(va2); 1407 1408 size_t cchLine; 1409 SCMEOL enmEof; 1410 const char *pszLine = ScmStreamGetLineByNo(pStrm, iLine, &cchLine, &enmEof); 1411 if (pszLine) 1412 RTPrintf(" %.*s\n" 1413 " %*s^\n", 1414 cchLine, pszLine, off - offLine, ""); 1415 1416 /* restore the position. */ 1417 int rc = ScmStreamSeekAbsolute(pStrm, offOrg); 1418 AssertRC(rc); 1419 } 1420 1421 #if 0 /* unused */ 1422 /** 1423 * Parser warning with line and position. 1424 * 1425 * @param pStrm The stream. 1426 * @param off The offset from the current position to the point of 1427 * failure. 1428 * @param pszFormat The message format string. 1429 * @param ... Format arguments. 1430 */ 1431 static void parseWarn(PSCMSTREAM pStrm, size_t off, const char *pszFormat, ...) 1432 { 1433 va_list va; 1434 va_start(va, pszFormat); 1435 parseWarnExV(pStrm, false, off, pszFormat, va); 1436 va_end(va); 1437 } 1438 #endif /* unused */ 1439 1440 /** 1441 * Parser warning with line and position, absolute version. 1442 * 1443 * @param pStrm The stream. 1444 * @param off The offset from the current position to the point of 1445 * failure. 1446 * @param pszFormat The message format string. 1447 * @param ... Format arguments. 1448 */ 1449 static void parseWarnAbs(PSCMSTREAM pStrm, size_t off, const char *pszFormat, ...) 1450 { 1451 va_list va; 1452 va_start(va, pszFormat); 1453 parseWarnExV(pStrm, true /*fAbs*/, off, pszFormat, va); 1454 va_end(va); 1336 1455 } 1337 1456 … … 1705 1824 * @return Type flags. 1706 1825 * @param pszType The type expression. 1707 */ 1708 static uint32_t parseTypeExpression(const char *pszType) 1826 * @param pStrm The input stream (for errors + warnings). 1827 * @param offSrc The absolute source position of this expression (for 1828 * warnings). 1829 */ 1830 static uint32_t parseTypeExpression(const char *pszType, PSCMSTREAM pStrm, size_t offSrc) 1709 1831 { 1710 1832 size_t cchType = strlen(pszType); … … 1721 1843 if (pszType[cchType - 1] == '&') 1722 1844 { 1723 RTMsgWarning("Please avoid using references like '%s' for probe arguments!", pszType);1845 parseWarnAbs(pStrm, offSrc, "Please avoid using references like '%s' for probe arguments!", pszType); 1724 1846 return VTG_TYPE_POINTER; 1725 1847 } … … 1823 1945 || MY_STRMATCH("unsigned short") 1824 1946 ) 1825 RTMsgWarning("Please avoid using the type '%s' for probe arguments!", pszType);1947 parseWarnAbs(pStrm, offSrc, "Please avoid using the type '%s' for probe arguments!", pszType); 1826 1948 if (MY_STRMATCH("unsigned")) return VTG_TYPE_FIXED_SIZED | sizeof(int) | VTG_TYPE_UNSIGNED; 1827 1949 if (MY_STRMATCH("unsigned int")) return VTG_TYPE_FIXED_SIZED | sizeof(int) | VTG_TYPE_UNSIGNED; … … 1858 1980 * @param pProbe The probe. 1859 1981 * @param pArg The argument. 1860 * @param pStrm The input stream (for errors ).1982 * @param pStrm The input stream (for errors + warnings). 1861 1983 * @param pchType The type. 1862 1984 * @param cchType The type length. … … 1874 1996 if (!pArg->pszTracerType || !pArg->pszName) 1875 1997 return parseError(pStrm, 1, "Out of memory"); 1876 pArg->fType = parseTypeExpression(pArg->pszTracerType );1998 pArg->fType = parseTypeExpression(pArg->pszTracerType, pStrm, pArg->offSrc); 1877 1999 1878 2000 if ( (pArg->fType & VTG_TYPE_POINTER) … … 1965 2087 static RTEXITCODE parseProbe(PSCMSTREAM pStrm, PVTGPROVIDER pProv) 1966 2088 { 2089 size_t const iProbeLine = ScmStreamTellLine(pStrm); 2090 1967 2091 /* 1968 2092 * Next up is a name followed by an opening parenthesis. … … 1985 2109 RTListAppend(&pProv->ProbeHead, &pProbe->ListEntry); 1986 2110 pProbe->offArgList = UINT32_MAX; 2111 pProbe->iLine = iProbeLine; 1987 2112 pProbe->pszMangledName = RTStrDupN(pszProbe, cchProbe); 1988 2113 if (!pProbe->pszMangledName) … … 2047 2172 return parseError(pStrm, 1, "Out of memory"); 2048 2173 RTListAppend(&pProbe->ArgHead, &pArg->ListEntry); 2049 pProbe->cArgs++; 2174 pArg->iArgNo = pProbe->cArgs++; 2175 pArg->pProbe = pProbe; 2176 pArg->offSrc = ScmStreamTell(pStrm) - cchWord; 2050 2177 2051 2178 if (cchWord + 1 > sizeof(szArg))
Note:
See TracChangeset
for help on using the changeset viewer.