This namespace provides low- and high-level debug function for ALib Boxing.
To shorten custom type names, custom namespaces might be added to vector debug::RemovableNamespaces before invoking a function.
Type Index: | |
struct | DbgStringTable |
Function Index: | |
ALIB_DLL void | DbgCheckIsInitialized () |
ALIB_DLL void | DbgCheckRegistration (detail::VTable *vtable, bool increaseUsageCounter) |
void | DbgRegisterVTable (detail::VTable *vtable, detail::VTable::DbgFactoryType productionType) |
AString | DumpAll () |
void | DumpCustomFunctionHashMapMetrics (AString &target, bool detailedBucketList) |
AString | DumpFunctions (const std::vector< std::pair< const std::type_info *, uinteger > > &input, const String &headline, const String &indent) |
void | dumpFunctions (const std::vector< std::pair< const std::type_info *, uinteger > > &input, AString &output, const String &headline, const String &indent, DbgStringTable< uinteger > &tmpStrings) |
AString | DumpVTables (bool staticVtables, bool includeFunctions) |
void | dumpVTables (AString &result, DbgStringTable< const detail::VTable * > &vtableNames, bool staticVtables, bool includeFunctions) |
ALIB_DLL void | getFunctionTypes (const detail::FunctionTable &input, std::vector< std::pair< const std::type_info *, uinteger > > &output) |
ALIB_DLL std::vector< std::pair< const std::type_info *, uinteger > > | GetKnownFunctionTypes () |
ALIB_DLL std::vector< detail::VTable * > | GetKnownVTables () |
std::vector< std::pair< const std::type_info *, uinteger > > | GetSpecificFunctionTypes (const Box &box) |
std::vector< std::pair< const std::type_info *, uinteger > > | GetSpecificFunctionTypes (const detail::VTable *vtable) |
AString & | removeNamespaces (AString &string, integer startIndex) |
template<typename TBoxable> | |
AString | TypeInfo (const Box &box, const String &headline=A_CHAR("Boxing Information For Boxable Type: "), const String &indent=A_CHAR(" ")) |
template<typename TBoxable> | |
AString | TypeInfo (const String &headline=A_CHAR("Boxing Information For Boxable Type: "), const String &indent=A_CHAR(" ")) |
void | typeInfo (AString &target, const detail::VTable *vtable, const String &indent, bool srcIsPointer, bool srcIsStringType, bool srcIsUnboxableStringType, bool isValueTypeCustomized, bool isPointerTypeCustomized, bool fitsToPlaceholder, bool copyConstructible, bool triviallyDestructible, bool isUnboxable) |
AString | TypeName (const Box &box) |
AString | TypeName (const detail::VTable *vtable) |
void | typeName (const detail::VTable *vtable, AString &result) |
Variable Index: | |
std::vector< alib::String > | RemovableNamespaces |
See function removeNamespaces. Pre-initialized with "alib::". | |
void alib::boxing::debug::DbgCheckIsInitialized | ( | ) |
Checks if ALib Boxing was correctly initialized. This is done with the creation of dynamic vtables, to detect global or static box objects which are initialized with data that is mapped to a type that no static vtable is defined for.
Available and used only in debug-compilations.
Definition at line 1058 of file boxstrap.cpp.
void alib::boxing::debug::DbgCheckRegistration | ( | detail::VTable * | vtable, |
bool | increaseUsageCounter ) |
Checks for doubly-defined vtables, as well as for unregistered static vtables.
Available and used only in debug-compilations.
vtable | The vtable to check. |
increaseUsageCounter | Denotes if this is a use of the vtable or just a check. |
Definition at line 1067 of file boxstrap.cpp.
ALIB_DLL void alib::boxing::debug::DbgRegisterVTable | ( | detail::VTable * | vtable, |
detail::VTable::DbgFactoryType | productionType ) |
Registers a virtual table for debug purposes. This function is invoked internally, when a dynamic vtable is created and when a static vtable is registered.
Statically created vtables have to be registered during bootstrap in debug-compilations. For this, macro ALIB_BOXING_BOOTSTRAP_VTABLE_DBG_REGISTER is available, which is empty in release compilations.
vtable | The vtable to register. |
productionType | Denotes whether the vtable is a static constexpr object or dynamically created from template type VTableUnoptimized. |
Definition at line 43 of file boxing_debug.cpp.
First, lists all mapped types with static, then those with dynamic vtables. Along with each type, its default function implementations are given.
Definition at line 322 of file boxing_format_debug.cpp.
ALIB_DLL void alib::boxing::debug::DumpCustomFunctionHashMapMetrics | ( | AString & | target, |
bool | detailedBucketList ) |
Invokes DbgDumpDistribution on the internal hash table used to register and fetch implementations of custom box-functions.
[out] | target | The target string to write to. |
detailedBucketList | If true is given, for each bucket a line with its size value and a "size bar" is written. |
Definition at line 359 of file boxing_format_debug.cpp.
ALIB_DLL alib::AString alib::boxing::debug::DumpFunctions | ( | const std::vector< std::pair< const std::type_info *, uinteger > > & | input, |
const String & | headline = EMPTY_STRING, | ||
const String & | indent = EMPTY_STRING ) |
Takes a vector of pairs of std::type_info
pointers and a usage counter and returns an AString with a sorted list of type names, including their counter information.
input | A list of types. |
headline | The headline to write. |
indent | Spaces to write before each entry. |
Definition at line 180 of file boxing_format_debug.cpp.
ALIB_DLL void alib::boxing::debug::dumpFunctions | ( | const std::vector< std::pair< const std::type_info *, uinteger > > & | input, |
AString & | output, | ||
const String & | headline, | ||
const String & | indent, | ||
DbgStringTable< uinteger > & | tmpStrings ) |
Helper for (bigger part of) DumpFunctions.
input | A list of types and usage numbers. | |
[out] | output | A string to write to. |
headline | The headline to write. | |
indent | Spaces to write before each entry. | |
tmpStrings | A buffer needed for internal use. |
Definition at line 201 of file boxing_format_debug.cpp.
ALIB_DLL AString alib::boxing::debug::DumpVTables | ( | bool | staticVtables, |
bool | includeFunctions = false ) |
Lists all mapped types with either static or dynamic vtables. Along with each type, its default function implementations are given.
staticVtables | If true , only types with static vtables are listed. Otherwise only those with dynamic vtables. |
includeFunctions | If true for each type, the list of specialized functions are listed. |
Definition at line 237 of file boxing_format_debug.cpp.
ALIB_DLL void alib::boxing::debug::dumpVTables | ( | AString & | target, |
DbgStringTable< const detail::VTable * > & | vtableNames, | ||
bool | staticVtables, | ||
bool | includeFunctions ) |
Internally used by functions DumpVTables and DumpAll.
[out] | target | The target string to write to. |
[out] | vtableNames | Output parameter that receives the strings. |
staticVtables | If true , only types with static vtables are listed. Otherwise only those with dynamic vtables. | |
includeFunctions | If true , For each vtable the list of specialized function is written. |
Definition at line 259 of file boxing_format_debug.cpp.
void alib::boxing::debug::getFunctionTypes | ( | const detail::FunctionTable & | input, |
std::vector< std::pair< const std::type_info *, uinteger > > & | output ) |
Collects all function declarator types of the given box-function table.
input | The function table to use. |
output | The result vector to fill. |
Definition at line 219 of file vtable.cpp.
std::vector< std::pair< const std::type_info *, uinteger > > alib::boxing::debug::GetKnownFunctionTypes | ( | ) |
Returns a vector of std::type_info
objects, representing all function types that either a default or a type specific implementation has been registered for.
A second value in the vector provides the number of invocations of a default implementation. If such is not available, this number is set to std::numeric_limits<uinteger>::max()
.
The list includes the built-in function types.
Definition at line 185 of file vtable.cpp.
std::vector< detail::VTable * > alib::boxing::debug::GetKnownVTables | ( | ) |
Returns all vtable singletons that have been created during program execution so far. One vtable is created for each mapped type used.
Definition at line 159 of file vtable.cpp.
|
inline |
Convenience function: invokes GetSpecificFunctionTypes(const detail::VTable*) with the vtable of the box created or passed with the invocation.
box | A box that the vtable is used of. |
Definition at line 132 of file boxing_debug.inl.
|
inline |
Collects all function declarator types, with type-specific implementations. Parameter vtable might for example be retrieved from a box instance with Box::DbgGetVTable.
vtable | The vtable to get all function implementations for. |
Definition at line 115 of file boxing_debug.inl.
Removes namespaces in the given string. The function is used with all debug-functions that create string values containing type names. Note that custom namespaces might be added to namespace variable debug::RemovableNamespaces before invoking any function.
string | The string to remove the namespace from. |
startIndex | The index within the string to start searching for removable namespaces. |
Definition at line 86 of file boxing_debug.cpp.
AString alib::boxing::debug::TypeInfo | ( | const Box & | box, |
const String & | headline = A_CHAR("Boxing Information For Boxable Type: "), | ||
const String & | indent = A_CHAR(" " ) ) |
Collects necessary information from template type TBoxable and invokes typeInfo.
See function TypeInfo.
TBoxable | The boxable type to investigate in. |
box | A box containing a "sample" of TBoxable.. If this box contains a different type than TBoxable, this function has undefined behavior. |
headline | The headline to write. |
indent | Spaces to write before each entry. |
Definition at line 130 of file boxing_format_debug.inl.
AString alib::boxing::debug::TypeInfo | ( | const String & | headline = A_CHAR( "Boxing Information For Boxable Type: "), |
const String & | indent = A_CHAR( " " ) ) |
Returns human-readable information about the type TBoxable in respect to how boxing objects of this type is performed.
The implementation of this function creates a default value of TBoxable, boxes this and returns the result of TypeInfo(const Box&,const String&,const String&). Hence, for types that are not default constructible, inner function TypeInfo has to be used with an accordingly boxed "sample" of type TBoxable
void*
, which is not customizable anyhow (always boxed as void*
).TBoxable | The boxable type to investigate in. |
headline | The headline to write. |
indent | Spaces to write before each entry. |
Definition at line 194 of file boxing_format_debug.inl.
ALIB_DLL void alib::boxing::debug::typeInfo | ( | AString & | target, |
const detail::VTable * | vtable, | ||
const String & | indent, | ||
bool | srcIsPointer, | ||
bool | srcIsStringType, | ||
bool | srcIsUnboxableStringType, | ||
bool | isValueTypeCustomized, | ||
bool | isPointerTypeCustomized, | ||
bool | fitsToPlaceholder, | ||
bool | copyConstructible, | ||
bool | triviallyDestructible, | ||
bool | isUnboxable ) |
See function TypeInfo, which invokes this function using template parameter TBoxable
[out] | target | The target string. |
vtable | The vtable of the mapped type. | |
indent | Empty or a string of spaces that are alwys preprended before each entry. | |
srcIsPointer | Denotes if TBoxable is a pointer type. | |
srcIsStringType | Denotes if TBoxable is a string-type in the sense that a specialization of the struct ArrayTraits allows implicit access to character array data. | |
srcIsUnboxableStringType | Denotes if TBoxable is a string-type that can, due to a specialization of the struct ArrayTraits be implicitly constructed from character array types. | |
isValueTypeCustomized | Denotes if the value type of TBoxable is customized. | |
isPointerTypeCustomized | Denotes if the pointer type of TBoxable is customized. | |
fitsToPlaceholder | Denotes if the value type of TBoxable would fit to placeholder. | |
copyConstructible | Denotes if the value type of TBoxable is copy constructible. | |
triviallyDestructible | Denotes if the value type of TBoxable is trivially destructible. | |
isUnboxable | Denotes if TBoxable is unboxable. |
Definition at line 47 of file boxing_format_debug.cpp.
Convenience function: invokes TypeName(const detail::VTable*) with the vtable of the box created or passed with the invocation.
box | The box to get the mapped type name for. |
Definition at line 167 of file boxing_debug.inl.
|
inline |
Writes the (demangled) mapped type that the given vtable represents.
vtable | The vtable to get the mapped type name for. |
Definition at line 152 of file boxing_debug.inl.
ALIB_DLL void alib::boxing::debug::typeName | ( | const detail::VTable * | vtable, |
AString & | result ) |
Implementation of TypeName.
vtable | The vtable. | |
[out] | result | The target string to write the type information to. |
Definition at line 103 of file boxing_debug.cpp.
See function removeNamespaces. Pre-initialized with "alib::".
Definition at line 97 of file boxing_debug.cpp.