Changeset 249 for Include/system/exception.ab
- Timestamp:
- May 15, 2007, 2:44:41 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/system/exception.ab
r237 r249 5 5 Const AddressOfCatch As VoidPtr 6 6 Const StackPtr As LONG_PTR 7 context As CONTEXT 8 Const debugProcNum As DWord 7 9 8 10 Sub TryLayer( AddressOfCatch As VoidPtr, StackPtr As LONG_PTR ) 9 11 This.AddressOfCatch = AddressOfCatch 10 12 This.StackPtr = StackPtr 13 14 context.ContextFlags=CONTEXT_ALL 15 If Thread.CurrentThread().__GetContext(context) = 0 Then 16 ' TODO: エラー処理 17 debug 18 End If 19 20 #ifdef _DEBUG 21 Dim ThreadNum As Long 22 ThreadNum=_DebugSys_GetThread() 23 If ThreadNum <> -1 Then 24 debugProcNum = _DebugSys_ProcNum[ThreadNum] 25 End If 26 #endif 11 27 End Sub 12 28 Sub ~TryLayer() … … 37 53 38 54 'Try 39 Sub BeginTryScope( AddressOfCatch As VoidPtr, StackPtr As LONG_PTR )55 Function BeginTryScope( AddressOfCatch As VoidPtr, StackPtr As LONG_PTR ) As TryLayer 40 56 ppTryLayers = _System_realloc( ppTryLayers, ( nTryLayers + 1 ) * SizeOf( *TryLayer ) ) 41 57 ppTryLayers[nTryLayers] = New TryLayer( AddressOfCatch, StackPtr ) 42 58 nTryLayers++ 43 End Sub 59 60 Return ByVal ppTryLayers[nTryLayers-1] 61 End Function 44 62 45 63 'End Try … … 55 73 56 74 'TODO: 適切なエラー処理 75 MessageBox( NULL, "例外", "", MB_OK or MB_ICONEXCLAMATION ) 57 76 58 77 Return … … 72 91 73 92 'レジスタ情報を取得 74 Dim context As CONTEXT 75 FillMemory(VarPtr(context),SizeOf(CONTEXT),0) 76 context.ContextFlags=CONTEXT_CONTROL 77 If thread.__GetContext( context ) = 0 Then 78 OutputDebugString(Ex"レジスタ情報の取得に失敗しました。\r\n") 79 Return 80 End If 81 93 Dim context = ppTryLayers[nTryLayers - 1]->context 94 debug 82 95 '新しいip, spをセット 83 96 #ifdef _WIN64 84 97 context.Rip = ppTryLayers[nTryLayers - 1]->AddressOfCatch As QWord 85 context.Rsp = ppTryLayers[nTryLayers - 1]->StackPtr98 'context.Rsp = ppTryLayers[nTryLayers - 1]->StackPtr 86 99 #else 87 100 context.Eip = ppTryLayers[nTryLayers - 1]->AddressOfCatch As DWord 88 101 context.Esp = ppTryLayers[nTryLayers - 1]->StackPtr 89 102 #endif 103 104 #ifdef _DEBUG 105 Dim ThreadNum As Long 106 ThreadNum=_DebugSys_GetThread() 107 If ThreadNum <> -1 Then 108 _DebugSys_ProcNum[ThreadNum] = ppTryLayers[nTryLayers - 1]->debugProcNum-1 109 End If 110 #endif 111 90 112 If thread.__SetContext( context ) = 0 Then 91 113 OutputDebugString(Ex"レジスタ情報の設定に失敗しました。\r\n")
Note:
See TracChangeset
for help on using the changeset viewer.