core file

Antonio Corbi acorbi at ggmail.xml
Mon Nov 13 10:01:58 UTC 2017


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


More information about the Digitalmars-d-learn mailing list