1 \chapter[Data Object and Object List]{Data Object and Object List Entries}
2 \label{chap:dataobjectandobjectlistentries}
4 This section presents the debugging information entries that
5 describe individual data objects: variables, parameters and
6 constants, and lists of those objects that may be grouped in
7 a single declaration, such as a
8 \livelink{chap:commonblockentry}{common block}.
10 \section{Data Object Entries}
11 \label{chap:dataobjectentries}
12 \addtoindexx{data object entries}
15 \addtoindexx{formal parameter entry}
16 formal parameters and constants are
17 represented by debugging information entries with the tags
18 \DWTAGvariableTARG\addtoindexx{variable entry},
19 \DWTAGformalparameterTARG\addtoindexx{formal parameter entry} and
20 \DWTAGconstantTARG\addtoindexx{constant (data) entry},
23 \textit{The tag \DWTAGconstant{} is used for languages that
24 have true named constants.}
26 The debugging information entry for a program variable,
27 formal parameter or constant may have the following attributes:
28 \begin{enumerate}[1. ]
29 \item A \DWATname{} attribute,
30 \addtoindexx{name attribute}
31 whose value is a null-terminated string containing the data object
32 name as it appears in the source program.
34 If a variable entry describes an anonymous object (for example
35 an \addtoindex{anonymous union}),
36 the name attribute is omitted or its value consists of a single
39 \item A \DWATexternal{} attribute,
40 \hypertarget{chap:DWATexternalexternalvariable}{}
42 \addtoindexx{external attribute}
43 is a \livelink{chap:classflag}{flag}, if the name
44 of a variable is visible outside of its enclosing compilation
47 \textit{The definitions of \addtoindex{C++} static data members
48 of structures or classes are represented by variable entries
49 \nolink{flagged} as external. Both file static and local variables
50 in \addtoindex{C} and \addtoindex{C++} are represented by
51 non-external variable entries.}
53 \item A \DWATdeclaration{} attribute,
54 \addtoindexx{declaration attribute}
55 which is a \livelink{chap:classflag}{flag} that
56 indicates whether this entry represents a non-defining
57 declaration of an object.
59 \item A \DWATlocation{} attribute,
60 \addtoindexx{location attribute}
61 whose value describes the location of a variable or parameter at run-time.
63 If no location attribute is present in a variable
64 entry representing the definition of a variable (that is,
65 \addtoindexx{declaration attribute}
67 \DWATdeclaration{} attribute),
68 or if the location attribute is present but has
69 an empty location description (as described in Section
70 \refersec{chap:locationdescriptions}),
71 \addtoindexx{unallocated variable}
72 the variable is assumed to exist in the source code but not
73 in the executable program (but see number 10, below).
75 In a variable entry representing a non-defining declaration
76 of a variable, the location specified supersedes the location
77 specified by the defining declaration but only within the
78 scope of the variable entry; if no location is specified,
79 then the location specified in the defining declaration
82 \textit{This can occur, for example, for a \addtoindex{C}
83 or \addtoindex{C++} external variable (one that is defined
84 and allocated in another compilation unit) and whose location
85 varies in the current unit due to optimization.}
87 The location of a variable may be further specified with
88 \addtoindexx{segment attribute!and data segment}
89 a \DWATsegment{} attribute, if appropriate.
91 \item A \DWATtype{} attribute describing the type of the variable,
92 constant or formal parameter.
94 \item If the variable entry represents the defining declaration
95 for a C++ static data member of a structure, class or union,
96 the entry has a \DWATspecification{} attribute, whose value is a
97 \livelink{chap:classreference}{reference} to the debugging information entry representing the
98 declaration of this data member. The referenced entry has the
99 tag \DWTAGmember{} and will be a child of some class, structure
102 If the variable entry represents a
103 non-defining declaration, \DWATspecification{} may be used
104 to reference the defining declaration of the variable. If
105 no \DWATspecification{} attribute is present, the defining
106 declaration may be found as a global definition either in the
107 current compilation unit or in another compilation unit with
108 the \DWATexternal{} attribute.
110 Variable entries containing
111 the \DWATspecification{} attribute do not need to duplicate
112 information provided by the declaration entry referenced by
113 the specification attribute. In particular, such variable
114 entries do not need to contain attributes for the name or
115 type of the data member whose definition they
116 % Getting the link target in a good spot is tricky. So putting
117 %this one a little early.
118 \hypertarget{chap:DWATvariableparameternonconstantparameterflag}{}
122 \item A \DWATvariableparameter{}
123 attribute\addtoindexx{variable parameter attribute},
124 which is a \livelink{chap:classflag}{flag},
125 if a formal parameter entry represents a parameter whose
126 value in the calling function may be modified by the callee.
127 The absence of this attribute implies that the parameter\textquoteright s
128 value in the calling function cannot be modified by the callee.
130 \item A \DWATisoptional{} attribute,
131 \hypertarget{chap:DWATisoptionaloptionalparameter}{}
133 \addtoindexx{is optional attribute}
134 is a \livelink{chap:classflag}{flag}, if a
135 parameter entry represents an \addtoindex{optional parameter}.
137 \item A \DWATdefaultvalue{} attribute
138 \addtoindexx{default value attribute}
140 \addtoindexx{formal parameter entry!with default value}
142 \hypertarget{chap:DWATdefaultvaluedefaultvalueofparameter}{}
143 entry. The value of this attribute may be a constant, or a reference to the
144 debugging information entry for a variable, or a reference to a
145 debugging information entry containing a DWARF procedure. If the
146 attribute form is of class constant, that constant is interpreted as
147 a default value of the type of the formal parameter. If the attribute
148 form is of class reference, and the referenced entry is for a
149 variable, the default value of the parameter is the value of the
150 referenced variable. If the reference value is 0, no default value
151 has been specified. Otherwise, the attribute represents an implicit
152 \DWOPcallref{} to the referenced debugging information entry, and
153 the default value of the parameter is the value returned by that
154 DWARF procedure, interpreted as a value of the type of the formal
157 \textit{For a constant form there is no way to
158 express the absence of a default value.}
160 \item A \DWATconstvalue{} attribute
162 \hypertarget{chap:DWATconstvalueconstantobject}{}
163 an entry describing a
164 variable or formal parameter whose value is constant and not
165 represented by an object in the address space of the program,
166 or an entry describing a named constant. (Note that such
167 an entry does not have a location attribute.) The value of
168 this attribute may be a string or any of the constant data
170 as appropriate for the representation
171 of the variable's value. The value is the actual constant
172 value of the variable, represented as it would be on the
175 \textit{One way in which a formal parameter
176 with a constant value and no location can arise is for a
177 formal parameter of an inlined subprogram that corresponds
178 to a constant actual parameter of a call that is inlined.
181 \item A \DWATstartscope{}
182 attribute if the scope of
183 \addtoindexx{start scope attribute}
185 \hypertarget{chap:DWATstartscopeobjectdeclaration}{}
186 object is smaller than (that is, is a subset of the addresses
187 of) the scope most closely enclosing the object. There are
189 \begin{enumerate}[a) ]
190 \item If the scope of the object entry includes all of the
191 containing scope except for a contiguous sequence of bytes at
192 the beginning of that containing scope, then the scope of the
193 object is specified using a value of class constant. If the
194 containing scope is contiguous, the value of this attribute
195 is the offset in bytes of the beginning of the scope for the
196 object from the low PC value of the debugging information
197 entry that defines its scope. If the containing scope
199 (see \refersec{chap:noncontiguousaddressranges})
201 attribute is the offset in bytes of the beginning of the scope
202 for the object from the beginning of the first \addtoindex{range list} entry
203 that is not a base selection entry, a default selection entry or an end-of-list entry.
206 \item Otherwise, the scope of the object is specified using
207 a value of class \livelink{chap:classrangelistptr}{rangelistptr}.
208 This value indicates the
209 beginning of a \addtoindex{range list}
210 (see \ref{chap:noncontiguousaddressranges}).
214 \textit{The scope of a variable may begin somewhere in the middle of
215 a lexical \livelink{chap:lexicalblock}{block} in a language
216 that allows executable code in a
217 \nolink{block} before a variable declaration, or where one declaration
218 containing initialization code may change the scope of a
219 subsequent declaration. For example, in the following \addtoindex{C} code:}
231 \textit{\addtoindex{C} scoping rules require that the value of the variable x
232 assigned to the variable f in the initialization sequence is
233 the value of the global variable x, rather than the local x,
234 because the scope of the local variable x only starts after
235 the full declarator for the local x.}
237 \textit{Due to optimization, the scope of an object may be
238 non-contiguous and require use of a \addtoindex{range list} even when
239 the containing scope is contiguous. Conversely, the scope of
240 an object may not require its own \addtoindex{range list} even when the
241 containing scope is non\dash contiguous.}
243 \item A \DWATendianity{} attribute,
245 \hypertarget{chap:DWATendianityendianityofdata}{}
247 \addtoindexx{endianity attribute}
249 \addtoindexx{big-endian encoding|see{endianity attribute}}
251 the endianity of the object. The value of
252 this attribute specifies an ABI\dash defined
253 byte ordering \addtoindexx{ordering attribute} for
254 the value of the object. If omitted, the default endianity
255 of data for the given type is assumed.
258 and their meaning for this attribute is given in
259 Table \ref{tab:endianityattributevalues}.
262 \caption{Endianity attribute values}
263 \label{tab:endianityattributevalues}
265 \begin{tabular}{l|p{9cm}}
267 Name&Meaning\\ \hline
268 \DWENDdefaultTARG{} & Default endian encoding
269 (equivalent to the \mbox{absence} of a
270 \DWATendianity{} attribute) \\
271 \DWENDbigTARG{} & Big\dash endian encoding \\
272 \DWENDlittleTARG& Little-endian encoding \\
278 These represent the default encoding formats as defined by
279 the target architecture's ABI or processor definition. The
280 exact definition of these formats may differ in subtle ways
281 for different architectures.
284 \item A \DWATconstexpr{} attribute,
286 \hypertarget{chap:DWATconstexprcompiletimeconstantobject}{}
287 is a \CLASSflag, if a
288 variable entry represents a \addtoindex{C++} object declared with the
289 \texttt{constexpr} specifier. This attribute indicates that the
290 variable can be evaluated as a compile\dash time constant.
292 \textit{In \addtoindex{C++},
293 a variable declared with \texttt{constexpr} is implicitly
294 \texttt{const}. Such a variable has a \DWATtype{} attribute
295 whose value is a \CLASSreference{} to a debugging information
296 entry describing a \texttt{const} qualified type.}
298 \item A \DWATlinkagename{} attribute for a
299 variable or constant entry as described in
300 Section \refersec{chap:linkagenames}.
304 \section{Common Block Entries}
305 \label{chap:commonblockentries}
307 \livetargi{chap:fortrancommonblock}{common}{Fortran!common block}
308 \livetargi{chap:commonblockentry}{block}{common block entry}
310 \addtoindexx{Fortran!common block}
311 be described by a debugging information entry with the
312 tag \DWTAGcommonblockTARG.
314 The common \nolink{block}
315 entry has a \DWATname{} attribute
316 \addtoindexx{name attribute}
317 whose value is a null-terminated
318 string containing the
319 \livetargi{chap:commonblockreferenceattribute}{common \nolink{block}}{common block reference attribute}
320 name as it appears in the source program. It may also have a
321 \DWATlinkagename{} attribute as described in
322 Section \refersec{chap:linkagenames}.
324 A common block entry also has a \DWATlocation{} attribute
325 \addtoindexx{location attribute}
326 whose value describes the
327 location of the beginning of the common \nolink{block}.
330 \nolink{block} entry owns debugging information entries describing
331 the variables contained within the common \nolink{block}.
333 \textit{\addtoindex{Fortran} allows each declarer of a common block
334 to independently define its contents; thus, common blocks are not types.}
337 \section{Namelist Entries}
338 \label{chap:namelistentries}
339 \textit{At least one language, Fortran 90, has the concept of a
340 namelist. A namelist is an ordered list of the names of some
341 set of declared objects. The namelist object itself may be used
342 as a replacement for the list of names in various contexts.}
344 A namelist is represented by a debugging information entry
346 tag \DWTAGnamelistTARG.
347 \addtoindexx{namelist entry}
348 If the namelist itself has a
349 name, the namelist entry has a \DWATname{} attribute,
350 \addtoindexx{name attribute}
351 whose value is a null-terminated
352 string containing the namelist\textquoteright{}s
353 name as it appears in the source program.
356 \hypertarget{chap:DWATnamelistitemnamelistitem}{}
357 name that is part of the namelist is represented
358 by a debugging information entry with the tag
359 \DWTAGnamelistitemTARG.
360 Each such entry is a child of the
361 namelist entry, and all of the
362 namelist item entries for a
363 \addtoindexx{namelist item entry}
364 given namelist are ordered as were the list of names they
365 correspond to in the source program.
367 Each namelist item entry contains a
368 \DWATnamelistitem{} attribute
369 \addtoindexx{namelist item attribute}
371 \addtoindexx{namelist item entry}
372 value is a \livelink{chap:classreference}{reference} to the debugging
373 information entry representing the declaration of the item
374 whose name appears in the namelist.