I know you can build an application on Linux without -g, and then later debug a corefile from the application with a binary from the same code but built with -g (all other options being the same). If the nm output is identical then the symbols match up and you can effectively analyze a corefile.
However, while I have been successful doing this on Linux, I have not been able to get this to work for Solaris. I build with -xO4, so maybe the optimization level is not supported by -g? I also tried -g0 and that did not work either. The nm file is vastly different. I am also building with -xs. Should I build without -xs instead?
Before I try to analyze this further, has anyone been able to get this to work?
To be clear, this is an issue of building and using debug libraries after the fact. This is possible with Linux if you build with -g and everything else the same (-O3), but I cannot get it to work with our Solaris build, which uses -xO4.
This is not an issue of getting the system libraries to match up, because I already have a copy of the system libraries from our customer and they match up fine. It is our libraries that do not match up when built with debug symbols (-g0). When we don't use -g0 our symbols match up fine but we cannot debug into the source level and get local and global variable values.