[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: core dumps



> >> Hi,
> >> I'd like to know how to find which program produced a particular core
> >> dump file, any idea?
> >
> > ,----
> >
> > | (debian-unstable)jtocancipa@golem:~$ ulimit -c unlimited
> > |
> > | (debian-unstable)jtocancipa@golem:~$ echo "
> > | #include <stdio.h>
> > |
> > | int main ()
> > | {
> > |   char * foo = 0;
> > |   *foo = 'bar';
> > |
> > |   return 0;
> > | }
> > |
> > | " | gcc -xc -o baz -
> > |
> > | (debian-unstable)jtocancipa@golem:~$ ./baz
> > | Segmentation fault (core dumped)
> > |
> > | (debian-unstable)jtocancipa@golem:~$ gdb -batch -c ./core | grep -i
> > | generated Core was generated by `./baz'.
> >
> > `----
> >
> > HTH,
>
> May I suggest using the 'file' command?
>
> $ baz
> Segmentation fault (core dumped)
> $ ls
> baz  core
> $ file core
> core: ELF 32-bit LSB core file Intel 80386, version 1 (SYSV),
> SVR4-style, from 'baz'

Strangely, it doesn't work on my system:

omer@pc-cedric:~$ file core
core: ELF 32-bit LSB core file Intel 80386, version 1 (SYSV), SVR4-style

But gdb -batch did the trick, thanks!

-- 
Cédric Lucantis



Reply to: