www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - CodeView questions

ok, Walter and anyone else - I have some questions regarding the 
Codeview data exported by your compiler/linker.

Im new to codeview so I may just be missing some things, so I appologize 
if this doesnt make any sense.

if given the code:

==============================================

class TestClass
{
}

class DerivedClass : TestClass
{
}

class OtherDerivedClass : TestClass
{
}

class SecondDerivedClass : DerivedClass
{
}

==============================================

the following relevent codeview types are produced:

0x1002	struct Object
		field list: 0x0000
		flags: forward ref,
		derivation list: 0x100f

0x1005	struct hellod.TestClass
		field list: 0x1003
		flags:
		derivation list: 0x0000

0x1006	struct TestClass
		field list: 0x0000
		flags: forward ref,
		derivation list: 0x100e

0x1008	struct hellod.DerivedClass
		field list: 0x1007
		flags:
		derivation list: 0x0000

0x1009	struct hellod.OtherDerivedClass
		field list: 0x1007
		flags:
		derivation list: 0x0000

0x100a	struct DerivedClass
		field list: 0x0000
		flags: forward ref,
		derivation list: 0x100d

0x100c	struct hellod.SecondDerivedClass
		field list: 0x100b
		flags:
		derivation list: 0x0000

0x100d	derivation list
	0 - 0x000d

0x100e	derivation list
	0 - 0x0009
	1 - 0x000a

0x100f	derivation list
	0 - 0x0006

==============================================

whats confusing me are the derivation lists - this list contains all 
structs/classes that are directly derived from a given base class

note - all custom codeview types are above 0x1000 so this number is 
added to type indicies to find the actual type

so....

---------------------------------------------------------------
this is a forward ref for TestClass - its derived list looks ok

0x1006	struct TestClass
		field list: 0x0000
		flags: forward ref,
		derivation list: 0x100e

		0x100e	derivation list
			0 - 0x0009
			1 - 0x000a

---------------------------------------------------------------
forward ref for Object class - its derived list looks ok

0x1002	struct Object
		field list: 0x0000
		flags: forward ref,
		derivation list: 0x100f

		0x100f	derivation list
			0 - 0x0006

****************
??  QUESTION  ??
****************

this is a forward reference for a structure named DerivedClass
its derived list should contain: SecondDerivedClass - 0x000c ( for type 
0x100c )
yet it contains 0x000d - which seems to reference the derived list itself

0x100a	struct DerivedClass
		field list: 0x0000
		flags: forward ref,
		derivation list: 0x100d

		0x100d	derivation list
			0 - 0x000d

Ive tried to isolate a strange case here - but Ive seen several problems 
like this regarding the derivation list. it seems the last derivation 
list is 'broken' - or something.

is this a bug? or am i missing something?


I had a few more questions but right now but I cant quite remember them, 
so I will leave it at this...
Oct 05 2005