Debugging any regular t and short names

From Adobe Open Source Wiki
Revision as of 22:10, 11 February 2009 by SeanParent (Talk | contribs)

Jump to: navigation, search

Debugging the any_regular_t type can be problematic if you don't know what the data type of the value stored in it is. To make it simpler for to view an any_regular_t in the debugger, release 1.0.41 contains a four character short name for the type which is stored at the top of the vtable.

The structure of an any_regular_t is a pair of doubles, the first word of the first double contains a pointer to a vtable.

double double
vtable* pad (on 32 bit machines) data or data*

The first word of the vtable contains a version number on release builds (currently 1) and a short name (a four character constant) on debug builds.

version or short name
... proc pointers ...

By convention, the four character codes are stored in little endian order (so as to be readable in the debugger when viewing memory) -

short name for adobe::version_1::dictionary_t
'd' 'i' 'c' 't' (remainder of word is zeros on 64 bit machine)

Also by convention, ASL will only use lower case letters in their short names - clients are free to use upper case letters. Note that the short name facility is to aid debugging _only_. it is not intended as a unique name for every type.

You can define a name for your own type using the ADOBE_SHORT_NAME_TYPE() macro in the global scope defined in <adobe/typeinfo.hpp>. For example:

namespace my_space {
class my_class { };
} // namespace my_space

ADOBE_SHORT_NAME_TYPE('M','y','C','l', my_space::my_class);

The following is a list of the short names for the CEL types defined in ASL:

CEL short names
type name
double dble
bool bool
empty_t emty
array_t arry
dictionary_t dict
string_t strg
name_t name

In addition, the following short names are defined though these won't typically appear in an any_regular_t:

short names
type name
string16_t st16
float flot
int int_
short shrt
long long
unsigned int uint
unsigned short ushr
unsigned long ulng
char char
signed char schr
uchar uchr