celix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bjoern Petri <bjoern.pe...@sundevil.de>
Subject Re: Celix debugging tools
Date Sun, 31 Jan 2016 19:10:35 GMT


Hi Menno,

This should ease gdb debugging a lot and we can actually
re-use this for other types as well! Quite useful in my
opinion - Thanks a lot for your effort!


Best regards,
  Bjoern



On 29.01.2016 15:54, Menno van der Graaf wrote:
> Hello,
> 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
> <https://sourceware.org/gdb/onlinedocs/gdb/Python-Auto_002dloading.html#Python-Auto_002dloading>,
> 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
> <https://sourceware.org/gdb/onlinedocs/gdb/Python-API.html>
> 
> Any way, hope that someone finds this usefull,
> 
> Menno van der Graaf

Mime
View raw message