1
2
3
4
5
6 using System;
7
8 namespace System.Runtime
9 {
10 public class UnwindInfo
11 {
12 public UnwindInfo* next;
13 public void* function;
14 public int line;
15 }
16
17 public nothrow delegate void InitCompileUnitUnwindInfoFunction();
18
19 public class CompileUnitUnwindInfo
20 {
21 public CompileUnitUnwindInfo* next;
22 public InitCompileUnitUnwindInfoFunction initUnwindInfoFunction;
23 }
24
25 public CompileUnitUnwindInfo* compileUnitUnwindInfoInitList = null;
26
27 public nothrow void PushCompileUnitUnwindInfoInit(InitCompileUnitUnwindInfoFunction initFunction, CompileUnitUnwindInfo* info)
28 {
29 info->next = compileUnitUnwindInfoInitList;
30 info->initUnwindInfoFunction = initFunction;
31 compileUnitUnwindInfoInitList = info;
32 }
33
34 public nothrow void AddCompileUnitFunction(void* functionAddress, const char* functionName, const char* sourceFilePath)
35 {
36 RtAddCompileUnitFunction(functionAddress, functionName, sourceFilePath);
37 }
38
39 internal class UnwindInfoInit
40 {
41 public nothrow UnwindInfoInit()
42 {
43 while (compileUnitUnwindInfoInitList != null)
44 {
45 CompileUnitUnwindInfo* info = compileUnitUnwindInfoInitList;
46 compileUnitUnwindInfoInitList = null;
47 info->initUnwindInfoFunction();
48 compileUnitUnwindInfoInitList = info->next;
49 }
50 }
51 public ~UnwindInfoInit()
52 {
53 RtEndUnwindInfoInit();
54 }
55 }
56
57 internal nothrow void InitUnwindInfo()
58 {
59 RtBeginUnwindInfoInit();
60 UnwindInfoInit init;
61 }
62
63 public nothrow const char* GetCallStack()
64 {
65 InitUnwindInfo();
66 return RtGetCallStack();
67 }
68
69 public nothrow void DisposeCallStack()
70 {
71 RtDisposeCallStack();
72 }
73 }