Re: Source file names in binary
Re: Source file names in binary
- Subject: Re: Source file names in binary
- From: Duncan Wilcox <email@hidden>
- Date: Mon, 11 Jul 2005 23:39:21 +0200
If you look at /usr/include/assert.h, it indicates that when NDEBUG
is defined, assert(e) will be defined as ((void)0). If NDEBUG is
not defined, then assert(e) becomes a call to __assert() which
includes the __FILE__ and __LINE__ where the assert() function is
called.
In other words, if it is assert that is adding your file names,
then try making sure that NDEBUG is defined for the preprocessor of
the compile. Stripping wouldn't remove it because once it's
compiled, it is a static character array, not a function name.
Thanks, as I mentioned in the first message I know about __FILE__
generating a constant string, specifically I'm not using assert (I
have a look alike), and nothing else uses __FILE__.
Regarding TextEdit, nothing appears to be using assert or __FILE__
there either.
Perhaps I made some progress but I don't really understand what's
going on. I build the TextEdit sample code with "xcodebuild -
configuration Deployment". I still see most of the sources:
$ strings TextEdit | grep \\.m
/Users/duncan/Desktop/TextEdit copy/Document.m
/Users/duncan/Desktop/TextEdit copy/DocumentReadWrite.m
/Users/duncan/Desktop/TextEdit copy/Controller.m
/Users/duncan/Desktop/TextEdit copy/ScalingScrollView.m
/Users/duncan/Desktop/TextEdit copy/MultiplePageView.m
/Users/duncan/Desktop/TextEdit copy/Preferences.m
/Users/duncan/Desktop/TextEdit copy/EncodingManager.m
The missing one is Edit_main.m, that doesn't contain an object
implementation. Trying to figure out a bit more, the following seems
to confirm that I have a source file name in a static string section:
$ otool -v -s __TEXT __cstring TextEdit | grep duncan
0001e640 /Users/duncan/Desktop/TextEdit copy/Document.m
0001f778 /Users/duncan/Desktop/TextEdit copy/DocumentReadWrite.m
0001fd50 /Users/duncan/Desktop/TextEdit copy/Controller.m
00020180 /Users/duncan/Desktop/TextEdit copy/ScalingScrollView.m
00020428 /Users/duncan/Desktop/TextEdit copy/MultiplePageView.m
00020a2c /Users/duncan/Desktop/TextEdit copy/Preferences.m
00020d00 /Users/duncan/Desktop/TextEdit copy/EncodingManager.m
00020e08 @(#)PROGRAM:TextEdit PROJECT:TextEdit-220
DEVELOPER:duncan BUILT:Jul 11 2005 23:00:24\n
How did it get there? I grab one of the gcc build lines and replace -
pipe with --save-temps, like:
/usr/bin/gcc-4.0 -x objective-c -arch ppc --save-temps -Wno-trigraphs
-fpascal-strings -fasm-blocks -Os -fmessage-length=0 -mtune=G4 -
fvisibility=hidden -I/Users/duncan/buildfiles/TextEdit.build/
Deployment/TextEdit.build/TextEdit.hmap -Wmost -Wno-four-char-
constants -Wno-unknown-pragmas -mdynamic-no-pic -F/Users/duncan/
Desktop/buildfiles/Deployment -I/Users/duncan/buildfiles/Deployment/
include -I/System/Library/Frameworks/Carbon.framework/Libraries/
CIncludes -I/Users/duncan/buildfiles/TextEdit.build/Deployment/
TextEdit.build/DerivedSources -c "/Users/duncan/Desktop/TextEdit copy/
EncodingManager.m" -o /Users/duncan/buildfiles/TextEdit.build/
Deployment/TextEdit.build/Objects-normal/ppc/EncodingManager.o
I now have an EncodingManager.s, where I find:
L_OBJC_CLASS_NAME_6:
.ascii "/Users/duncan/Desktop/TextEdit copy/EncodingManager.m
\0"
.align 2
which is referenced elsewhere in the same file:
L_OBJC_MODULES:
.long 6
.long 16
.long L_OBJC_CLASS_NAME_6
.long L_OBJC_SYMBOLS
.objc_message_refs
.align 2
Now I'm completely lost. I don't know what L_OBJC_MODULES is used
for, nor why it would need the source file name.
Building with gcc3.3 doesn't generate the source file names, so it
looks like it's some gcc4 feature, for what it's worth. It also
explains why a lot of Cocoa software found on the net doesn't contain
source file names in the binary.
Can it be disabled somehow? Is it debugging info that I don't
disable? Is this a bug I should file?
Duncan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden