Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Koneki » userdata types and detail formatter
userdata types and detail formatter [message #1416909] Tue, 28 May 2013 10:48 Go to next message
Marc Haderach is currently offline Marc HaderachFriend
Messages: 4
Registered: May 2013
Junior Member
I am using LDT 0.9 and I have been searching for a way to create bespoke detail formatters for my userdata types.
I use Lua embedded in a C++ program and for performance reasons, my userdata are dictionaries that are passed around as pointers.
The default for LDT is to display a simple string "userdata: xxxx".

I created Lua functions that can convert my userdata into Lua tables, and if I type in the expressions window "my_converter(my_user_data)" I can see my userdata object properly as a table.

Is it possible to create a detail formatter that would by default call the my_converter function?

Thanks a lot.
Re: userdata types and detail formatter [message #1416910 is a reply to message #1416909] Tue, 28 May 2013 12:09 Go to previous messageGo to next message
Marc Aubry is currently offline Marc AubryFriend
Messages: 76
Registered: July 2009
Member
Hi Marc,

I think this topic explain a mechanism that cover your needs : http://www.eclipse.org/forums/index.php/t/476088.
If not, please explain why to go further, thanks.
Re: userdata types and detail formatter [message #1416911 is a reply to message #1416909] Tue, 28 May 2013 19:28 Go to previous messageGo to next message
Julien Desgats is currently offline Julien DesgatsFriend
Messages: 12
Registered: August 2011
Junior Member
To be more precise about the above link, I massively refactored introspection part of the debugger to allow custom inspectors which cover exactly your needs.

Sadly, it is not yet documented: I started a tutorial but it is still WIP :cry:

If all your userdatas share the same metatable and you don't want to modify values from debugger implement it would be quite easy.

First you need the new debugger.lua[1] file, and then plug a simple inspector should look like (untested):


-- regular debugger bootstrap
require"debugger"("localhost", 10000)

-- add your inspector
local introspection = require "debugger.introspection"
introspection.inspectors[my_metatable] = function(name, value, parent, fullname)
-- just inspect your customized table instead of userdata
return introspection.inspect(name, my_converter(value), parent, fullname)
end


Look debugger source[2] for details, or this plugin[3] for LuaJIT cdata for an actual example.

Again, this is still WIP so please report any problem you may encounter.

About value modification from debugger, this is a problem that has not been fully addressed yet. Currently the debugger will set value with something like value["key"] = loadstring(new_value)(), so unless this is possible with your userdata objects, it will fail.

[1] gist.github.com/jdesgats/5383865/raw/56591f94f48a253a821a5610525b402206c3df96/debugger.lua
[2] github.com/jdesgats/org.eclipse.koneki.ldt/blob/newintrospection/libraries/luadbgpclient/debugger/introspection.lua
[3] github.com/jdesgats/org.eclipse.koneki.ldt/blob/newintrospection/libraries/luadbgpclient/debugger/plugins/ffi/init.lua
Re: userdata types and detail formatter [message #1416912 is a reply to message #1416911] Wed, 29 May 2013 11:54 Go to previous message
Marc Haderach is currently offline Marc HaderachFriend
Messages: 4
Registered: May 2013
Junior Member
Hi Marc and Julien

Thanks a lot for your quick replies, they were very useful.
I managed to create my bespoke introspection logic an as currently I don't want to modify them within the debugger, your solution is great.

Thanks again

Marc
Previous Topic:Re: debugger hangs up and windows too
Next Topic:Windows Koneki and Corona first steps setup
Goto Forum:
  


Current Time: Thu Apr 25 07:34:50 GMT 2024

Powered by FUDForum. Page generated in 0.04189 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top