public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Segmentation fault details?
       [not found] ` <ac94cb270808102337i5febf70fkb6d1f27f71cafb34@mail.gmail.com>
@ 2008-08-11  6:55   ` Wang Yi
  2008-08-11  8:35     ` Alan Jenkins
  2008-08-11  8:36     ` Alan Jenkins
  0 siblings, 2 replies; 5+ messages in thread
From: Wang Yi @ 2008-08-11  6:55 UTC (permalink / raw)
  To: linux-kernel

Hi, all!

 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.

 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.

 Thank you.

Leo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Segmentation fault details?
  2008-08-11  6:55   ` Segmentation fault details? Wang Yi
@ 2008-08-11  8:35     ` Alan Jenkins
  2008-08-11  8:36     ` Alan Jenkins
  1 sibling, 0 replies; 5+ messages in thread
From: Alan Jenkins @ 2008-08-11  8:35 UTC (permalink / raw)
  To: linux-kernel

Wang Yi wrote:

> Hi, all!
> 
>  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.
> 
>  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.
> 
>  Thank you.
> 
> Leo

Core dumps.

You might also like to look at Ubuntu's "apport" bug reporting tool.  IIRC
the necessary kernel support is now in mainline.  I believe it provides the
option to dump core by piping it through an arbitrary program.  The aim of
apport is to capture these core dumps, notify the user, and give them the
option to submit it to the Ubuntu developers.

One advantage of this pipe technique is that you don't need to search the
filesystem for core files.  (They're dumped in the current directory, but
you may not know what directory the program was in when it crashed).

Alan


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Segmentation fault details?
  2008-08-11  6:55   ` Segmentation fault details? Wang Yi
  2008-08-11  8:35     ` Alan Jenkins
@ 2008-08-11  8:36     ` Alan Jenkins
  1 sibling, 0 replies; 5+ messages in thread
From: Alan Jenkins @ 2008-08-11  8:36 UTC (permalink / raw)
  To: linux-kernel

Wang Yi wrote:

> Hi, all!
> 
>  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.
> 
>  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.
> 
>  Thank you.
> 
> Leo

Core dumps.

You might also like to look at Ubuntu's "apport" bug reporting tool.  IIRC
the necessary kernel support is now in mainline.  I believe it provides the
option to dump core by piping it through an arbitrary program.  The aim of
apport is to capture these core dumps, notify the user, and give them the
option to submit it to the Ubuntu developers.

One advantage of this last feature is that you don't need to search the
filesystem for core files.  (They're dumped in the current directory, but
you may not know what directory the program was in when it crashed).

Alan


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Segmentation fault details?
       [not found]   ` <aZzxZ-8hH-11@gated-at.bofh.it>
@ 2008-08-23 20:23     ` Bodo Eggert
  2008-08-24  3:26       ` Calvin Walton
  0 siblings, 1 reply; 5+ messages in thread
From: Bodo Eggert @ 2008-08-23 20:23 UTC (permalink / raw)
  To: Wang Yi, linux-kernel

Wang Yi <leonidwang@gmail.com> wrote:

>  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.
> 
>  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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Segmentation fault details?
  2008-08-23 20:23     ` Bodo Eggert
@ 2008-08-24  3:26       ` Calvin Walton
  0 siblings, 0 replies; 5+ messages in thread
From: Calvin Walton @ 2008-08-24  3:26 UTC (permalink / raw)
  To: 7eggert; +Cc: Wang Yi, linux-kernel

On Sat, 2008-08-23 at 22:23 +0200, Bodo Eggert wrote:
> Wang Yi <leonidwang@gmail.com> wrote:
> 
> >  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.
> > 
> >  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.

-- 
Calvin Walton <calvin.walton@gmail.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-08-24  3:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <ac94cb270808102334m1cc2c3a1n45202072d309927c@mail.gmail.com>
     [not found] ` <ac94cb270808102337i5febf70fkb6d1f27f71cafb34@mail.gmail.com>
2008-08-11  6:55   ` Segmentation fault details? Wang Yi
2008-08-11  8:35     ` Alan Jenkins
2008-08-11  8:36     ` Alan Jenkins
     [not found] <aZzy0-8hH-13@gated-at.bofh.it>
     [not found] ` <aZzy0-8hH-15@gated-at.bofh.it>
     [not found]   ` <aZzxZ-8hH-11@gated-at.bofh.it>
2008-08-23 20:23     ` Bodo Eggert
2008-08-24  3:26       ` Calvin Walton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox