[<c0011e0c>] (dump_backtrace+0x0/0x110) from [<c00129a0>] (show_stack+0x18/0x1c) [<c0012988>] (show_stack+0x0/0x1c) from [<c04d5398>] (dump_stack+0x24/0x28) [<c04d5374>] (Drv_XC_IRQ+0x0/0xf3c) from [<c036dee8>] (Drv_XC_Handler+0x10/0x30) [<c036ded8>] (Drv_XC_Handler+0x0/0x30) from [<c007de88>] (irq_thread+0x1c/0x160) [<c007dd7c>] (irq_thread+0x0/0x160) from [<c00448dc>] (kthread+0xcc/0xd0) [<c0044810>] (kthread+0x0/0xd0) from [<c000e5d8>] (ret_from_fock+0x14/0x3c)
functionparse_symbol() { # The structure of symbol at this point is: # [name]+[offset]/[total length] # # For example: # do_basic_setup+0x9c/0xbf
# Strip the symbol name so that we could look it up name=${symbol%+*} #remove '(' name=${name##\(}
# Use 'nm vmlinux' to figure out the base address of said symbol. # It's actually faster to call it every time than to load it # all into bash. base_addr=$(nm $vmlinux | grep " $name\$" | awk {'print $1'})
# Let's start doing the math to get the exact address into the # symbol. First, strip out the symbol total length. expr=${symbol%/*} #remove '(' expr=${expr##\(}
# Now, replace the symbol name with the base address we found # before. expr=${expr/$name/0x$base_addr}
# Evaluate it to find the actual address expr=$((expr))
# Pass it to addr2line to get filename and line number code=`$CMD_Addr2Line -i -e $vmlinux $(printf"%x\n"$expr)`
# Strip out the base of the path code=${code//$basepath\//""} # In the case of inlines, move everything to same line code=${code//$'\n'/' '}
# Replace old address with pretty line numbers symbol=$(echo$symbol"("$code")") }
functionhandle_line() { line="$1"
# Tokenize words=$(echo$line | tr "\r ""\n")
# Remove hex numbers. Do it ourselves until it happens in the # kernel for i in$words; do if [[ $i =~ \[\<([^]]+)\>\] ]]; then line=${line/" $i"/""} fi done
# The symbol is the last element, process it symbol="$i" parse_symbol
# Add up the line number to the symbol line=${line/$i/$symbol} echo"$line" }
whileread line; do # Let's see if we have an address in the line if [[ $line =~ \[\<([^]]+)\>\] ]]; then # Translate address to line numbers handle_line "$line" else # Nothing special in this line, show it as is echo"$line" fi done < $input_log