Loud ramblings of a Software Artisan

Thursday 27 March 2008

Gtk HelloWorld

No I won't be presenting a Gtk+ HelloWorld, but just the valgrind output of one. It actually does not matter what program.

==28869== Syscall param rt_sigaction(act->sa_mask) points to uninitialised byte(s)
==28869==    at 0x40007F2: (within /lib/ld-2.6.1.so)
==28869==    by 0x483A7A2: sigaction (in /lib/libpthread-2.6.1.so)
==28869==    by 0x5562321: google_breakpad::ExceptionHandler::SetupHandler(int) (in /usr/lib/gtk-2.0/modules/libgnomebreakpad.so)
==28869==    by 0x556242D: google_breakpad::ExceptionHandler::SetupHandler() (in /usr/lib/gtk-2.0/modules/libgnomebreakpad.so)
==28869==    by 0x55626D7: google_breakpad::ExceptionHandler::ExceptionHandler(std::string const&, bool (*)(void*), bool (*)(char const*, char const*, void*, bool), void*, bool) (in /usr/lib/gtk-2.0/modules/libgnomebreakpad.so)
==28869==    by 0x5561DE2: gtk_module_init (in /usr/lib/gtk-2.0/modules/libgnomebreakpad.so)
==28869==    by 0x41AB1EC: (within /usr/lib/libgtk-x11-2.0.so.0.1200.0)
==28869==    by 0x46472E9: g_cclosure_marshal_VOID__PARAM (in /usr/lib/libgobject-2.0.so.0.1400.1)
==28869==    by 0x463A918: g_closure_invoke (in /usr/lib/libgobject-2.0.so.0.1400.1)
==28869==    by 0x464D9EC: (within /usr/lib/libgobject-2.0.so.0.1400.1)
==28869==    by 0x464F63E: g_signal_emit_valist (in /usr/lib/libgobject-2.0.so.0.1400.1)
==28869==    by 0x464F988: g_signal_emit (in /usr/lib/libgobject-2.0.so.0.1400.1)
==28869==  Address 0xbec4e5f4 is on thread 1's stack
==28869== 
==28869== Syscall param rt_sigaction(act->sa_mask) points to uninitialised byte(s)
==28869==    at 0x40007F2: (within /lib/ld-2.6.1.so)
==28869==    by 0x483A7A2: sigaction (in /lib/libpthread-2.6.1.so)
==28869==    by 0x5562321: google_breakpad::ExceptionHandler::SetupHandler(int) (in /usr/lib/gtk-2.0/modules/libgnomebreakpad.so)
==28869==    by 0x5562445: google_breakpad::ExceptionHandler::SetupHandler() (in /usr/lib/gtk-2.0/modules/libgnomebreakpad.so)
==28869==    by 0x55626D7: google_breakpad::ExceptionHandler::ExceptionHandler(std::string const&, bool (*)(void*), bool (*)(char const*, char const*, void*, bool), void*, bool) (in /usr/lib/gtk-2.0/modules/libgnomebreakpad.so)
==28869==    by 0x5561DE2: gtk_module_init (in /usr/lib/gtk-2.0/modules/libgnomebreakpad.so)
==28869==    by 0x41AB1EC: (within /usr/lib/libgtk-x11-2.0.so.0.1200.0)
==28869==    by 0x46472E9: g_cclosure_marshal_VOID__PARAM (in /usr/lib/libgobject-2.0.so.0.1400.1)
==28869==    by 0x463A918: g_closure_invoke (in /usr/lib/libgobject-2.0.so.0.1400.1)
==28869==    by 0x464D9EC: (within /usr/lib/libgobject-2.0.so.0.1400.1)
==28869==    by 0x464F63E: g_signal_emit_valist (in /usr/lib/libgobject-2.0.so.0.1400.1)
==28869==    by 0x464F988: g_signal_emit (in /usr/lib/libgobject-2.0.so.0.1400.1)
==28869==  Address 0xbec4e5f4 is on thread 1's stack

Apparently this is a known bug.

Also when quitting, --leak-check=full is revealing:

==28869== 2,048 bytes in 1 blocks are definitely lost in loss record 143 of 184
==28869==    at 0x4022AD8: malloc (vg_replace_malloc.c:207)
==28869==    by 0x55623E5: google_breakpad::ExceptionHandler::SetupHandler() (in /usr/lib/gtk-2.0/modules/libgnomebreakpad.so)
==28869==    by 0x55626D7: google_breakpad::ExceptionHandler::ExceptionHandler(std::string const&, bool (*)(void*), bool (*)(char const*, char const*, void*, bool), void*, bool) (in /usr/lib/gtk-2.0/modules/libgnomebreakpad.so)
==28869==    by 0x5561DE2: gtk_module_init (in /usr/lib/gtk-2.0/modules/libgnomebreakpad.so)
==28869==    by 0x41AB1EC: (within /usr/lib/libgtk-x11-2.0.so.0.1200.0)
==28869==    by 0x46472E9: g_cclosure_marshal_VOID__PARAM (in /usr/lib/libgobject-2.0.so.0.1400.1)
==28869==    by 0x463A918: g_closure_invoke (in /usr/lib/libgobject-2.0.so.0.1400.1)
==28869==    by 0x464D9EC: (within /usr/lib/libgobject-2.0.so.0.1400.1)
==28869==    by 0x464F63E: g_signal_emit_valist (in /usr/lib/libgobject-2.0.so.0.1400.1)
==28869==    by 0x464F988: g_signal_emit (in /usr/lib/libgobject-2.0.so.0.1400.1)
==28869==    by 0x463ECC0: (within /usr/lib/libgobject-2.0.so.0.1400.1)
==28869==    by 0x463B68E: (within /usr/lib/libgobject-2.0.so.0.1400.1)

Hint: this is not in Gtk+.

Hint2: neither is it because it is written in C++

Tuesday 25 March 2008

sigc++ and boost::bind

I have been using Gtkmm a lot for a personal project.

I discovered that you can pass boost::bind to Gtkmm signals (that use sigc), thanks to the magic of templates.

Something like that:

m_selection->signal_selected
    .connect(boost::bind(&LibraryMainView::on_selected,
        m_mainview, _1));

Why? Because I'm more familiar with Boost.Bind and for me it looks more flexible. Also because you can pass a shared_ptr<> to it, unlike with sigc::mem_fun.

Sunday 23 March 2008

New GNU linker

A new linker for GNU binutils, gold, targetting ELF, has been announced. It is apparently 5 times faster to run than the regular GNU ld. It is written in C++, and Tom Tromey praise it for its performance and its coding style.

Off course it is still pre-release and will probably need a lot of testing as well as being ported to new target architectures, as it currently only support i386 and x86_64.

And I actually need to give it a try.

Thursday 20 March 2008

10 years ago

10 years ago, almost, Mozilla was released as Free Software under the NPL. It was supposed to be Netscape 5. I built it on a K6-200 with 64MB of RAM which was powerful at the time (running Debian)

Yesterday, I finally rebuilt it for the second time, using the Firefox 3.0b4 code base. I'm not sure how much code is in common either. The build was smooth and, by far, much easier than OOo. Actually the fun part is that in some configuration OOo leads to building xulrunner :-)

Now let's learn XPCOM the hard way.

Tuesday 18 March 2008

I'm no longer operational...

... and none of my circuits are functioning properly.

R.I.P. Arthur C Clarke.

Tuesday 4 March 2008

RIP Gary Gygax

Gary Gygax passed away today. R.I.P. For those who don't know who he was, Gary Gygax invented a game, and a game concept in 1974: Dungeons & Dragons and the concept of Roleplaying Games.