On Sat, Dec 17, 2011 at 10:42:00AM -0500, Brian Duffy wrote:
My compiler arguments have always been -g --pkg clutter-1.0 --save-temps ... Actually, I just set a break point in my code and tried to inspect the property value of a clutter object that had been instantiated. It seems that gdb can't read the value of this property at the vala code page level. It can however read the values of variables that I have defined in vala itself (such as a loop counter variables). Someone on stackoverflow recommended I use clutter_actor_get_width(r) where "r" is the name of the clutter Rectangle that had been instantiated. I typed that into the immediate window in monodevelop (using gdb debugger) and that returned my value. I still have not gotten an answer I can understand as to why I can't read property values of clutter objects when I break in my vala code without calling a clutter function. I can print the value out with printf and look at it in the external console but I can't evaluate the value with the debugger. Strange, but thanks for the feedback.
That’s due to the way Vala and GObject work. In C with GObject (which is the default target language of valac) instances are usually represented as opaque stuctures (see eg. [1] for ClutterRectangle), so if you have a rectangle the following C instruction g_print ("%d\n", rectangle->border_width); won’t work as expected. Instead, you have to use an accessor method to retrieve the value assigned to an object property, as in g_print ("%d\n", clutter_rectangle_get_border_width (rectangle)); which will do what you want. You don’t need to do the same for your loop counters because those are “simple” types, so no accessors are involved. Does it seems verbose? It certainly is. Avoiding that verbosity, while still getting pretty much the same performance, is one of the main reasons to use Vala instead of plain C with GObject. [1] http://docs.clutter-project.org/docs/clutter/1.8/ClutterRectangle.html -- Andrea Bolognani <eof kiyuko org> Resistance is futile, you will be garbage collected.
Attachment:
signature.asc
Description: Digital signature