blob: 56fd9f51f565e2eef60e8c9f17114d57493b1a08 (
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
|
// 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.
// try catch with branches into try body
// try finally at the end of trybody of the try catch
.assembly extern System.Console
{
.publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )
.ver 4:0:0:0
}
.assembly extern mscorlib
{
}
.assembly extern common{}
.assembly trycatch
{
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module trycatch.exe
.imagebase 0x00400000
.subsystem 0x00000003
.file alignment 512
.corflags 0x00000001
.namespace hello
{
.class private auto ansi beforefieldinit Class1
extends [mscorlib]System.Object
{
.method public hidebysig static void
inTry() cil managed
{
.maxstack 8
ldstr "throwing ..."
call void [System.Console]System.Console::WriteLine(string)
newobj instance void [mscorlib]System.Exception::.ctor()
throw
}
.method public hidebysig static void
inCatch() cil managed
{
.maxstack 8
IL_0000: ldstr "in Catch\n"
IL_0005: call void [System.Console]System.Console::WriteLine(string)
IL_000a: ret
}
.method public hidebysig static void
inFinally() cil managed
{
.maxstack 8
IL_0000: ret
}
.method public hidebysig static int32
Main(string[] args) cil managed
{
.entrypoint
.maxstack 4
.locals init (int32 V_0,
class [mscorlib]System.Exception V_1,
class [mscorlib]System.IO.StringWriter expectedOut,
class [common]TestUtil.TestLog testLog
)
newobj instance void [mscorlib]System.IO.StringWriter::.ctor()
stloc.s expectedOut
ldloc.s expectedOut
ldstr "in Try ..."
callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
ldloc.s expectedOut
ldstr "throwing ..."
callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
ldloc.s expectedOut
ldstr "in Catch\n"
callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
ldloc.s expectedOut
ldstr "in Try ... (again)"
callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
ldloc.s expectedOut
ldstr "throwing ..."
callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
ldloc.s expectedOut
ldstr "in Catch\n"
callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
ldloc.s expectedOut
ldstr "in Try ... (again)"
callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
ldloc.s expectedOut
ldstr "throwing ..."
callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
ldloc.s expectedOut
ldstr "in Catch\n"
callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
ldloc.s expectedOut
ldstr "in Try ... (again), leaving"
callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
ldloc.s expectedOut
ldstr "in finally"
callvirt instance void [mscorlib]System.IO.TextWriter::WriteLine(string)
ldloc.s expectedOut
newobj instance void [common]TestUtil.TestLog::.ctor(object)
stloc.s testLog
ldloc.s testLog
callvirt instance void [common]TestUtil.TestLog::StartRecording()
IL_0000: ldc.i4.0
IL_0001: stloc.0
.try
{
ldstr "in Try ..."
call void [System.Console]System.Console::WriteLine(string)
call void hello.Class1::inTry()
cont1:
ldstr "in Try ... (again)"
call void [System.Console]System.Console::WriteLine(string)
call void hello.Class1::inTry()
cont2:
ldstr "in Try ... (again)"
call void [System.Console]System.Console::WriteLine(string)
call void hello.Class1::inTry()
cont3:
nop
.try
{
ldstr "in Try ... (again), leaving"
call void [System.Console]System.Console::WriteLine(string)
leave.s IL_001b
} finally {
ldstr "in finally"
call void [System.Console]System.Console::WriteLine(string)
endfinally
}
leave.s IL_001b
}
catch [mscorlib]System.Exception
{
pop
call void hello.Class1::inCatch()
ldloc.0
brfalse.s zero
ldc.i4.1
ldloc.0
beq.s first
leave.s cont3
zero:
ldloc.0
ldc.i4.1
add
stloc.0
leave.s cont1
first:
ldloc.0
ldc.i4.1
add
stloc.0
leave.s cont2
}
IL_001b:
ldloc.s testLog
callvirt instance void [common]TestUtil.TestLog::StopRecording()
ldloc.s testLog
callvirt instance int32 [common]TestUtil.TestLog::VerifyOutput()
ret
}
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
}
}
}
|