Re: How to redirect "Segmentation fault (core dumped)" to err.txt?

From: Pascal Bourguignon (spam_at_mouse-potato.com)
Date: 12/07/04


Date: 07 Dec 2004 07:00:48 +0100


"Alex Vinokur" <alexvn@big-foot.com> writes:
> $ ( ./a ; true ) 2> err
>
> But 'err' doesn't contain "Segmentation fault (core dumped)".

Of course, what do you expect? the segmentation fault is reported as status!
If you want that message, you should write it like this:

( ./a ; if [ $? = $(( 128 + 11 )) ] ; then \
    echo "Segmentation fault" 1>&2 ; fi ) 2> err

Whether the core was dumped or not would depend on the executable ./a
and how it configured that signal handling.

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
The world will now reboot; don't bother saving your artefacts.


Relevant Pages

  • Re: What happens when your program crashes?
    ... Segmentation fault (core dumped) ... Reading symbols from /lib/ld-linux.so.2...done. ... pcl_DllistSetExecutorFunction(fieldlist, stdout); ...
    (comp.lang.c)
  • Re: sfxload issues.
    ... Red Hat Linux release 7.0 ... > Segmentation fault (core dumped) ... > GDB is free software, covered by the GNU General Public License, and you ...
    (Vuln-Dev)
  • Re: Seg fault with hla 1.99 on Fedora 8 linux
    ... InitDemo's value is Segmentation fault (core dumped) ... warning: core file may not match specified executable file. ...
    (comp.lang.asm.x86)
  • Re: Read line at at time and split up that line
    ... > Now the script is running and running, it gets a segmentation fault ... > at analyzing core dumps. ...
    (comp.unix.shell)
  • TRU64 /bin/chsh overflow
    ... % uname -a ... dbx version 5.1 ... Core file created by program "chsh" ... signal Segmentation fault at ...
    (Vuln-Dev)