@@ -30,6 +30,7 @@ module;
30
30
#include < cerrno>
31
31
#include < cstring>
32
32
#include < iostream>
33
+ #include < source_location>
33
34
#include < variant>
34
35
#include < vector>
35
36
#include < boost/container/static_vector.hpp>
@@ -135,6 +136,7 @@ tasktrace current_tasktrace() noexcept {
135
136
auto main = current_backtrace_tasklocal ();
136
137
137
138
tasktrace::vector_type prev;
139
+ tasktrace::vector_resume_points_type prev_resume_points;
138
140
size_t hash = 0 ;
139
141
if (local_engine && g_current_context) {
140
142
task* tsk = nullptr ;
@@ -148,6 +150,7 @@ tasktrace current_tasktrace() noexcept {
148
150
149
151
while (tsk && prev.size () < prev.max_size ()) {
150
152
shared_backtrace bt = tsk->get_backtrace ();
153
+ prev_resume_points.push_back (tsk->get_resume_point ());
151
154
hash *= 31 ;
152
155
if (bt) {
153
156
hash ^= bt->hash ();
@@ -161,7 +164,7 @@ tasktrace current_tasktrace() noexcept {
161
164
}
162
165
}
163
166
164
- return tasktrace (std::move (main), std::move (prev), hash, current_scheduling_group ());
167
+ return tasktrace (std::move (main), std::move (prev), std::move (prev_resume_points), hash, current_scheduling_group ());
165
168
}
166
169
167
170
saved_backtrace current_backtrace () noexcept {
@@ -175,6 +178,14 @@ tasktrace::tasktrace(simple_backtrace main, tasktrace::vector_type prev, size_t
175
178
, _hash(_main.hash() * 31 ^ prev_hash)
176
179
{ }
177
180
181
+ tasktrace::tasktrace (simple_backtrace main, tasktrace::vector_type prev, vector_resume_points_type prev_resume_points, size_t prev_hash, scheduling_group sg) noexcept
182
+ : _main(std::move(main))
183
+ , _prev(std::move(prev))
184
+ , _prev_resume_points(std::move(prev_resume_points))
185
+ , _sg(sg)
186
+ , _hash(_main.hash() * 31 ^ prev_hash)
187
+ { }
188
+
178
189
bool tasktrace::operator ==(const tasktrace& o) const noexcept {
179
190
return _hash == o._hash && _main == o._main && _prev == o._prev ;
180
191
}
@@ -203,8 +214,15 @@ auto formatter<seastar::tasktrace>::format(const seastar::tasktrace& b, format_c
203
214
-> decltype (ctx.out()) {
204
215
auto out = ctx.out ();
205
216
out = fmt::format_to (out, " {}" , b._main );
206
- for (auto && e : b._prev ) {
217
+ for (auto i = 0u ; i < b._prev .size (); ++i) {
218
+ const auto &e = b._prev [i];
219
+ auto resume_loc = i < b._prev_resume_points .size () ? b._prev_resume_points [i] : std::source_location{};
220
+
207
221
out = fmt::format_to (out, " \n --------" );
222
+
223
+ if (resume_loc.file_name ()[0 ] != 0 ) {
224
+ out = fmt::format_to (out, " \n {}:{}:{}" , resume_loc.file_name (), resume_loc.line (), resume_loc.column ());
225
+ }
208
226
out = std::visit (seastar::make_visitor (
209
227
[&] (const seastar::shared_backtrace& sb) {
210
228
return fmt::format_to (out, " \n {}" , sb);
0 commit comments