Update section "MIPS Target Improvements" in the llvm 3.0 release notes.
[oota-llvm.git] / docs / ObjCPropertyDebugInfo.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2                       "http://www.w3.org/TR/html4/strict.dtd">
3 <html>
4 <head>
5   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6   <title>Debugging Information Extension for Objective C Properties</title>
7   <link rel="stylesheet" href="llvm.css" type="text/css">
8 </head>
9 <body>
10
11 <h1>
12   Debugging Information Extension for Objective C Properties
13 </h1>
14
15 <ol>
16   <li><a href="#introduction">Introduction</a></li>
17   <li><a href="#proposal">Proposal</a></li>
18   <li><a href="#newattributes">New DWARF Attributes</a></li>
19   <li><a href="#newconstants">New DWARF Constants</a></li>
20
21 </ol>
22
23 <div class="doc_author">
24   <p>Written by Jim Ingham and Devang Patel </p>
25 </div>
26
27 <!-- *********************************************************************** -->
28 <h2>
29   <a name="introduction">Introduction</a>
30 </h2>
31 <!-- *********************************************************************** -->
32
33 <div>
34 <p>Objective C provides a simpler way to declare and define accessor methods 
35 using declared properties. The language provides features to declare a 
36 property and to let compiler synthesize accessor methods.
37 </p>
38
39 <p>The debugger lets developer inspect Objective C interfaces and their 
40 instance variables and class variables. However, the debugger does not know 
41 anything about the properties defined in Objective C interfaces. The debugger
42 consumes information generated by compiler in DWARF format. The format does 
43 not support encoding of Objective C properties. This proposal describes DWARF
44 extensions to encode Objective C properties, which the debugger can use to let
45 developers inspect Objective C properties.
46 </p>
47
48 </div>
49
50
51 <!-- *********************************************************************** -->
52 <h2>
53   <a name="proposal">Proposal</a>
54 </h2>
55 <!-- *********************************************************************** -->
56
57 <div>
58 <p>Objective C properties are always backed by an instance variable. The 
59 instance variables backing properties are identified using 
60 DW_AT_APPLE_property_name attribute. The instance variables with this 
61 attribute may not have data location attributes. The location of instance 
62 variables is determined by debugger only after consulting Objective C runtime.
63 </p>
64
65 <div class="doc_code">
66 <pre>
67 @interface I1 { 
68   int n2;
69
70
71 @property p1; 
72 @property p2; 
73 @end
74
75 @implementation I1 
76 @synthesize p1; 
77 @synthesize p2 = n2; 
78 @end
79
80
81 TAG_structure_type [7] * 
82   AT_APPLE_runtime_class( 0x10 )
83   AT_name( "I1" )
84   AT_decl_file( "Objc_Property.m" ) 
85   AT_decl_line( 3 )
86
87   TAG_member [8] 
88     AT_name( "p1" )
89     AT_APPLE_property_name(“p1”) 
90     AT_type( {0x00000147} ( int ) )
91
92   TAG_member [8] 
93     AT_name( "n2" )
94     AT_APPLE_property_name(“p2”) 
95     AT_type( {0x00000147} ( int ) )
96 </pre>
97 </div>
98
99 <p> Developers can decorate a property with attributes which are encoded using 
100 DW_AT_APPLE_property_attribute.
101 </p>
102
103 <div class="doc_code">
104 <pre>
105 @property (readonly, nonatomic) int pr;
106
107
108 TAG_member [8] 
109   AT_name(“pr”) 
110   AT_APPLE_property_name(“pr”) 
111   AT_type ( {0x00000147} (int) ) 
112   AT_APPLE_property_attribute (DW_APPLE_PROPERTY_readonly, DW_APPLE_PROPERTY_nonatomic)
113 </pre>
114 </div>
115
116 <p> The setter and getter method names are attached to the property using 
117 DW_AT_APPLE_property_setter and DW_AT_APPLE_property_getter attributes.
118 </p>
119 <div class="doc_code">
120 <pre>
121 @interface I1 
122 @property (setter=myOwnP3Setter:) int p3; 
123 -(void)myOwnP3Setter:(int)a; 
124 @end
125
126 @implementation I1 
127 @synthesize p3;
128 -(void)myOwnP3Setter:(int)a{ } 
129 @end
130
131 0x000003bd: TAG_structure_type [7] * 
132               AT_APPLE_runtime_class( 0x10 )
133               AT_name( "I1" )
134               AT_decl_file( "Objc_Property.m" ) 
135               AT_decl_line( 3 )
136 0x000003f3: TAG_member [8] 
137               AT_name( "p3" ) 
138               AT_APPLE_property_name(“p3”) 
139               AT_APPLE_property_setter(“myOwnP3Setter:”)
140               AT_type( {0x00000147} ( int ) )
141 </pre>
142 </div>
143
144 </div>
145
146 <!-- *********************************************************************** -->
147 <h2>
148   <a name="newattributes">New DWARF Attributes</a>
149 </h2>
150 <!-- *********************************************************************** -->
151
152 <div>
153 <table border="1" cellspacing="0">
154   <tr>
155     <th width=200 >Attribute</th>
156     <th width=200 >Value</th>
157     <th width=200 >Classes</th>
158   </tr>
159   <tr>
160     <td width=200 >DW_AT_APPLE_property_name</td>
161     <td width=200 >0x3fe8</td>
162     <td width=200 >String</td>
163   </tr>
164   <tr>
165     <td width=200 >DW_AT_APPLE_property_getter</td>
166     <td width=200 >0x3fe9</td>
167     <td width=200 >String</td>
168   </tr>
169   <tr>
170     <td width=200 >DW_AT_APPLE_property_setter</td>
171     <td width=200 >0x3fea</td>
172     <td width=200 >String</td>
173   </tr>
174   <tr>
175     <td width=200 >DW_AT_APPLE_property_attribute</td>
176     <td width=200 >0x3feb</td>
177     <td width=200 >Constant</td>
178   </tr>
179 </table>
180
181 </div>
182
183 <!-- *********************************************************************** -->
184 <h2>
185   <a name="newconstants">New DWARF Constants</a>
186 </h2>
187 <!-- *********************************************************************** -->
188
189 <div>
190 <table border="1" cellspacing="0">
191   <tr>
192     <th width=200 >Name</th>
193     <th width=200 >Value</th>
194   </tr>
195   <tr>
196     <td width=200 >DW_AT_APPLE_PROPERTY_readonly</td>
197     <td width=200 >0x1</td>
198   </tr>
199   <tr>
200     <td width=200 >DW_AT_APPLE_PROPERTY_readwrite</td>
201     <td width=200 >0x2</td>
202   </tr>
203   <tr>
204     <td width=200 >DW_AT_APPLE_PROPERTY_assign</td>
205     <td width=200 >0x4</td>
206   </tr>
207   <tr>
208     <td width=200 >DW_AT_APPLE_PROPERTY_retain</td>
209     <td width=200 >0x8</td>
210   </tr>
211   <tr>
212     <td width=200 >DW_AT_APPLE_PROPERTY_copy</td>
213     <td width=200 >0x10</td>
214   </tr>
215   <tr>
216     <td width=200 >DW_AT_APPLE_PROPERTY_nonatomic</td>
217     <td width=200 >0x20</td>
218   </tr>
219 </table>
220
221 </div>
222
223 <!-- *********************************************************************** -->
224
225 <hr>
226 <address>
227   <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
228   src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
229   <a href="http://validator.w3.org/check/referer"><img
230   src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
231
232   <a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
233   Last modified: $Date: 2011-11-14 $
234 </address>
235
236 </body>
237 </html>