Work around MinGW mangling of "host:/path"
[msysgit/historical-msysgit.git] / mingw / info / stabs / Simple-Classes.html
blob53ef40409edb3cc3d721558b3524a16c3bafe9da
1 <html lang="en">
2 <head>
3 <title>STABS</title>
4 <meta http-equiv="Content-Type" content="text/html">
5 <meta name="description" content="STABS">
6 <meta name="generator" content="makeinfo 4.3">
7 <link href="http://www.gnu.org/software/texinfo/" rel="generator-home">
8 </head>
9 <body>
10 <div class="node">
11 <p>
12 Node:<a name="Simple%20Classes">Simple Classes</a>,
13 Next:<a rel="next" accesskey="n" href="Class-Instance.html#Class%20Instance">Class Instance</a>,
14 Previous:<a rel="previous" accesskey="p" href="Basic-Cplusplus-Types.html#Basic%20Cplusplus%20Types">Basic Cplusplus Types</a>,
15 Up:<a rel="up" accesskey="u" href="Cplusplus.html#Cplusplus">Cplusplus</a>
16 <hr><br>
17 </div>
19 <h3 class="section">Simple Class Definition</h3>
21 <p>The stabs describing C++ language features are an extension of the
22 stabs describing C. Stabs representing C++ class types elaborate
23 extensively on the stab format used to describe structure types in C.
24 Stabs representing class type variables look just like stabs
25 representing C language variables.
27 <p>Consider the following very simple class definition.
29 <pre class="example"> class baseA {
30 public:
31 int Adat;
32 int Ameth(int in, char other);
34 </pre>
36 <p>The class <code>baseA</code> is represented by two stabs. The first stab describes
37 the class as a structure type. The second stab describes a structure
38 tag of the class type. Both stabs are of stab type <code>N_LSYM</code>. Since the
39 stab is not located between an <code>N_FUN</code> and an <code>N_LBRAC</code> stab this indicates
40 that the class is defined at file scope. If it were, then the <code>N_LSYM</code>
41 would signify a local variable.
43 <p>A stab describing a C++ class type is similar in format to a stab
44 describing a C struct, with each class member shown as a field in the
45 structure. The part of the struct format describing fields is
46 expanded to include extra information relevant to C++ class members.
47 In addition, if the class has multiple base classes or virtual
48 functions the struct format outside of the field parts is also
49 augmented.
51 <p>In this simple example the field part of the C++ class stab
52 representing member data looks just like the field part of a C struct
53 stab. The section on protections describes how its format is
54 sometimes extended for member data.
56 <p>The field part of a C++ class stab representing a member function
57 differs substantially from the field part of a C struct stab. It
58 still begins with <code>name:</code> but then goes on to define a new type number
59 for the member function, describe its return type, its argument types,
60 its protection level, any qualifiers applied to the method definition,
61 and whether the method is virtual or not. If the method is virtual
62 then the method description goes on to give the vtable index of the
63 method, and the type number of the first base class defining the
64 method.
66 <p>When the field name is a method name it is followed by two colons rather
67 than one. This is followed by a new type definition for the method.
68 This is a number followed by an equal sign and the type of the method.
69 Normally this will be a type declared using the <code>#</code> type
70 descriptor; see <a href="Method-Type-Descriptor.html#Method%20Type%20Descriptor">Method Type Descriptor</a>; static member functions
71 are declared using the <code>f</code> type descriptor instead; see
72 <a href="Function-Types.html#Function%20Types">Function Types</a>.
74 <p>The format of an overloaded operator method name differs from that of
75 other methods. It is <code>op$::</code><var>operator-name</var><code>.</code> where
76 <var>operator-name</var> is the operator name such as <code>+</code> or <code>+=</code>.
77 The name ends with a period, and any characters except the period can
78 occur in the <var>operator-name</var> string.
80 <p>The next part of the method description represents the arguments to the
81 method, preceded by a colon and ending with a semi-colon. The types of
82 the arguments are expressed in the same way argument types are expressed
83 in C++ name mangling. In this example an <code>int</code> and a <code>char</code>
84 map to <code>ic</code>.
86 <p>This is followed by a number, a letter, and an asterisk or period,
87 followed by another semicolon. The number indicates the protections
88 that apply to the member function. Here the 2 means public. The
89 letter encodes any qualifier applied to the method definition. In
90 this case, <code>A</code> means that it is a normal function definition. The dot
91 shows that the method is not virtual. The sections that follow
92 elaborate further on these fields and describe the additional
93 information present for virtual methods.
95 <pre class="display"> .stabs "class_name:sym_desc(type)type_def(20)=type_desc(struct)struct_bytes(4)
96 field_name(Adat):type(int),bit_offset(0),field_bits(32);
98 method_name(Ameth)::type_def(21)=type_desc(method)return_type(int);
99 :arg_types(int char);
100 protection(public)qualifier(normal)virtual(no);;"
101 N_LSYM,NIL,NIL,NIL
102 </pre>
104 <pre class="smallexample"> .stabs "baseA:t20=s4Adat:1,0,32;Ameth::21=##1;:ic;2A.;;",128,0,0,0
106 .stabs "class_name:sym_desc(struct tag)",N_LSYM,NIL,NIL,NIL
108 .stabs "baseA:T20",128,0,0,0
109 </pre>
111 </body></html>