We help IT Professionals succeed at work.

Hoist the colors! We’ve added location flags to usernames sitewide, so it's easier to connect with the global community on EE. View My Profile


Core file analysis

jlargent asked
Last Modified: 2012-08-14
Back in the "old" days, I used to analyze core dumps by printing them out and looking at them.
Now on our Unix system we have processes that core dump and since they were built optimized,
there is no symbolic information so a debugger is not very happy.  At a minimum I like to be able
to extract the location that caused the fault from the core file.  To get these points, you have to
provide a means to get ANY information from a core file produced by an optimized process.  I will
not accept an answer that say build it with debug.  If there is truely no way to extract information
from the core file, then I will withdraw the question.
Watch Question

I find your question somewhat confusing, possibly because I
*think* you are confusing several bits of terminology.  Let
me explain the terms; if you could then explain precisely
which ones apply to your problem, then I think I can help you.

"build with debug" in a Unix environment usually means either
to include a C preprocessor flag like -DDEBUG which turns on
programmer-supplied code (e.g. calls to printf()) that emit
debugging information OR to use the -g flag, which causes the
compiler to embed all kinds of information that debuggers
find useful.

"building optimized" means to supply the -O flag to the
C compiler, which causes various kinds of optimizations
to occur.  Depending on the compiler, this may or may not
interact with the -g flag: there are compilers to which
the expression "-g -O" is meaningful and produces a result
which combines both.

"no symbolic information" is usually the result of having
that information stripped out of the compiled executable at
load time or by programs like "strip" afterwards.  An executable
compiled with/without debugging, or with/without optimization,
may be stripped of its symbolic information: it's an independent
operation that happens last.

So using these terms, could you describe just which ones
apply to your current situation?
Even in optimized code there's symbolic information available for 'ld' the linker.
Maybe I'm a spoiled idiot, but when I use my debugger (running AIX 4.umpty)
it allows me to run the (faulty, but optimized) code and it is able to give me
a stacktrace of 'active; functions at the time the thing crashed ... I know it's
not giving me the _exact_ location, but nevertheless ...

kind regards,

Jos aka jos@and.nl

ps. AFAIK gdb can do the same ...

If your using HPUX, xdb does a great job if you haven't used the strip command. As far as i know you need at least the symbolic information to retrieve some sensible information.

If you just have a core file, using the "freeware" program "coran" (Core Analyzer) can return some global information about the core file.


In response to zonker's comments:
When I say built with debug, I mean the -g flag.  When I say optimized, I mean the -O flag.  The executables have NOT been stripped. To say no symbolic information was probably not completely accurate.  We are using DEC Alpha machines running DEC Unix 4.0
This one is on us!
(Get your first solution completely free - no credit card required)


Ok, I decided to try gdb, but I'm having problems and don't know if it is me or something
else.  I had our sys admin download the latest gdb and install it.  This is what I get:
 gdbnew /socc/Delivery/bin/OSF1V/PageController PageCore
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.16 (alpha-dec-osf4.0), Copyright 1996 Free Software Foundation, Inc...

"/socc/Delivery/bin/OSF1V/PageController": could not open as an executable file: Invalid argument

/users/operator/PageCore: Invalid argument.

Turns out we have gdb on the system from a year or so ago.  When I try that version, I get
gdb /socc/Delivery/bin/OSF1V/PageController -c PageCore
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.16 (alpha-dec-osf3.2), Copyright 1996 Free Software Foundation, Inc...
Core was generated by `PageController'.
Program terminated with signal 11, Segmentation fault.
/usr/shlib/libDirectX.so: No such file or directory.

warning: Hit beginning of text section without finding

warning: enclosing function for address 0x24a56ab0
This warning occurs if you are debugging a function without any symbols
(for example, in a stripped executable).  In that case, you may wish to
increase the size of the search with the `set heuristic-fence-post' command.

Otherwise, you told GDB there was a function where there isn't one, or
(more likely) you have encountered a bug in GDB.
#0  0x24a56ab0 in ?? () from /usr/shlib/libmach.so

We are running DEC Unix 4.0 so the second version probably bombs from that.  But have
you seen the problems of the first version (i.e., invalid argument).  Did my sys admin guy
screw up or is this another result of the "fine" DEC product?

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.