PDA

View Full Version : How to find location in code from address



weaver4
14th August 2020, 15:49
I have a program that I get a SEGV fault from. It only happens once in a while on a customer site so connecting to a debugger is not an option.

I have captured the Address of the segmentation fault using segaction.

Is there anyway to use this address to determine where in my code the SEGV occurred?

d_stranz
14th August 2020, 20:37
Is there anyway to use this address to determine where in my code the SEGV occurred?

I don't know how you could use this information. I think the address is an actual memory address, not a relative one, so it would depend on the environment on the customer machine at the time the crash occurred. In addition, the debug vs. release mode memory layouts are likely to be different because of the additional code the compiler and linker add to support debugging.

ChrisW67
15th August 2020, 05:14
I have a program that I get a SEGV fault from.

Linux? Is the program writing a core file on crash? You could possibly use the core file. You may need to set the core file size ulimit greater than zero to get one, and it would probably help if the user was running a debug build
https://unix.stackexchange.com/questions/89933/how-to-view-core-files-for-debugging-purposes-in-linux/202443