Search Ali's Blog

Friday, July 30, 2010

objdump parser

If you've been programming in Linux kernel, you must had the chance to debug kernel oops using objdump.
Normally, you invoke objdump with the name of the problematic driver, and then parse the output based on the information printed in the call trace of the kernel oops. Here is a nice example.


Among many hexadecimal numbers and function names that are printed in the call trace of the kernel oops, the most important piece of information is the function name and the offset: for example:
vnic_login_create_2+0xd1


I wrote this script that receives the function name and offset as a pointer, and prints the source file name and line number that caused the oops.


For example:
# objdump_parser.py vnic_login_create_2+0xd1 drivers/net/mlx4_vnic/mlx4_vnic.ko


vnic_login_create_2+0xd1 = 0x6e3 => drivers/net/mlx4_vnic/vnic_data_main.c:210

No comments: