Skip to contentSkip to conversation

Segmentation fault details?

DISCUSSION Bodo Eggert 2 participants 2 messages Aug 23, 2008 – Aug 24, 2008 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 9 lines · Wang Yi

I'd like to know some details about segmentation fault. What I mean is when a program accesses invalid memory area, it will
get a SIGSEGV signal from kernel, and a message "Segmentation fault".

I also find that dmesg can show we something like this:
ProgramName[Pid]: segfault at xxxx eip xxxx esp xxxx error x It is useful and provides the first-step information for further
debug/analysis.

Quoted 4 lines

My question is how dmesg gets the information, and if there are any
"decent" way to get this and maybe more information(An "indecent" way I came to is grep dmesg)
so that I can perform some basic auto analysis.

I'm wondering if the default handler might print this information isntead of the plain segmentation violation.

#4 lore raw
Quoted 11 lines · Bodo Eggert
Quoted 9 lines · Wang Yi

I'd like to know some details about segmentation fault. What I mean is when a program accesses invalid memory area, it will
get a SIGSEGV signal from kernel, and a message "Segmentation fault".

I also find that dmesg can show we something like this:
ProgramName[Pid]: segfault at xxxx eip xxxx esp xxxx error x It is useful and provides the first-step information for further
debug/analysis.

Quoted 7 lines
Quoted 4 lines

My question is how dmesg gets the information, and if there are any
"decent" way to get this and maybe more information(An "indecent" way I came to is grep dmesg)
so that I can perform some basic auto analysis.

I'm wondering if the default handler might print this information isntead of the plain segmentation violation.

If you want to debug a segfaulting user-space program, there's a somewhat better way to get this information (and a whole lot more info, too...), and it's been around in various unixes for ages: core dumps (core files).

Unfortunately (but given the state of modern linux desktop programs, understandably), most current linux distributions ship with core dumps turned off. But it isn't too hard to turn them back on if you have a segfaulting program that you want to debug.

Signature · 1 line
Calvin Walton <[email protected]>