@@ -113,7 +113,11 @@ function print_status(io::IO, frame::Frame; force_lowered=false)
113
113
read (loc. filepath, String)
114
114
end
115
115
breakpoint_lines = breakpoint_linenumbers (frame)
116
- print_sourcecode (outbuf, data, loc. line, loc. defline, loc. endline, breakpoint_lines)
116
+ ok = print_sourcecode (outbuf, data, loc. line, loc. defline, loc. endline, breakpoint_lines)
117
+ if ! ok
118
+ printstyled (io, " failed to lookup source code in $(repr (loc. filepath)) , showing lowered code:\n " ; color= Base. warn_color ())
119
+ print_codeinfo (outbuf, frame)
120
+ end
117
121
else
118
122
print_codeinfo (outbuf, frame)
119
123
end
@@ -214,6 +218,9 @@ function print_sourcecode(io::IO, code::String, line::Integer, defline::Integer,
214
218
code = highlight_code (code; context= io)
215
219
file = SourceFile (code)
216
220
stopline = min (endline, line + NUM_SOURCE_LINES_UP_DOWN[])
221
+ if ! checkbounds (Bool, file. offsets, line)
222
+ return false
223
+ end
217
224
startoffset, stopoffset = compute_source_offsets (code, file. offsets[line], defline, stopline; file= file)
218
225
219
226
if startoffset == - 1
@@ -226,6 +233,7 @@ function print_sourcecode(io::IO, code::String, line::Integer, defline::Integer,
226
233
227
234
code = split (code[(startoffset+ 1 ): (stopoffset+ 1 )],' \n ' )
228
235
print_lines (io, code, line, breakpoint_lines, startline)
236
+ return true
229
237
end
230
238
231
239
function print_lines (io, code, current_line, breakpoint_lines, startline)
0 commit comments