@@ -30,6 +30,7 @@ module;
3030#include < cerrno>
3131#include < cstring>
3232#include < iostream>
33+ #include < source_location>
3334#include < variant>
3435#include < vector>
3536#include < boost/container/static_vector.hpp>
@@ -135,6 +136,7 @@ tasktrace current_tasktrace() noexcept {
135136 auto main = current_backtrace_tasklocal ();
136137
137138 tasktrace::vector_type prev;
139+ tasktrace::vector_resume_points_type prev_resume_points;
138140 size_t hash = 0 ;
139141 if (local_engine && g_current_context) {
140142 task* tsk = nullptr ;
@@ -148,6 +150,7 @@ tasktrace current_tasktrace() noexcept {
148150
149151 while (tsk && prev.size () < prev.max_size ()) {
150152 shared_backtrace bt = tsk->get_backtrace ();
153+ prev_resume_points.push_back (tsk->get_resume_point ());
151154 hash *= 31 ;
152155 if (bt) {
153156 hash ^= bt->hash ();
@@ -161,7 +164,7 @@ tasktrace current_tasktrace() noexcept {
161164 }
162165 }
163166
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 ());
165168}
166169
167170saved_backtrace current_backtrace () noexcept {
@@ -175,6 +178,14 @@ tasktrace::tasktrace(simple_backtrace main, tasktrace::vector_type prev, size_t
175178 , _hash(_main.hash() * 31 ^ prev_hash)
176179{ }
177180
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+
178189bool tasktrace::operator ==(const tasktrace& o) const noexcept {
179190 return _hash == o._hash && _main == o._main && _prev == o._prev ;
180191}
@@ -203,8 +214,15 @@ auto formatter<seastar::tasktrace>::format(const seastar::tasktrace& b, format_c
203214 -> decltype (ctx.out()) {
204215 auto out = ctx.out ();
205216 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+
207221 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+ }
208226 out = std::visit (seastar::make_visitor (
209227 [&] (const seastar::shared_backtrace& sb) {
210228 return fmt::format_to (out, " \n {}" , sb);
0 commit comments