LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Blogs > hi2arun
User Name
Password

Notices


Rate this Entry

Mapping address to line - Linux

Posted 08-31-2011 at 12:20 AM by hi2arun
Tags debug, kernel, panic

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...
Code:
EIP: [] ip_check+0x45a/0x21a [ip_tables] SS:ESP 0049:c098281a
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:
Code:
# objdump -d ip_tables.ko
Search for ip_check and make a note of its address
Quote:
Now, do a simple math:
+ 0x21a = address of the culprit line
Letz translate the address to 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)
Posted in Uncategorized
Views 2233 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 10:38 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration