digitalmars.D - Mangled symbols ending with Z?
- Peter Alexander <peter.alexander.au gmail.com> Dec 04 2011
- "Martin Nowak" <dawg dawgfoto.de> Dec 04 2011
- Peter Alexander <peter.alexander.au gmail.com> Dec 04 2011
- "Martin Nowak" <dawg dawgfoto.de> Dec 04 2011
DMD outputs quite a few symbols that end with a Z. For example:
module test;
class Foo {}
Gives me these three symbols (all .data)
00013680 D _D4test4Foo16__initZ
000136e0 D _D4test4Foo16__vtblZ
00013690 D _D4test4Foo17__ClassZ
I have two questions:
1. I know what __init and __vtbl are, but what is __Class?
2. What does the Z at the end mean? The D ABI page doesn't describe this
in its grammar, and indeed std.demangle is unable to demangle these
symbols. It expects a type there, and Z represents no type.
Once I know this, I will fix std.demangle so that it can parse these.
Dec 04 2011
On Sun, 04 Dec 2011 14:40:47 +0100, Peter Alexander <peter.alexander.au gmail.com> wrote:DMD outputs quite a few symbols that end with a Z. For example: module test; class Foo {} Gives me these three symbols (all .data) 00013680 D _D4test4Foo16__initZ 000136e0 D _D4test4Foo16__vtblZ 00013690 D _D4test4Foo17__ClassZ I have two questions: 1. I know what __init and __vtbl are, but what is __Class?
is an instance of TypeInfo_Class.2. What does the Z at the end mean? The D ABI page doesn't describe this in its grammar, and indeed std.demangle is unable to demangle these symbols. It expects a type there, and Z represents no type.
Z is used as terminal element for templates and non-variadic function arguments. You may have a look at dmd/src/tocsym.c to find the ones being used for compiler symbols.Once I know this, I will fix std.demangle so that it can parse these.
Dec 04 2011
On 4/12/11 6:47 PM, Martin Nowak wrote:On Sun, 04 Dec 2011 14:40:47 +0100, Peter Alexander <peter.alexander.au gmail.com> wrote:DMD outputs quite a few symbols that end with a Z. For example: module test; class Foo {} Gives me these three symbols (all .data) 00013680 D _D4test4Foo16__initZ 000136e0 D _D4test4Foo16__vtblZ 00013690 D _D4test4Foo17__ClassZ I have two questions: 1. I know what __init and __vtbl are, but what is __Class?
is an instance of TypeInfo_Class.2. What does the Z at the end mean? The D ABI page doesn't describe this in its grammar, and indeed std.demangle is unable to demangle these symbols. It expects a type there, and Z represents no type.
Z is used as terminal element for templates and non-variadic function arguments. You may have a look at dmd/src/tocsym.c to find the ones being used for compiler symbols.Once I know this, I will fix std.demangle so that it can parse these.
Makes sense. Next question, what should they demangle to? :-) _D4test3Foo6__initZ 1. test.Foo.init 2. test.Foo.__init 3. byte[] test.Foo.init 4. byte[] test.Foo.__init _D4test3Foo6__vtblZ 1. test.Foo.vtbl 2. test.Foo.__vtbl 3. void*[] test.Foo.vtbl 4. void*[] test.Foo.__vtbl _D4test3Foo7__ClassZ 1. test.Foo.classinfo 2. test.Foo.__Class 3. object.TypeInfo_Class test.Foo.classinfo 4. object.TypeInfo_Class test.Foo.__Class ? I would say it should be the third one for all of them. Anyone else want to weigh in on this?
Dec 04 2011
On Sun, 04 Dec 2011 22:09:40 +0100, Peter Alexander <peter.alexander.au gmail.com> wrote:On 4/12/11 6:47 PM, Martin Nowak wrote:On Sun, 04 Dec 2011 14:40:47 +0100, Peter Alexander <peter.alexander.au gmail.com> wrote:DMD outputs quite a few symbols that end with a Z. For example: module test; class Foo {} Gives me these three symbols (all .data) 00013680 D _D4test4Foo16__initZ 000136e0 D _D4test4Foo16__vtblZ 00013690 D _D4test4Foo17__ClassZ I have two questions: 1. I know what __init and __vtbl are, but what is __Class?
is an instance of TypeInfo_Class.2. What does the Z at the end mean? The D ABI page doesn't describe this in its grammar, and indeed std.demangle is unable to demangle these symbols. It expects a type there, and Z represents no type.
Z is used as terminal element for templates and non-variadic function arguments. You may have a look at dmd/src/tocsym.c to find the ones being used for compiler symbols.Once I know this, I will fix std.demangle so that it can parse these.
Makes sense. Next question, what should they demangle to? :-) _D4test3Foo6__initZ 1. test.Foo.init 2. test.Foo.__init 3. byte[] test.Foo.init 4. byte[] test.Foo.__init _D4test3Foo6__vtblZ 1. test.Foo.vtbl 2. test.Foo.__vtbl 3. void*[] test.Foo.vtbl 4. void*[] test.Foo.__vtbl _D4test3Foo7__ClassZ 1. test.Foo.classinfo 2. test.Foo.__Class 3. object.TypeInfo_Class test.Foo.classinfo 4. object.TypeInfo_Class test.Foo.__Class ? I would say it should be the third one for all of them. Anyone else want to weigh in on this?
__init (or typeinit) seems to be a good candidate for the byte[] array in TypeInfo too.
Dec 04 2011









Peter Alexander <peter.alexander.au gmail.com> 