Mapping address to line - Linux
Posted 08-31-2011 at 12:20 AM by hi2arun
Well.. when you write your own kernel module, in the devel stage, chances for bringin down the kernel (panic.. ah sick) are huge.
Oops (pet name for kernel panic) mostly spits lots of martian traces that include stack addresses, registers and its value, EIP, etc.
To know the culprit line that caused panic, decode the address to line as follows:
EIP wud luk like...
Look at the selection in blue color. The word within square brackets is the module name and the word before '+' is the function name.
Now, do objdump for the module:
Search for ip_check and make a note of its address
Letz translate the address to line...
Thatz it! Now you should see the file name and line number where panic happened (most likely).
PS: addr2line can also be used for any linux binaries (ELF)
Oops (pet name for kernel panic) mostly spits lots of martian traces that include stack addresses, registers and its value, EIP, etc.
To know the culprit line that caused panic, decode the address to line as follows:
EIP wud luk like...
Code:
EIP: [] ip_check+0x45a/0x21a [ip_tables] SS:ESP 0049:c098281a
Now, do objdump for the module:
Code:
# objdump -d ip_tables.ko
Quote:
Now, do a simple math:
+ 0x21a = address of the culprit line
+ 0x21a = address of the culprit line
Code:
# addr2line -e ip_tables.ko
Thatz it! Now you should see the file name and line number where panic happened (most likely).
PS: addr2line can also be used for any linux binaries (ELF)
Total Comments 0