Difference between revisions of "Debugging any regular t and short names"

From Adobe Open Source Wiki
Jump to: navigation, search
 
 
(2 intermediate revisions by one user not shown)
Line 6: Line 6:
 
|+ any_regular_t
 
|+ any_regular_t
 
|-
 
|-
| colspan="2" | double || double
+
! colspan="2" | double || double
 
|-
 
|-
 
| vtable* || pad (on 32 bit machines) ||  data or data*
 
| vtable* || pad (on 32 bit machines) ||  data or data*
Line 13: Line 13:
  
 
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.
 
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.
 +
 +
{| border="1"
 +
|+ vtable
 +
|-
 +
| 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) -
 +
 +
{| border="1"
 +
|+ 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:
 +
 +
<pre>
 +
namespace my_space {
 +
class my_class { };
 +
} // namespace my_space
 +
 +
ADOBE_SHORT_NAME_TYPE('M','y','C','l', my_space::my_class);
 +
</pre>
 +
 +
Once defined, a short name for a particular type can be referred to using the short_name type function:
 +
 +
<pre>
 +
cout << adobe::short_name<double>::value;
 +
</pre>
 +
 +
The following is a list of the short names for the CEL types defined in ASL:
 +
 +
{| class="wikitable sortable" border="1"
 +
|+ 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:
 +
 +
 +
{| class="wikitable sortable" border="1"
 +
|+ 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
 +
|-
 +
|}

Latest revision as of 22:13, 11 February 2009

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.

any_regular_t
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.

vtable
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);

Once defined, a short name for a particular type can be referred to using the short_name type function:

cout << adobe::short_name<double>::value;

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