@@ -909,7 +909,8 @@ impl<'r, 'data> RemappedFrameIter<'r, 'data> {
909909 class,
910910 method,
911911 file,
912- line : 0 ,
912+ // Preserve input line if present when the mapping has no line info.
913+ line : frame. line ,
913914 parameters : frame. parameters ,
914915 method_synthesized : first_base. is_synthesized ( ) ,
915916 } ) ;
@@ -945,7 +946,8 @@ impl<'r, 'data> RemappedFrameIter<'r, 'data> {
945946 class,
946947 method,
947948 file,
948- line : 0 ,
949+ // Preserve input line if present when the mapping has no line info.
950+ line : frame. line ,
949951 parameters : frame. parameters ,
950952 method_synthesized : first. is_synthesized ( ) ,
951953 } ) ;
@@ -1005,6 +1007,26 @@ fn iterate_with_lines<'a>(
10051007 if has_line_info && frame. line > 0 && member. endline == 0 {
10061008 continue ;
10071009 }
1010+ // If the mapping entry has no line range, preserve the input line number (if any).
1011+ if member. endline == 0 {
1012+ let class = cache
1013+ . read_string ( member. original_class_offset )
1014+ . unwrap_or ( frame. class ) ;
1015+
1016+ let method = cache. read_string ( member. original_name_offset ) . ok ( ) ?;
1017+
1018+ // Synthesize from class name (input filename is not reliable)
1019+ let file = synthesize_source_file ( class, outer_source_file) . map ( Cow :: Owned ) ;
1020+
1021+ return Some ( StackFrame {
1022+ class,
1023+ method,
1024+ file,
1025+ line : frame. line ,
1026+ parameters : frame. parameters ,
1027+ method_synthesized : member. is_synthesized ( ) ,
1028+ } ) ;
1029+ }
10081030 // skip any members which do not match our frames line
10091031 if member. endline > 0
10101032 && ( frame. line < member. startline as usize || frame. line > member. endline as usize )
@@ -1080,7 +1102,8 @@ fn iterate_without_lines_preferring_base<'a>(
10801102 class,
10811103 method,
10821104 file,
1083- line : 0 ,
1105+ // Preserve input line if present when the mapping has no line info.
1106+ line : frame. line ,
10841107 parameters : frame. parameters ,
10851108 method_synthesized : member. is_synthesized ( ) ,
10861109 } ) ;
@@ -1109,7 +1132,8 @@ fn iterate_without_lines<'a>(
11091132 class,
11101133 method,
11111134 file,
1112- line : 0 ,
1135+ // Preserve input line if present when the mapping has no line info.
1136+ line : frame. line ,
11131137 parameters : frame. parameters ,
11141138 method_synthesized : member. is_synthesized ( ) ,
11151139 } )
0 commit comments