celix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Menno van der Graaf <mennovandergr...@hotmail.com>
Subject Celix debugging tools
Date Fri, 29 Jan 2016 14:54:04 GMT
Menno van der Graaf here, you might have seen me post patches on the Celix-Jira.
I was advised to send a mail about some work I did recently (although as it stands right now,
its mostly a small experiment). 
To help with debugging the framework, I wrote some gdb extentions to enhance printing of the
bundle structure, and the bundle archive structure.
Meaning that it shows more relevant data, and less irrelevant data.

For those that are interested, they are implemented in python, with the gdb python API.
Through this API I implemented so called "pretty printers" for the structures, these "pretty
printers" are basicly fancy toString functions.
The files can be found attached to this message.

To install the printers, execute the script "load.py"

(gdb) python execfile("load.py")

(please note that you might need to edit the first line to specify a include directory)
there are ways to autoload it with gdb, or put it in your gdb init file
now, to check if they are installed (and for which types)

(gdb) info pretty-printer

Once loaded, gdb will automatically call the toString whenever you try to print a instance
of the type. i.e.:

(gdb) print *context->bundle

for the struct bundle, the printer goes into the arraylist of modules, fetches and prints
the names and id of each module, and shows the location of the archive.
for the struct bundleArchive, it prints the revisions from the linkedlist.
there are more types partially implemented, but these are only used internally as of yet.

for those interested in extending the functionality, i attached some documentation on how
i implemented them.
you can also read the gdb python API documentation

Any way, hope that someone finds this usefull, 

Menno van der Graaf
View raw message