Lines Matching +full:line +full:- +full:name
2 # SPDX-License-Identifier: GPL-2.0
4 #set -x
8 echo " $0 -r <release> | <vmlinux> [<base path>|auto] [<modules path>]"
12 if type llvm-cxxfilt >/dev/null 2>&1 ; then
13 cppfilt=llvm-cxxfilt
16 cppfilt_opts=-i
19 if [[ $1 == "-r" ]] ; then
25 …for fn in {,/usr/lib/debug}/boot/vmlinux-$release{,.debug} /lib/modules/$release{,/build}/vmlinux …
26 if [ -e "$fn" ] ; then
39 basepath=${2-auto}
44 # Can we use debuginfod-find?
45 if type debuginfod-find >/dev/null 2>&1 ; then
46 debuginfod=${1-only}
49 if [[ $vmlinux == "" && -z $debuginfod ]] ; then
57 declare -A cache 2>/dev/null
61 declare -A modcache
65 if [[ -n $debuginfod ]] ; then
66 if [[ -n $modbuildid ]] ; then
67 debuginfod-find debuginfo $modbuildid && return
77 for fn in $(find "$modpath" -name "${module//_/[-_]}.ko*") ; do
78 if readelf -WS "$fn" | grep -qwF .debug_line ; then
90 …release=$(gdb -ex 'print init_uts_ns.name.release' -ex 'quit' -quiet -batch "$vmlinux" 2>/dev/null…
94 if [ -e "$dn" ] ; then
106 # ([name]+[offset]/[total length])
137 # Strip the symbol name so that we could look it up
138 local name=${symbol%+*}
143 if [[ $aarray_support == true && "${cache[$module,$name]+isset}" == "isset" ]]; then
144 local base_addr=${cache[$module,$name]}
146 …local base_addr=$(nm "$objfile" 2>/dev/null | awk '$3 == "'$name'" && ($2 == "t" || $2 == "T") {pr…
152 cache[$module,$name]="$base_addr"
159 # Now, replace the symbol name with the base address we found
161 expr=${expr/$name/0x$base_addr}
167 # Pass it to addr2line to get filename and line number
172 local code=$(${CROSS_COMPILE}addr2line -i -e "$objfile" "$address" 2>/dev/null)
185 # Strip out the base of the path on each line
186 code=$(while read -r line; do echo "${line#$basepath/}"; done <<< "$code")
188 # In the case of inlines, move everything to same line
191 # Demangle if the name looks like a Rust symbol and if
193 if [[ $name =~ ^_R && $cppfilt != "" ]] ; then
194 name=$("$cppfilt" "$cppfilt_opts" "$name")
197 # Replace old address with pretty line numbers
198 symbol="$segment$name ($code)"
208 if [[ $vmlinux_buildid =~ ^[0-9a-f]+ ]]; then
209 vmlinux=$(debuginfod-find debuginfo $vmlinux_buildid)
210 if [[ $? -ne 0 ]] ; then
211 echo "ERROR! vmlinux image not found via debuginfod-find" >&2
217 echo "ERROR! Build ID for vmlinux not found. Try passing -r or specifying vmlinux" >&2
240 read -a words <<<"$1"
247 local last=$(( ${#words[@]} - 1 ))
262 if [[ ${words[$last]} =~ ^[0-9a-f]+\] ]]; then
263 words[$last-1]="${words[$last-1]} ${words[$last]}"
265 last=$(( $last - 1 ))
277 symbol=${words[$last-1]}
278 unset words[$last-1]
289 # Add up the line number to the symbol
293 while read line; do
294 # Let's see if we have an address in the line
295 if [[ $line =~ \[\<([^]]+)\>\] ]] ||
296 [[ $line =~ [^+\ ]+\+0x[0-9a-f]+/0x[0-9a-f]+ ]]; then
297 # Translate address to line numbers
298 handle_line "$line"
299 # Is it a code line?
300 elif [[ $line == *Code:* ]]; then
301 decode_code "$line"
302 # Is it a version line?
303 elif [[ -n $debuginfod && $line =~ PID:\ [0-9]+\ Comm: ]]; then
304 debuginfod_get_vmlinux "$line"
306 # Nothing special in this line, show it as is
307 echo "$line"