Okay, that was enlightening. I certainly am glad that I have some way to investigate the clutter property but I can't help but wonder how hard it would be for gdb to be able to print that value if I can print it right from my vala code to the external console with a simple printf statement. I guess it gets back to the fact that gdb is for debugging C and has no knowledge of the hoops Vala is jumping through to get its printf function to print out the value of that property. I see that as a problem, but not as big a problem as writing my app in C versus Vala ;-)
On Sat, Dec 17, 2011 at 11:18 AM, Andrea Bolognani <[email protected]> wrote: > 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 <[email protected]> > Resistance is futile, you will be garbage collected. > > _______________________________________________ > vala-list mailing list > [email protected] > http://mail.gnome.org/mailman/listinfo/vala-list > > -- Duff
_______________________________________________ vala-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/vala-list
