I am getting illegal operand error when I run a program. The program where the crash happens is written in assembly and linked as an object file, so I’m not sure how to use gdb with it. I noticed the fault by trapping the SIGILL signal.I want to get the address of the offending instruction. One method that comes to my mind is to get the last execution context in the signal handler and note down the value of rip register from it. I know that context is passed to signal handlers, but don’t know how.
I am getting illegal operand error when I run a program. The program where
Share
If you do want to follow the signal handler route it is not hard to get the address of the instruction that causes the signal handler to run. When you create your signal handler set the
SA_SIGINFObit in the flags setting. Then when you write your handler it will have access to asiginfo_tstructure that includes the fieldsi_addrwhich is the address of the memory location that triggered the exception.