Finding EIP

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
_krisp

Finding EIP

Post by _krisp »

Hi,

I am getting some errors in bochs and I was wondering how I can use the EIP information where it crashed to find out where in the source it points to Is this possible using objump?
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Finding EIP

Post by Pype.Clicker »

yes, you can of course use objdump to know where which function stands. However, i find it easier to ask the linker to generate a map of your kernel (add -Map kernel.map in the linker command line if you're using LD :) ), especially when the kernel is made up of several .o files (to identify which .o file is responsible for the error)

Once you got the faulty .o, what you can do is objdump -drS <file.o> | less and look for the faulty offset (that you must compute with eip-file.o.start)

'-d' is for disassemble, -r for 'show relocations' and -S for 'interleave with sources'

Make sure to also know the value of general registers. This will definitely help finding out what's wrong.
Tim

Re:Finding EIP

Post by Tim »

addr2line -e exename works, too. Type in an address, it gives you the file and line information.
Post Reply