@@ -722,6 +722,7 @@ function _backtrace_print_repetition_closings!(io::IO, i, current_cycles, frame_
722722 frame_counter != end_line && break
723723
724724 println (io)
725+ prefix === nothing || print (io, prefix)
725726 line_length = (max_nested_cycles - nactive_cycles) + ndigits_max + 2
726727 nactive_cycles -= 1
727728 printstyled (io, " " , " │" ^ nactive_cycles, " ╰" , " ─" ^ (line_length); color = :light_black )
@@ -733,7 +734,8 @@ function _backtrace_print_repetition_closings!(io::IO, i, current_cycles, frame_
733734 return frame_counter, nactive_cycles
734735end
735736
736- function show_processed_backtrace (io:: IO , trace:: Vector , num_frames:: Int , repeated_cycles:: Vector{NTuple{3, Int}} , max_nested_cycles:: Int ; print_linebreaks:: Bool )
737+ function show_processed_backtrace (io:: IO , trace:: Vector , num_frames:: Int , repeated_cycles:: Vector{NTuple{3, Int}} , max_nested_cycles:: Int ; print_linebreaks:: Bool , prefix = nothing )
738+ prefix === nothing || print (io, prefix)
737739 println (io, " \n Stacktrace:" )
738740
739741 ndigits_max = ndigits (num_frames)
@@ -760,9 +762,9 @@ function show_processed_backtrace(io::IO, trace::Vector, num_frames::Int, repeat
760762 end
761763 nactive_cycles = length (current_cycles)
762764
763- print_stackframe (io, frame_counter, frame, ndigits_max, max_nested_cycles, nactive_cycles, ncycle_starts, STACKTRACE_FIXEDCOLORS, STACKTRACE_MODULECOLORS)
765+ print_stackframe (io, frame_counter, frame, ndigits_max, max_nested_cycles, nactive_cycles, ncycle_starts, STACKTRACE_FIXEDCOLORS, STACKTRACE_MODULECOLORS; prefix )
764766
765- frame_counter, nactive_cycles = _backtrace_print_repetition_closings! (io, i, current_cycles, frame_counter, max_nested_cycles, nactive_cycles, ndigits_max)
767+ frame_counter, nactive_cycles = _backtrace_print_repetition_closings! (io, i, current_cycles, frame_counter, max_nested_cycles, nactive_cycles, ndigits_max; prefix )
766768 frame_counter += 1
767769
768770 if i < length (trace)
798800parentmodule_before_main (x) = parentmodule_before_main (parentmodule (x))
799801
800802# Print a stack frame where the module color is set manually with `modulecolor`.
801- function print_stackframe (io, i, frame:: StackFrame , ndigits_max:: Int , max_nested_cycles:: Int , nactive_cycles:: Int , ncycle_starts:: Int , modulecolor)
803+ function print_stackframe (io, i, frame:: StackFrame , ndigits_max:: Int , max_nested_cycles:: Int , nactive_cycles:: Int , ncycle_starts:: Int , modulecolor; prefix = nothing )
802804 file, line = string (frame. file), frame. line
803805
804806 # Used by the REPL to make it possible to open
@@ -813,6 +815,7 @@ function print_stackframe(io, i, frame::StackFrame, ndigits_max::Int, max_nested
813815 digit_align_width = ndigits_max + 2 + max_nested_cycles - nactive_cycles
814816
815817 # repeated section bracket line 1
818+ prefix === nothing || print (io, prefix)
816819 print (io, " " )
817820 printstyled (io, " ├" ^ (nactive_cycles - ncycle_starts); color = :light_black )
818821 printstyled (io, " ┌" ^ ncycle_starts; color = :light_black )
@@ -826,6 +829,7 @@ function print_stackframe(io, i, frame::StackFrame, ndigits_max::Int, max_nested
826829 println (io)
827830
828831 # repeated section bracket line 2
832+ prefix === nothing || print (io, prefix)
829833 print (io, " " )
830834 printstyled (io, " │" ^ nactive_cycles; color = :light_black )
831835
@@ -875,7 +879,7 @@ Stacktrace processing pipeline:
875879
876880=#
877881
878- function show_backtrace (io:: IO , t:: Vector )
882+ function show_backtrace (io:: IO , t:: Vector ; prefix = nothing )
879883 if haskey (io, :last_shown_line_infos )
880884 empty! (io[:last_shown_line_infos ])
881885 end
@@ -916,7 +920,7 @@ function show_backtrace(io::IO, t::Vector)
916920 # Allow external code to edit information in the frames (e.g. line numbers with Revise)
917921 try invokelatest (update_stackframes_callback[], filtered) catch end
918922
919- show_processed_backtrace (IOContext (io, :backtrace => true ), filtered, nframes, repeated_cycles, max_nested_cycles; print_linebreaks = stacktrace_linebreaks ())
923+ show_processed_backtrace (IOContext (io, :backtrace => true ), filtered, nframes, repeated_cycles, max_nested_cycles; print_linebreaks = stacktrace_linebreaks (), prefix )
920924 nothing
921925end
922926
0 commit comments