File tree Expand file tree Collapse file tree 2 files changed +19
-8
lines changed Expand file tree Collapse file tree 2 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -382,7 +382,7 @@ function DILineInfoPrinter(linetable::Vector, showtypes::Bool=false)
382
382
# if so, drop all existing calls to it from the top of the context
383
383
# AND check if instead the context was previously printed that way
384
384
# but now has removed the recursive frames
385
- let method = method_name (context[nctx])
385
+ let method = method_name (context[nctx]) # last matching frame
386
386
if (nctx < nframes && method_name (DI[nframes - nctx]) === method) ||
387
387
(nctx < length (context) && method_name (context[nctx + 1 ]) === method)
388
388
update_line_only = true
@@ -391,8 +391,15 @@ function DILineInfoPrinter(linetable::Vector, showtypes::Bool=false)
391
391
end
392
392
end
393
393
end
394
- elseif length (context) > 0
395
- update_line_only = true
394
+ end
395
+ # look at the first non-matching element to see if we are only changing the line number
396
+ if ! update_line_only && nctx < length (context) && nctx < nframes
397
+ let CtxLine = context[nctx + 1 ],
398
+ FrameLine = DI[nframes - nctx]
399
+ if method_name (CtxLine) === method_name (FrameLine)
400
+ update_line_only = true
401
+ end
402
+ end
396
403
end
397
404
elseif nctx < length (context) && nctx < nframes
398
405
# look at the first non-matching element to see if we are only changing the line number
Original file line number Diff line number Diff line change @@ -229,17 +229,21 @@ void DILineInfoPrinter::emit_lineinfo(raw_ostream &Out, std::vector<DILineInfo>
229
229
// if so, drop all existing calls to it from the top of the context
230
230
// AND check if instead the context was previously printed that way
231
231
// but now has removed the recursive frames
232
- StringRef method = StringRef (context.at (nctx - 1 ).FunctionName ).rtrim (' ;' );
232
+ StringRef method = StringRef (context.at (nctx - 1 ).FunctionName ).rtrim (' ;' ); // last matching frame
233
233
if ((nctx < nframes && StringRef (DI.at (nframes - nctx - 1 ).FunctionName ).rtrim (' ;' ) == method) ||
234
234
(nctx < context.size () && StringRef (context.at (nctx).FunctionName ).rtrim (' ;' ) == method)) {
235
235
update_line_only = true ;
236
- while (nctx > 0 && StringRef (context.at (nctx - 1 ).FunctionName ).rtrim (' ;' ) == method) {
236
+ // transform nctx to exclude the combined frames
237
+ while (nctx > 0 && StringRef (context.at (nctx - 1 ).FunctionName ).rtrim (' ;' ) == method)
237
238
nctx -= 1 ;
238
- }
239
239
}
240
240
}
241
- else if (context.size () > 0 ) {
242
- update_line_only = true ;
241
+ if (!update_line_only && nctx < context.size () && nctx < nframes) {
242
+ // look at the first non-matching element to see if we are only changing the line number
243
+ const DILineInfo &CtxLine = context.at (nctx);
244
+ const DILineInfo &FrameLine = DI.at (nframes - 1 - nctx);
245
+ if (StringRef (CtxLine.FunctionName ).rtrim (' ;' ) == StringRef (FrameLine.FunctionName ).rtrim (' ;' ))
246
+ update_line_only = true ;
243
247
}
244
248
}
245
249
else if (nctx < context.size () && nctx < nframes) {
You can’t perform that action at this time.
0 commit comments