summary refs log tree commit diff stats
path: root/tests/stdlib/tos.nim
diff options
context:
space:
mode:
authorȘtefan Talpalaru <stefantalpalaru@yahoo.com>2021-05-19 19:19:11 +0200
committerGitHub <noreply@github.com>2021-05-19 19:19:11 +0200
commita1c82c39af812b54cd3dd1e472c9088457fb7dc5 (patch)
treeaecc61e015df41e7a68d960e911d249e7fe141eb /tests/stdlib/tos.nim
parent7052503ca8d360f11fabf476f7450dc3f794a602 (diff)
downloadNim-a1c82c39af812b54cd3dd1e472c9088457fb7dc5.tar.gz
asyncdispatch+stackTraceOverride: fix premature collection (#18039) [backport:1.2]
Copying StackTraceEntry instances when nimStackTraceOverride is defined
breaks the link between a cstring field that's supposed to point at
another string field in the same object.

Sometimes, the original object is garbage collected, that memory region
reused for storing other strings, so when the StackTraceEntry copy tries
to use its cstring pointer to construct a traceback message, it accesses
unrelated strings.

This only happens for async tracebacks and this patch prevents that by
making sure we only use the string fields when nimStackTraceOverride is
defined.

Async tracebacks also beautified slightly by getting rid of an extra line
that was supposed to be commented out, along with the corresponding debugging output.

There's also a micro-optimisation to avoid concatenating two strings just
to get their combined length.
Diffstat (limited to 'tests/stdlib/tos.nim')
0 files changed, 0 insertions, 0 deletions
pre>d13794bf ^
6e46e8fe ^
d13794bf ^
6e46e8fe ^
d13794bf ^
79c92656 ^
2f2fa8de ^
8e90f7a4 ^
6e46e8fe ^

279737ba ^
d13794bf ^

b4ea35d4 ^

6e46e8fe ^

d13794bf ^
6e46e8fe ^
d13794bf ^







6e46e8fe ^
d13794bf ^
6e46e8fe ^





4e0a631f ^


b4ea35d4 ^





4e0a631f ^
2f2fa8de ^
8e90f7a4 ^
6bad38c2 ^
8e90f7a4 ^
eb5b04df ^

279737ba ^

6e46e8fe ^
79c92656 ^





4e0a631f ^
8e90f7a4 ^



79c92656 ^
6e46e8fe ^

279737ba ^
d13794bf ^





279737ba ^
6e46e8fe ^



279737ba ^
d13794bf ^
6e46e8fe ^
d13794bf ^
6e46e8fe ^

279737ba ^

6e46e8fe ^


140deeb5 ^
4e0a631f ^





2f2fa8de ^





8e90f7a4 ^





79c92656 ^





a0eda420 ^


79c92656 ^

a0eda420 ^






79c92656 ^

a0eda420 ^



a061b0d4 ^


79c92656 ^

a061b0d4 ^









8e90f7a4 ^

140deeb5 ^
8e90f7a4 ^



140deeb5 ^
8e90f7a4 ^


140deeb5 ^
79c92656 ^








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
195
196
197
198
199
200
201