@@ -1039,6 +1039,17 @@ static int _show_one_line(FILE *fp, int l, bool skip, bool show_num)
1039
1039
return rv ;
1040
1040
}
1041
1041
1042
+ static int sprint_line_description (char * sbuf , size_t size , struct line_range * lr )
1043
+ {
1044
+ if (!lr -> function )
1045
+ return snprintf (sbuf , size , "file: %s, line: %d" , lr -> file , lr -> start );
1046
+
1047
+ if (lr -> file )
1048
+ return snprintf (sbuf , size , "function: %s, file:%s, line: %d" , lr -> function , lr -> file , lr -> start );
1049
+
1050
+ return snprintf (sbuf , size , "function: %s, line:%d" , lr -> function , lr -> start );
1051
+ }
1052
+
1042
1053
#define show_one_line_with_num (f ,l ) _show_one_line(f,l,false,true)
1043
1054
#define show_one_line (f ,l ) _show_one_line(f,l,false,false)
1044
1055
#define skip_one_line (f ,l ) _show_one_line(f,l,true,false)
@@ -1071,14 +1082,17 @@ static int __show_line_range(struct line_range *lr, const char *module,
1071
1082
ret = get_alternative_line_range (dinfo , lr , module , user );
1072
1083
if (!ret )
1073
1084
ret = debuginfo__find_line_range (dinfo , lr );
1085
+ else /* Ignore error, we just failed to find it. */
1086
+ ret = - ENOENT ;
1074
1087
}
1075
1088
if (dinfo -> build_id ) {
1076
1089
build_id__init (& bid , dinfo -> build_id , BUILD_ID_SIZE );
1077
1090
build_id__sprintf (& bid , sbuild_id );
1078
1091
}
1079
1092
debuginfo__delete (dinfo );
1080
1093
if (ret == 0 || ret == - ENOENT ) {
1081
- pr_warning ("Specified source line is not found.\n" );
1094
+ sprint_line_description (sbuf , sizeof (sbuf ), lr );
1095
+ pr_warning ("Specified source line(%s) is not found.\n" , sbuf );
1082
1096
return - ENOENT ;
1083
1097
} else if (ret < 0 ) {
1084
1098
pr_warning ("Debuginfo analysis failed.\n" );
0 commit comments