Log In
New Account
Home My Page Project Cloud Code Snippets Project Openings modest
Summary Lists SCM Wiki

Development Tricks

Development tricks

Interesting tools

  • GDB of course
  • Valgrind memcheck to clean leaks. This has to be combined with object reference tracking.
  • Valgrind calgrind module and kcachegrind, to check peaks of cpu usage.
  • powertop to understand if Modest is draining your battery waking up cpu more than expected.

GDB tricks

Running modest in scratchbox for fremantle development

You need to run modest in your desktop session. And you also need the native-gdb flavour of gdb:

	$ run-standalone.sh native-gdb --args modest --show-ui

You need the show ui parameter if you want to run modest visible. If you just want to run modest in brackground for testing dbus API, you can remove it.

Obtain the type name of an object

If you need to know the exact type of an instance in gdb, you can do this:

	(gdb) print (gchar *) g_type_name (((GTypeInstance *)obj)->g_class.g_type)

This will show the type name of the object instance "obj".

Breakpoint in a warning

If you want to clean modest from ugly warnings, and want to get a good backtrace when the warning is being done, add a breakpoint to g_log:

	(gdb) br g_log

If you only want to catch one type of warning (i.e. criticals):

	(gdb) br g_log if (log_level & G_LOG_LEVEL_CRITICAL)

Counting references

If you want to trace what happens with the references of an instance of an object, you can add a watch to the ref_count variable. How to do this?

  1. Try to make gdb break on object initialisation. I.e. add a breakpoint to my_object_init: (gdb) br my_object_init
  2. When the breakpoint is hit for the object you want, you need a reference to the object itself. I.e. "instance". Get the address of the ref_count of the object: (gdb) print &(((GObject *)instance)->ref_count)
  3. Then add a watch to the memory this pointer points to. I.e. watch *0xffddcce

(last edited February 26, 2010) - Read Only [info] [diff])
FindPage by browsing or searching
5 best incoming links: FrontPage (7), RecentChanges (5)
5 best outgoing links:
5 most popular nearby: FrontPage (4485), RecentChanges (689)

Terms of Use    Privacy Policy    Contribution Guidelines    Feedback

Powered By GForge Collaborative Development Environment