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?
Finding EIP
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Finding EIP
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.
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.
Re:Finding EIP
addr2line -e exename works, too. Type in an address, it gives you the file and line information.