How to neutralize "Failed to open OSO" and force download "o" s:
Disclaimer: you must not do this :)
As explained earlier , error messages tell you that your debug information is incorrect for your dylib.
However, if for some exotic reason you think that your โoโ files, painted, although they may be with bad time stamps, do contain the correct information, and you need them to load in gdb, then continue .. .
For the sample code below, I am assuming an o file named abcdefg.o
and dylib named lib_jklmnop.dylib
Step one. Run this command:
nm -ap lib_jklmnop.dylib | grep OSO | awk '{printf("%s %s\n", toupper($1), $0 )}'
The output should contain:
00000000560D902C 00000000560d902c - 03 0001 OSO /some/file/path/abcdefg.o
Note: you should find the output line with "abcdefg.o" in it. We fix the OSO warning for only one file: abcdefg.o, therefore, if you do not use the timestamp corresponding to this file, then the following steps are meaningless.
Step Two Take the hexadecimal number in the first column (560D902C in this example) and execute it through python as follows:
echo import datetime\; t=datetime.datetime.fromtimestamp\( 0x560D902C \) \; print \( t.strftime\(\'%Y%m%d%H%M.%S\'\) \) | python3
(You can use perl or something else for this step. Python seemed accessible and portable for demo purposes.) The above will take "0x560D902C" and create a formatted timestamp: 201510011257.32
Step 3 .. Using the formatted timestamp obtained from step 2, run the touch
command to change the timestamp to abcdefg.o:
touch -t 201510011257.32 abcdefg.o
Now the timestamp on "o" corresponds to the OSO entry in dylib. GDB will load this file "o".
(For posterity: tested on Mac OS X 10.8.5 with GNU gdb 6.3.50-20050815 Apple version gdb-1824)
Recommended reading:
Apple DWARF Debugging Scheme
Bugzilla @Mozilla - GDB complains about .o files having a newer timestamp than the executable