Changeset 21999 for trunk/src/kernel32/exceptions.cpp
- Timestamp:
- Apr 18, 2012, 10:46:37 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/exceptions.cpp
r21980 r21999 120 120 PCONTEXTRECORD pCtxRec, PVOID p, PSZ szTrapDump); 121 121 122 int __cdecl __seh_handler(PWINEXCEPTION_RECORD pRec, 123 PWINEXCEPTION_FRAME pFrame, 124 PCONTEXTRECORD pContext, PVOID pVoid); 125 126 PWINEXCEPTION_FRAME __cdecl __seh_get_prev_frame(PWINEXCEPTION_FRAME pFrame); 122 int __cdecl __seh_handler(PVOID pRec, PVOID pFrame, 123 PVOID pContext, PVOID pVoid); 124 125 int __cdecl __seh_handler_win32(PWINEXCEPTION_RECORD pRec, 126 PWINEXCEPTION_FRAME pFrame, 127 PCONTEXTRECORD pContext, PVOID pVoid); 128 129 PWINEXCEPTION_FRAME __cdecl __seh_get_prev_frame_win32(PWINEXCEPTION_FRAME pFrame); 127 130 128 131 #ifdef DEBUG … … 363 366 while( (pFrame != NULL) && ((ULONG)((ULONG)pFrame & 0xFFFFF000) != 0xFFFFF000) ) 364 367 { 365 pPrevFrame = __seh_get_prev_frame (pFrame);368 pPrevFrame = __seh_get_prev_frame_win32(pFrame); 366 369 367 370 dprintf(("KERNEL32: RtlDispatchException - pframe=%08X, pframe->Prev=%08X", … … 518 521 while (((ULONG)((ULONG)frame & 0xFFFFF000) != 0xFFFFF000) && (frame != pEndFrame)) 519 522 { 520 prevFrame = __seh_get_prev_frame (frame);523 prevFrame = __seh_get_prev_frame_win32(frame); 521 524 522 525 /* Check frame address */ … … 590 593 dprintf(("KERNEL32: RtlUnwind (after) - frame=%08X, frame->Prev=%08X", frame, 591 594 ((ULONG)((ULONG)frame & 0xFFFFF000) != 0xFFFFF000) ? 592 __seh_get_prev_frame (frame) : (void*)0xFFFFFFFF));595 __seh_get_prev_frame_win32(frame) : (void*)0xFFFFFFFF)); 593 596 } 594 597 … … 1242 1245 PVOID p) 1243 1246 { 1247 // we need special processing when reused from ___seh_handler 1248 BOOL fSEH = pERegRec->ExceptionHandler == (_ERR *)__seh_handler; 1249 1244 1250 #ifdef DEBUG 1245 1251 //SvL: Check if exception inside debug fprintf -> if so, clear lock so … … 1279 1285 if (pERepRec->fHandlerFlags & EH_EXIT_UNWIND) 1280 1286 { 1281 dprintf(("KERNEL32: OS2ExceptionHandler : EH_EXIT_UNWIND, "1282 "unwinding all the Win32 exception chain" ));1287 dprintf(("KERNEL32: OS2ExceptionHandler (fSEH=%d): EH_EXIT_UNWIND, " 1288 "unwinding all the Win32 exception chain", fSEH)); 1283 1289 RtlUnwind(NULL, 0, 0, 0); 1284 1290 } 1285 1291 else 1286 1292 { 1287 dprintf(("KERNEL32: OS2ExceptionHandler : EH_UNWINDING, "1288 "unwinding the Win32 exception chain up to 0x%p", pERegRec));1293 dprintf(("KERNEL32: OS2ExceptionHandler (fSEH=%d): EH_UNWINDING, " 1294 "unwinding the Win32 exception chain up to 0x%p", fSEH, pERegRec)); 1289 1295 1290 1296 // find a Win32 exception frame closest to the OS/2 one (pERegRec) … … 1295 1301 while (frame != NULL && ((ULONG)frame)!= 0xFFFFFFFF && 1296 1302 ((ULONG)frame) <= ((ULONG)pERegRec)) 1297 frame = __seh_get_prev_frame (frame);1303 frame = __seh_get_prev_frame_win32(frame); 1298 1304 if (((ULONG)frame) == 0xFFFFFFFF) 1299 1305 frame = NULL; … … 1316 1322 case XCPT_FLOAT_UNDERFLOW: 1317 1323 dprintfException(pERepRec, pERegRec, pCtxRec, p); 1318 dprintf(("KERNEL32: OS2ExceptionHandler : FPU exception\n"));1319 if((!fIsOS2Image || f SEHEnabled) && !fExitProcess) //Only for real win32 apps or if SEH enabled1320 { 1321 if(OSLibDispatchException(pERepRec, pERegRec, pCtxRec, p ) == FALSE)1324 dprintf(("KERNEL32: OS2ExceptionHandler (fSEH=%d): FPU exception\n", fSEH)); 1325 if((!fIsOS2Image || fForceWin32TIB || fSEH) && !fExitProcess) //Only for real win32 apps or when forced 1326 { 1327 if(OSLibDispatchException(pERepRec, pERegRec, pCtxRec, p, fSEH) == FALSE) 1322 1328 { 1323 1329 pCtxRec->ctx_env[0] |= 0x1F; … … 1328 1334 else 1329 1335 { 1330 dprintf(("KERNEL32: OS2ExceptionHandler : fix and continue\n"));1336 dprintf(("KERNEL32: OS2ExceptionHandler (fSEH=%d): fix and continue\n", fSEH)); 1331 1337 goto continueexecution; 1332 1338 } 1333 1339 } 1334 dprintf(("KERNEL32: OS2ExceptionHandler : continue search\n"));1340 dprintf(("KERNEL32: OS2ExceptionHandler (fSEH=%d): continue search\n", fSEH)); 1335 1341 goto continuesearch; 1336 1342 … … 1439 1445 DosQueryMem((PVOID) pERepRec->ExceptionInfo[1], 1440 1446 &offset, &accessflag); 1441 dprintf(("KERNEL32: OS2ExceptionHandler : failed address info 0x%X size 0x%X. flag %X\n",1442 pERepRec->ExceptionInfo[1], offset, accessflag));1447 dprintf(("KERNEL32: OS2ExceptionHandler (fSEH=%d): failed address info 0x%X size 0x%X. flag %X\n", 1448 fSEH, pERepRec->ExceptionInfo[1], offset, accessflag)); 1443 1449 /* check for valid address */ 1444 1450 if (!pERepRec->ExceptionInfo[1] || … … 1454 1460 offset + (pERepRec->ExceptionInfo[1] - (pERepRec->ExceptionInfo[1] & 0xFFFFF000)), 1455 1461 accessflag | PAG_WRITE | PAG_COMMIT); 1456 dprintf(("KERNEL32: OS2ExceptionHandler : commiting 0x%X size 0x%X. RC: %i\n",1457 pERepRec->ExceptionInfo[1] & 0xFFFFF000,1462 dprintf(("KERNEL32: OS2ExceptionHandler (fSEH=%d): commiting 0x%X size 0x%X. RC: %i\n", 1463 fSEH, pERepRec->ExceptionInfo[1] & 0xFFFFF000, 1458 1464 offset + (pERepRec->ExceptionInfo[1] - (pERepRec->ExceptionInfo[1] & 0xFFFFF000)), 1459 1465 rc)); … … 1508 1514 1509 1515 //NOTE: This will not work properly in case multiple threads execute this code 1510 dprintf((" Changing thread registers (SetThreadContext)!!"));1516 dprintf(("KERNEL32: OS2ExceptionHandler (fSEH=%d): Changing thread registers (SetThreadContext)!!", fSEH)); 1511 1517 1512 1518 if(teb->o.odin.context.ContextFlags & WINCONTEXT_CONTROL) { … … 1583 1589 #endif 1584 1590 1585 if((!fIsOS2Image || f SEHEnabled) && !fExitProcess) //Only for real win32 apps or if SEH enabled1586 { 1587 if(OSLibDispatchException(pERepRec, pERegRec, pCtxRec, p ) == TRUE)1591 if((!fIsOS2Image || fForceWin32TIB || fSEH) && !fExitProcess) //Only for real win32 apps or when forced 1592 { 1593 if(OSLibDispatchException(pERepRec, pERegRec, pCtxRec, p, fSEH) == TRUE) 1588 1594 { 1589 dprintf(("KERNEL32: OS2ExceptionHandler : fix and continue\n"));1595 dprintf(("KERNEL32: OS2ExceptionHandler (fSEH=%d): fix and continue\n", fSEH)); 1590 1596 goto continueexecution; 1591 1597 } 1592 1598 else 1593 1599 { 1594 dprintf(("KERNEL32: OS2ExceptionHandler : continue search\n"));1600 dprintf(("KERNEL32: OS2ExceptionHandler (fSEH=%d): continue search\n", fSEH)); 1595 1601 goto continuesearch; 1596 1602 } … … 1605 1611 if(rc == NO_ERROR) 1606 1612 { 1607 dprintf(("KERNEL32: OS2ExceptionHandler : Continue and kill thread"));1613 dprintf(("KERNEL32: OS2ExceptionHandler (fSEH=%d): Continue and kill thread", fSEH)); 1608 1614 1609 1615 pCtxRec->ctx_RegEip = (pTIB->tib_ptib2->tib2_ultid != 1) ? (ULONG)KillWin32Thread : (ULONG)KillWin32Process; … … 1620 1626 logException(pERepRec, pERegRec, pCtxRec, p); 1621 1627 1622 dprintf(("KERNEL32: OS2ExceptionHandler : Continue and kill\n"));1628 dprintf(("KERNEL32: OS2ExceptionHandler (fSEH=%d): Continue and kill\n", fSEH)); 1623 1629 1624 1630 pCtxRec->ctx_RegEip = (ULONG)KillWin32Process; … … 1648 1654 1649 1655 // Make sure we detect a stack overflow condition before the system does 1650 if ((!fIsOS2Image || f SEHEnabled) && //Only for real win32 apps or if SEH enabled1656 if ((!fIsOS2Image || fForceWin32TIB || fSEH) && //Only for real win32 apps or when forced 1651 1657 pERepRec->ExceptionInfo[1] >= stackbottom && 1652 1658 pERepRec->ExceptionInfo[1] < stacktop … … 1704 1710 recoutofstack.cParameters = 0; 1705 1711 1706 if(OSLibDispatchException(&recoutofstack, pERegRec, pCtxRec, p ) == TRUE)1712 if(OSLibDispatchException(&recoutofstack, pERegRec, pCtxRec, p, fSEH) == TRUE) 1707 1713 { 1708 1714 goto continueexecution; … … 1714 1720 { 1715 1721 // Throw EXCEPTION_GUARD_PAGE_VIOLATION in the Win32 context 1716 if((!fIsOS2Image || f SEHEnabled) && !fExitProcess) //Only for real win32 apps or if SEH enabled1722 if((!fIsOS2Image || fForceWin32TIB || fSEH) && !fExitProcess) //Only for real win32 apps or when forced 1717 1723 { 1718 if(OSLibDispatchException(pERepRec, pERegRec, pCtxRec, p ) == TRUE)1724 if(OSLibDispatchException(pERepRec, pERegRec, pCtxRec, p, fSEH) == TRUE) 1719 1725 { 1720 1726 goto continueexecution; … … 1961 1967 while ((pFrame != NULL) && ((ULONG)pFrame != 0xFFFFFFFF)) 1962 1968 { 1963 PWINEXCEPTION_FRAME pPrevFrame = __seh_get_prev_frame (pFrame);1969 PWINEXCEPTION_FRAME pPrevFrame = __seh_get_prev_frame_win32(pFrame); 1964 1970 dprintf((" Record at %08X, Prev at %08X, handler at %08X%s", 1965 1971 pFrame, pPrevFrame, pFrame->Handler, 1966 pFrame->Handler == (PEXCEPTION_HANDLER)__seh_handler ? 1967 " (SEH)" : ""));1972 pFrame->Handler == (PEXCEPTION_HANDLER)__seh_handler ? " (SEH)" : 1973 pFrame->Handler == (PEXCEPTION_HANDLER)__seh_handler_win32 ? " (SEH Win32)" : "")); 1968 1974 if (pFrame == pPrevFrame) 1969 1975 {
Note:
See TracChangeset
for help on using the changeset viewer.