Jump to content
  • entries
    943
  • comments
    5,899
  • views
    923,744

Lua and C++ Debugger


Josh

2,995 views

 Share

The C++ object debugger for Lua is working now. It was a little tricky, but I implemented a method to view all members of C++ objects. The debugger does handle dynamic object fetching, so if you expand a node in the debug tree representing a C++ object, the contents of that object will be loaded and displayed. Let's say you have an entity parented to another entity. This allows you to expand the parent member of the child, then find the child in the parent's child list, and so on, ad infinitum.

blogentry-1-0-11597000-1306972129_thumb.jpg

 

If you're interested in how this works internally, every class in LE3 is derived from a base class called "Object". The Object class has a virtual function called Debug() which returns a string in a format like the following:

entity={position={x=0,y=0,z=0},rotation={x=0,y=0,z=0},scale={x=1,y=1,z=1},parent=0x00fh7fC}

 

This is read by the debugger and used to create more readable nodes in the debug tree. The hex address listed for all pointers can be compared to values in C++ or another language, if needed. Classes that are used as direct objects, like math classes, and, well,. nothing else, simply output their data like this:

v={0.0,0.0,0.0}

 

Hard to explain, but easy to understand when you just look at the debugger.

 Share

2 Comments


Recommended Comments

Arrgh... Josh.

You are a devil teasing us with goodies from the future.

How are we supposed to survive until we can lay our hands on all the news.

 

Just joking.

Thanks for the updates

Link to comment

Yeah, it's a weird time right now. I'm making a lot of progress, but the finished LE3 is still miles away. This has sort of taught me why software companies usually keep adding to their existing product until they become totally unmanagable, rather than starting new IP. There never really comes a time where starting something new is profitable in the short-term, so it just keeps getting put off.

Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...