We help IT Professionals succeed at work.
Get Started

Core files: debugging and general confusion!

mrwad99 asked
Last Modified: 2013-12-27
Ah hello

I am completely new to Solaris programming, having come from a heavy windows background, and am trying to understand how to debug core files and how core files work in general.

I am using SunStudio 12 on Solaris 8 (Solaris 8 2/04 s28s_hw4wos_05a SPARC), and have the following very simple source file which generates my crash.

#include <stdlib.h>

int main(int argc, char** argv) {
    int* p = 0;
    *p = 42;
    return (EXIT_SUCCESS);

Open in new window

This is contained in the folder \SunStudioProjects\CrashTest_1, along with the generated Makefile and output folders.  Now, when I build the program in the Debug configuration and run it through the SunStudio IDE, I get the core file generated, and placed in my project directory.  All good so far.  I then tell SunStudio to debug this core file via "Run->Debug Core file...", selecting the core file, leaving the Executable option as <from core> and Project as <no project>.  I then get my source file opened, with the faulting line highlighted.  Great.  Now the questions...

1) When I build and run the release configuration, I get no opening of the source file: instead, DBX tells me

program terminated by signal SEGV (no mapping at the fault address)
0x00010dcc: main+0x0004:        st       %o5, [0]

Open in new window

Why is this, and how can I fix it please?

2) I rename my "build" folder within \SunStudioProjects\CrashTest_1, then debug the core file again.  Surprisingly, I still get my source file opened, correctly identifying the faulting line.  I thought that the object files (contained in this "build" directory) were essential for debugging...where is the source file path being stored?

3) When I build a binary in release mode, and it goes out "into the wild, so to speak" (i.e. is released to the public) what files do I need to keep in order to be able to debug any core dumps that may be generated?

I have put the points @ 300 currently (100/question) but this will go up if I ask follow up questions.

Many thanks in advance.
Watch Question
Principle Software Engineer
This problem has been solved!
Unlock 2 Answers and 21 Comments.
See Answers
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
Ask ANY Question

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

  • Troubleshooting
  • Research
  • Professional Opinions
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