blob: f248a93fb7b3e4f1243d3fe057b1b72efa648bd9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
//
// FiltCatch.asm
// Revised 4.01.99 by t-joecl
//
// Apply filters that do trap an exception; make sure it doesn't get out
// to an outer .exception aHandler.
//
.assembly extern legacy library mscorlib{}
.assembly extern System.Console
{
.publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
.ver 4:0:0:0
}
.assembly FiltCatch.exe{
//This byte field requests that this assembly not be verified at run time and corresponds to this C# declaration:
//[assembly:System.Security.Permissions.SecurityPermissionAttribute( [mscorlib]System.Security.Permissions.SecurityAction.RequestMinimum, Flags=System.Security.Permissions.SecurityPermissionFlag.SkipVerification )]
.permission reqmin ['mscorlib']System.Security.Permissions.SecurityPermissionAttribute ( "SkipVerification" = true )}
.class FiltCatch {
// global for storing return value - defaults to 0 for success
// .data iResult = int32(0x00000000)
.field static int32 iResult
// Execution starts here
.method static int32 main(class [mscorlib]System.String[]) {
.locals(string)
.entrypoint
.maxstack 2
ldstr "Done"
stloc.0
.try{
newobj instance void [mscorlib]System.ArithmeticException::.ctor()
throw
try_end:
// Error case 4 - exception _not thrown
ldstr "Error case 4 - exception _not thrown"
call void [System.Console]System.Console::WriteLine(class System.String)
ldc.i4 0x4
stsfld int32 FiltCatch::iResult
//br ENDOFTEST
leave ENDOFTEST
}
// aFilter one exception that won't be encountered;
// let it fall through.
filter{
isinst [mscorlib]System.OutOfMemoryException
brfalse OOMcontinue
// Error case 2 - aFilter failure: filtered the wrong exception
ldstr "Error case 2 - aFilter failure: filtered the wrong exception"
call void [System.Console]System.Console::WriteLine(class System.String)
ldc.i4 0x2
stsfld int32 FiltCatch::iResult
ldnull
br OOMendfilter
OOMcontinue:
ldnull
OOMendfilter:
AEfilter:
isinst [mscorlib]System.ArithmeticException
brfalse AEcontinue
ldc.i4 0x00000001
br AEendfilter
AEcontinue:
ldc.i4 0x00000001
br AEendfilter
AEendfilter:
endfilter
}
{
pop
leave ENDOFTEST
ENDOOMFILThandler:
}
ENDOFTEST:
ldsfld int32 FiltCatch::iResult
ldc.i4 0
ceq
brfalse RETFAIL
ldstr "Test succeeded (returning 100)."
call void [System.Console]System.Console::WriteLine(class System.String)
ldc.i4 0x64
br RETEND
RETFAIL:
ldstr "Test FAILED."
call void [System.Console]System.Console::WriteLine(class System.String)
ldsfld int32 FiltCatch::iResult
RETEND:
ldloc.0
call void [System.Console]System.Console::WriteLine(class System.String)
ret
}
}
|