Sign in to follow this  
FDsagizi

Debugging scripts - type id is asTYPEID_OBJHANDLE.

Recommended Posts

FDsagizi    514
[font="arial, sans-serif"][size="2"]Hi[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]everyone[/size][/font][font="arial, sans-serif"][size="2"]![/size][/font]
[font="arial, sans-serif"][size="2"]I'm[/size][size=2] [/size][/font][font="arial, sans-serif"][size="2"]doing[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]a debugger[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]scripts[/size][/font][font="arial, sans-serif"][size="2"], and[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]I have a question[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]- how to[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]work[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]with [/size][/font][font="arial, sans-serif"][size="2"][b]asTYPEID_OBJHANDLE [/b][/size][/font][font="arial, sans-serif"][size="2"]?[/size][/font]

[font="arial, sans-serif"][size="2"]how do you know[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]what[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]it is![/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]=[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"][b]null[/b][/size][/font]

[font="arial, sans-serif"][size="2"]and how[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]to get[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="3"][b]asIScriptObject [/b](ie,[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]all[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]properties[/size][/font][font="arial, sans-serif"] [/font][font="arial, sans-serif"][size="2"]of the object[/size][/font][font="arial, sans-serif"][size="2"])[/size][/font][font="arial, sans-serif"][size="2"]?[/size][/font]

Share this post


Link to post
Share on other sites
WitchLord    4678
[code]
void *ptr = ctx->GetAddressOfVar(n);
int typeId = ctx->GetVarTypeId(n);
asIScriptObject *scriptObj = 0;

if( typeId & asTYPEID_OBJHANDLE )
{
// The variable is an object handle, i.e. a pointer. Get the address to the actual object
ptr = *(void**)ptr;
}

if( typeId & asTYPEID_SCRIPTOBJECT )
{
scriptObj = (asIScriptObject*)ptr;
}

if( scriptObj )
{
for( int p = 0; p < scriptObj->GetPropertyCount(); p++ )
{
void *ptr = scriptObj->GetAddressOfProperty(p);
int typeId = scriptObj->GetPropertyTypeId(p);

// Recursively interpret the property just as is done with the variable above
}
}
[/code]

You may also be interested in having a look at the [url="https://angelscript.svn.sourceforge.net/svnroot/angelscript/trunk/sdk/add_on/debugger/"]CDebugger[/url] add-on that I'm implementing for the next release of AngelScript. It's not done yet, but I've already implemented much of what you're probably doing for your own debugger.

Regards,
Andreas

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this