For those worried about binary size, under Linux you can do something
like the following, which builds with the '-g' flag thus has all the
debug information in the object, then extracts the debug info to a
separate file and then strips it from the main object and adds back a
reference to the debug info. That way you have your cake and eat it,
under normal usage you only load the main executable, but if you
attach gdb or similar debugger it will use the debuglink reference to
find the debug symbols. I've got cases where the shared object is like
20K and the separate debug info is 160K, but also cases where is only
shaves of 25% of the combined size depending on situation.

Kevin

In the following case it assumes the debug symbols live alongside the
binary (shared object in this case), thus

foo.so
foo.so.debuginfo

Something like the following (Make syntax)

DEBUGINFOEXT = .debuginfo
CXXFLAGS = -g

%.o: %.cpp
    $(CXX) $(CXXFLAGS) -c -o $@ $<

%.so: %.o
    $(CXX) $(LDFLAGS) -shared -o $@ $< $(LDLIBS)
    objcopy --only-keep-debug $@ $@${DEBUGINFOEXT}
    strip --strip-debug --strip-unneeded $@
    objcopy --add-gnu-debuglink=$@${DEBUGINFOEXT} $@
_______________________________________________
Oiio-dev mailing list
Oiio-dev@lists.openimageio.org
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to