diff --git a/pykd/customtypes.cpp b/pykd/customtypes.cpp index 32d9351..ee3cb36 100644 --- a/pykd/customtypes.cpp +++ b/pykd/customtypes.cpp @@ -23,9 +23,20 @@ TypeInfoPtr TypeBuilder::createUnion( const std::string &name, ULONG align ) //////////////////////////////////////////////////////////////////////////////// +CustomBase::CustomBase( const std::string &name, ULONG pointerSize, ULONG align ) : + UdtTypeInfoBase( name ) +{ + m_ptrSize = pointerSize; + m_align = align ? align : m_ptrSize; + m_size = 0; +} + +//////////////////////////////////////////////////////////////////////////////// + ULONG CustomBase::getSize() { - return alignUp( m_size, getAlignReq() ); + const ULONG alignReq = getAlignReq(); + return alignUp( m_size, alignReq < m_align ? alignReq : m_align ); } //////////////////////////////////////////////////////////////////////////////// diff --git a/pykd/customtypes.h b/pykd/customtypes.h index 75344fc..879ffea 100644 --- a/pykd/customtypes.h +++ b/pykd/customtypes.h @@ -59,13 +59,7 @@ public: protected: - CustomBase( const std::string &name, ULONG pointerSize, ULONG align ) : - UdtTypeInfoBase( name ) - { - m_ptrSize = pointerSize; - m_align = align ? align : m_ptrSize; - m_size = 0; - } + CustomBase( const std::string &name, ULONG pointerSize, ULONG align ); static ULONG alignUp(ULONG val, ULONG align);