diff options
Diffstat (limited to 'ldebug.c')
-rw-r--r-- | ldebug.c | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -107,13 +107,15 @@ static int getcurrentline (CallInfo *ci) { | |||
107 | 107 | ||
108 | 108 | ||
109 | /* | 109 | /* |
110 | ** This function can be called asynchronously (e.g. during a signal), | 110 | ** Set 'trap' for all active Lua frames. |
111 | ** under "reasonable" assumptions. A new 'ci' is completely linked | 111 | ** This function can be called during a signal, under "reasonable" |
112 | ** in the list before it becomes part of the "active" list, and | 112 | ** assumptions. A new 'ci' is completely linked in the list before it |
113 | ** we assume that pointers are atomic (see comment in next function). | 113 | ** becomes part of the "active" list, and we assume that pointers are |
114 | ** (If we traverse one more item, there is no problem. If we traverse | 114 | ** atomic; see comment in next function. |
115 | ** one less item, the worst that can happen is that the signal will | 115 | ** (A compiler doing interprocedural optimizations could, theoretically, |
116 | ** not interrupt the script.) | 116 | ** reorder memory writes in such a way that the list could be |
117 | ** temporarily broken while inserting a new element. We simply assume it | ||
118 | ** has no good reasons to do that.) | ||
117 | */ | 119 | */ |
118 | static void settraps (CallInfo *ci) { | 120 | static void settraps (CallInfo *ci) { |
119 | for (; ci != NULL; ci = ci->previous) | 121 | for (; ci != NULL; ci = ci->previous) |
@@ -123,8 +125,8 @@ static void settraps (CallInfo *ci) { | |||
123 | 125 | ||
124 | 126 | ||
125 | /* | 127 | /* |
126 | ** This function can be called asynchronously (e.g. during a signal), | 128 | ** This function can be called during a signal, under "reasonable" |
127 | ** under "reasonable" assumptions. | 129 | ** assumptions. |
128 | ** Fields 'oldpc', 'basehookcount', and 'hookcount' (set by | 130 | ** Fields 'oldpc', 'basehookcount', and 'hookcount' (set by |
129 | ** 'resethookcount') are for debug only, and it is no problem if they | 131 | ** 'resethookcount') are for debug only, and it is no problem if they |
130 | ** get arbitrary values (causes at most one wrong hook call). 'hookmask' | 132 | ** get arbitrary values (causes at most one wrong hook call). 'hookmask' |