5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Xcodeでマップファイル出力を指定する

Last updated at Posted at 2013-12-24

どれがグローバル変数なのかデバッグした時のメモ。

環境

Xcode version 5.0.2

設定

[Build settings] -> [Linking] -> [Other Linker Flags]に以下を追加

-Xlinker -map -Xlinker $(TARGET_TEMP_DIR)/$(PRODUCT_NAME)-MapFile-$(CURRENT_VARIANT)-$(CURRENT_ARCH).txt

PRODUCT_NAMEがfooなら、

~/Library/Developer/Xcode/DerivedData/foo-xxxxxxxxxxx/Build/Intermediates/foo.build/Debug-iphoneos/foo.build/foo-MapFile-normal-armv7.txt

あたりに出てくる。

グローバル変数

.common近辺がグローバル変数。

foo-MapFile-normal-armv7.txt
# Sections:
# Address	Size    	Segment	Section
0x0000B0BC	0x00000300	__TEXT	__text
0x0000B3BC	0x00000084	__TEXT	__stub_helper
0x0000B440	0x000006A6	__TEXT	__objc_methname
0x0000BAE6	0x0000003C	__TEXT	__cstring
0x0000BB22	0x0000003C	__TEXT	__objc_classname
0x0000BB5E	0x0000047F	__TEXT	__objc_methtype
0x0000BFE0	0x00000020	__TEXT	__symbolstub1
0x0000C000	0x00000020	__DATA	__lazy_symbol
0x0000C020	0x00000010	__DATA	__nl_symbol_ptr
0x0000C030	0x00000008	__DATA	__objc_classlist
0x0000C038	0x00000008	__DATA	__objc_protolist
0x0000C040	0x00000008	__DATA	__objc_imageinfo
0x0000C048	0x000004F0	__DATA	__objc_const
0x0000C538	0x0000000C	__DATA	__objc_selrefs
0x0000C544	0x00000004	__DATA	__objc_classrefs
0x0000C548	0x00000004	__DATA	__objc_superrefs
0x0000C54C	0x00000050	__DATA	__objc_data
0x0000C59C	0x00000010	__DATA	__cfstring
0x0000C5AC	0x00000004	__DATA	__objc_ivar
0x0000C5B0	0x00000058	__DATA	__data
0x0000C608	0x00000004	__DATA	__common

# Symbols:
# Address	Size    	File  Name
..
0x0000C608	0x00000004	[  1] _global_var
..
5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?