Work around MinGW mangling of "host:/path"
[msysgit/historical-msysgit.git] / mingw / info / stabs / Inheritance.html
blob9be64c7a51a28e7b55834344c843757b43d2dd14
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="Inheritance">Inheritance</a>,
13 Next:<a rel="next" accesskey="n" href="Virtual-Base-Classes.html#Virtual%20Base%20Classes">Virtual Base Classes</a>,
14 Previous:<a rel="previous" accesskey="p" href="Virtual-Methods.html#Virtual%20Methods">Virtual Methods</a>,
15 Up:<a rel="up" accesskey="u" href="Cplusplus.html#Cplusplus">Cplusplus</a>
16 <hr><br>
17 </div>
19 <h3 class="section">Inheritance</h3>
21 <p>Stabs describing C++ derived classes include additional sections that
22 describe the inheritance hierarchy of the class. A derived class stab
23 also encodes the number of base classes. For each base class it tells
24 if the base class is virtual or not, and if the inheritance is private
25 or public. It also gives the offset into the object of the portion of
26 the object corresponding to each base class.
28 <p>This additional information is embedded in the class stab following the
29 number of bytes in the struct. First the number of base classes
30 appears bracketed by an exclamation point and a comma.
32 <p>Then for each base type there repeats a series: a virtual character, a
33 visibility character, a number, a comma, another number, and a
34 semi-colon.
36 <p>The virtual character is <code>1</code> if the base class is virtual and
37 <code>0</code> if not. The visibility character is <code>2</code> if the derivation
38 is public, <code>1</code> if it is protected, and <code>0</code> if it is private.
39 Debuggers should ignore virtual or visibility characters they do not
40 recognize, and assume a reasonable default (such as public and
41 non-virtual) (GDB 4.11 does not, but this should be fixed in the next
42 GDB release).
44 <p>The number following the virtual and visibility characters is the offset
45 from the start of the object to the part of the object pertaining to the
46 base class.
48 <p>After the comma, the second number is a type_descriptor for the base
49 type. Finally a semi-colon ends the series, which repeats for each
50 base class.
52 <p>The source below defines three base classes <code>A</code>, <code>B</code>, and
53 <code>C</code> and the derived class <code>D</code>.
55 <pre class="example"> class A {
56 public:
57 int Adat;
58 virtual int A_virt (int arg) { return arg; };
61 class B {
62 public:
63 int B_dat;
64 virtual int B_virt (int arg) {return arg; };
67 class C {
68 public:
69 int Cdat;
70 virtual int C_virt (int arg) {return arg; };
73 class D : A, virtual B, public C {
74 public:
75 int Ddat;
76 virtual int A_virt (int arg ) { return arg+1; };
77 virtual int B_virt (int arg) { return arg+2; };
78 virtual int C_virt (int arg) { return arg+3; };
79 virtual int D_virt (int arg) { return arg; };
81 </pre>
83 <p>Class stabs similar to the ones described earlier are generated for
84 each base class.
86 <pre class="smallexample"> .stabs "A:T20=s8Adat:1,0,32;$vf20:21=*22=ar1;0;1;17,32;
87 A_virt::23=##1;:i;2A*-2147483647;20;;;~%20;",128,0,0,0
89 .stabs "B:Tt25=s8Bdat:1,0,32;$vf25:21,32;B_virt::26=##1;
90 :i;2A*-2147483647;25;;;~%25;",128,0,0,0
92 .stabs "C:Tt28=s8Cdat:1,0,32;$vf28:21,32;C_virt::29=##1;
93 :i;2A*-2147483647;28;;;~%28;",128,0,0,0
94 </pre>
96 <p>In the stab describing derived class <code>D</code> below, the information about
97 the derivation of this class is encoded as follows.
99 <pre class="display"> .stabs "derived_class_name:symbol_descriptors(struct tag&amp;type)=
100 type_descriptor(struct)struct_bytes(32)!num_bases(3),
101 base_virtual(no)inheritance_public(no)base_offset(0),
102 base_class_type_ref(A);
103 base_virtual(yes)inheritance_public(no)base_offset(NIL),
104 base_class_type_ref(B);
105 base_virtual(no)inheritance_public(yes)base_offset(64),
106 base_class_type_ref(C); ...
107 </pre>
109 <pre class="smallexample"> .stabs "D:Tt31=s32!3,000,20;100,25;0264,28;$vb25:24,128;Ddat:
110 1,160,32;A_virt::32=##1;:i;2A*-2147483647;20;;B_virt:
111 :32:i;2A*-2147483647;25;;C_virt::32:i;2A*-2147483647;
112 28;;D_virt::32:i;2A*-2147483646;31;;;~%20;",128,0,0,0
113 </pre>
115 </body></html>