www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - core file

reply Tony <tonytdominguez aol.com> writes:
I am getting the message from my program execution:

"Segmentation fault (core dumped)"

But I don't see a core file in the current directory or in my 
home directory. Is there one somewhere? Would I be able to do 
anything meaningful with it if it exists?
Nov 12
parent reply codephantom <me noyb.com> writes:
On Monday, 13 November 2017 at 05:01:18 UTC, Tony wrote:
 I am getting the message from my program execution:

 "Segmentation fault (core dumped)"

 But I don't see a core file in the current directory or in my 
 home directory. Is there one somewhere? Would I be able to do 
 anything meaningful with it if it exists?
More info than that is needed. What platform are you on? Do you have core dumps enabled/disabled? If you have it enabled...where does it put them? And yes, core dumps are potentially useful for debugging. However, given you're asking that question, and getting core dumps, then it might be easier for you to use the -g option when you compile, and then run your executable (or a.out) through a debugger: https://www.youtube.com/watch?v=vcVmWbYEIsk
Nov 12
parent reply Tony <tonytdominguez aol.com> writes:
On Monday, 13 November 2017 at 05:37:12 UTC, codephantom wrote:
 On Monday, 13 November 2017 at 05:01:18 UTC, Tony wrote:
 I am getting the message from my program execution:

 "Segmentation fault (core dumped)"

 But I don't see a core file in the current directory or in my 
 home directory. Is there one somewhere? Would I be able to do 
 anything meaningful with it if it exists?
More info than that is needed. What platform are you on? Do you have core dumps enabled/disabled? If you have it enabled...where does it put them? And yes, core dumps are potentially useful for debugging. However, given you're asking that question, and getting core dumps, then it might be easier for you to use the -g option when you compile, and then run your executable (or a.out) through a debugger: https://www.youtube.com/watch?v=vcVmWbYEIsk
I am on Ubuntu 16.04. Thanks, I didn't know that "producing a core file" was configurable, and it appears that it isn't.
Nov 12
next sibling parent reply =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
On 11/12/2017 10:25 PM, Tony wrote:

 "Segmentation fault (core dumped)"
I've been assuming that if it says "dumped", the core is dumped.
 I am on Ubuntu 16.04. Thanks, I didn't know that "producing a core file"
 was configurable, and it appears that it isn't.
It is. If you search for "where is core file ubuntu" you will hit the output of 'man core', as well as answers like the following, which explains that the file may be under /var/cache/abrt: https://stackoverflow.com/questions/2065912/core-dumped-but-core-file-is-not-in-current-directory Ali
Nov 12
next sibling parent Tony <tonytdominguez aol.com> writes:
On Monday, 13 November 2017 at 07:38:14 UTC, Ali Çehreli wrote:
 On 11/12/2017 10:25 PM, Tony wrote:

 "Segmentation fault (core dumped)"
I've been assuming that if it says "dumped", the core is dumped.
 I am on Ubuntu 16.04. Thanks, I didn't know that "producing a
core file"
 was configurable, and it appears that it isn't.
It is. If you search for "where is core file ubuntu" you will hit the output of 'man core', as well as answers like the following, which explains that the file may be under /var/cache/abrt: https://stackoverflow.com/questions/2065912/core-dumped-but-core-file-is-not-in-current-directory Ali
My mistake. When I said "and it isn't", I was trying to say "and it isn't set on my system as shown by 'ulimit -a'".
Nov 13
prev sibling parent Tony <tonytdominguez aol.com> writes:
On Monday, 13 November 2017 at 07:38:14 UTC, Ali Çehreli wrote:

 It is. If you search for "where is core file ubuntu" you will 
 hit the output of 'man core', as well as answers like the 
 following, which explains that the file may be under 
 /var/cache/abrt:


 https://stackoverflow.com/questions/2065912/core-dumped-but-core-file-is-not-in-current-directory
Thanks for the "man core" tip and the link.
Nov 13
prev sibling parent reply codephantom <me noyb.com> writes:
On Monday, 13 November 2017 at 06:25:20 UTC, Tony wrote:
 I am on Ubuntu 16.04. Thanks, I didn't know that "producing a 
 core file" was configurable, and it appears that it isn't.
ok. that's because Ubuntu is not (by default) setup for developers. But you can enable core dump for your executable easily enough. e.g, if you out file is a.out, then do this: ulimit -S -c unlimited a.out (now run your program, and you'll get core file in the same dir where the program is) (this won't be remembered after a reboot, so just do it when/as required). You can view the core file using > objdump -s core Good luck understanding the contents of that ;-) Core dumps typically require some specialised expertise to analyse. Unless you're one of those specialists, then better to just run your a.out through the debugger, and forget about the core dump (until you can't) ;-)
Nov 13
parent Antonio Corbi <acorbi ggmail.xml> writes:
On Monday, 13 November 2017 at 09:49:29 UTC, codephantom wrote:
 On Monday, 13 November 2017 at 06:25:20 UTC, Tony wrote:
 I am on Ubuntu 16.04. Thanks, I didn't know that "producing a 
 core file" was configurable, and it appears that it isn't.
ok. that's because Ubuntu is not (by default) setup for developers. But you can enable core dump for your executable easily enough. e.g, if you out file is a.out, then do this: ulimit -S -c unlimited a.out (now run your program, and you'll get core file in the same dir where the program is) (this won't be remembered after a reboot, so just do it when/as required). You can view the core file using > objdump -s core Good luck understanding the contents of that ;-) Core dumps typically require some specialised expertise to analyse. Unless you're one of those specialists, then better to just run your a.out through the debugger, and forget about the core dump (until you can't) ;-)
Hi, core files can be used to do a 'post-mortem' debug session with gdb, from 'man gdb': You can also start with both an executable program and a core file specified: gdb program core If your program is compiled with '-g' option, gdb will load the executable and extract the information from the core file and it will show your program's state exactly as if it had been run from the debugger and had failed in that exactly moment. Antonio
Nov 13