This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Core dump information when code is optimized
- From: Michael Snyder <msnyder at vmware dot com>
- To: Lennyk <lennyk430 at gmail dot com>
- Cc: "gdb at sourceware dot org" <gdb at sourceware dot org>
- Date: Thu, 16 Apr 2009 10:01:10 -0700
- Subject: Re: Core dump information when code is optimized
- References: <49E6D676.9000108@gmail.com>
Lennyk wrote:
Hi,
When I compile only with -O1 flag - my core dump information does not
show line number or offset (when a segmentation fault has occurred).
Only when I add the -g flag does the core dump contain line number
information - but the executable's size grows significantly!
Is there a way to get this information with core dump - but maintain the
optimized sized executable?
It is -g that matters, not -O.
-g generates line info. This info goes into your executable, but it
does not increase your memory footprint -- only the size of the file.
In other words this line info is not copied into memory at runtime.
Which means that it also does not appear in the corefile, so your
corefile should not get significantly bigger.