IB/core: Make testing MR flags for writability a static inline function
[linux-2.6-block.git] / scripts / faddr2line
index 7721d5b2b0c04ee923b3c14216214db68fcb7dd0..9e5735a4d3a57bf910ae2441a00a083e865f4136 100755 (executable)
@@ -163,7 +163,17 @@ __faddr2line() {
 
                # pass real address to addr2line
                echo "$func+$offset/$sym_size:"
-               ${ADDR2LINE} -fpie $objfile $addr | sed "s; $dir_prefix\(\./\)*; ;"
+               local file_lines=$(${ADDR2LINE} -fpie $objfile $addr | sed "s; $dir_prefix\(\./\)*; ;")
+               [[ -z $file_lines ]] && return
+
+               # show each line with context
+               echo "$file_lines" | while read -r line
+               do
+                       echo $line
+                       eval $(echo $line | awk -F "[ :]" '{printf("n1=%d;n2=%d;f=%s",$NF-5, $NF+5, $(NF-1))}')
+                       awk 'NR>=strtonum("'$n1'") && NR<=strtonum("'$n2'") {printf("%d\t%s\n", NR, $0)}' $f
+               done
+
                DONE=1
 
        done < <(${NM} -n $objfile | awk -v fn=$func -v end=$file_end '$3 == fn { found=1; line=$0; start=$1; next } found == 1 { found=0; print line, "0x"$1 } END {if (found == 1) print line, end; }')