When/how to build separate debug symbol files
ken at codeweavers.com
Wed Jun 24 18:26:31 CDT 2015
I'm investigating how to best make Wine build and install debug symbol files on OS X.
My understanding is that, on Linux, the distros usually provide a separate package for a user to install Wine's debug symbols. From recent work in dbghelp, I'm guessing such a package installs debug symbol files next to the corresponding binary or in a .debug subdirectory next to it. Is that correct?
How do packagers generate such separate debug symbol files? Is it a special option (make target?) in Wine's build process? Or is it a post-processing step after Wine is built and installed to a staging directory? How does this interact with stripping during building for the non-debug-symbol, normal Wine package?
For what it's worth, I'm working on make dbghelp support DWARF-2 debug info on OS X <https://bugs.winehq.org/show_bug.cgi?id=22384>. On OS X, the normal link step does not transfer the DWARF-2 debug info from the object files to the file binary. Rather, you have to execute a separate command, dsymutil, to "link" the debug info, but that ends up in a separate file, not the binary.
So, the first part is figuring out when to invoke dsymutil and where to put the debug symbol file. The second part is having dbghelp find that debug symbol file. I think I have a handle on the second part. The first part is what I'm trying to figure out.
The dsymutil depends on references from the linked binary to the original object files from which it was created. Those references are in the STABS info. So, it has to be invoked 1) at a point where those object files are accessible, and 2) before the binary has been stripped of the necessary references.
A problem that may be unique to OS X is how to support debugging when running Wine build from source, either run from the build tree or installed by the user. Since the debug information isn't easily accessible unless the separate dsymutil step was done, we may want to do it at link time, not just at install time. Unfortunately, that largely defeats the point of separating out debug linking from normal linking, which was to save time and disk space.
More information about the wine-devel