Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am building an application using g++ 4.3. I am using the with maximum possible optimization level, not using the -g option, and I am stripping symbols after it builds.

If I do NOT strip symbols from my application and libraries, are the core files still useful? (When they are generated when the application crashes.)

Will the core files be useful if I compile my application with maximum possible optimization? (Without -g option and without stripping symbols.)

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Broadly speaking, a core file is a dump of the entire memory used by a process plus the CPU registers state. So, in general, the information you can retrieve from a core file is the same that you could get by attaching a debugger to the process just before it crashed.

If I do not strip symbols from my application and libraries, are the core files still useful?

From the Wikipedia page Core dump:

``On modern Unix-like operating systems, administrators and programmers can read core dump files using the GNU Binutils Binary File Descriptor library (BFD), [...] This library will supply the raw data for a given address in a memory region from a core dump; it does not know anything about variables or data structures in that memory region, so the application using the library to read the core dump will have to determine the addresses of variables and determine the layout of data structures itself, for example by using the symbol table for the program undergoing debugging.''

So the answer to your first question is: no, core dump files are of little use if you strip symbols away from the executable.

However, symbols just take up some disk space and do not otherwise affect performance: you can compile with maximum optimization and -g at the same time.

Will the core files be useful if I compile my application with maximum possible optimization?

Since a core file is just a dump of the memory and the processor state when your application crashed, the general warning about optimization and debugging applies: a debugger will only find information (e.g., the value of a variable, or a function call in a stack backtrace) if it wasn't optimized out.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.