Older blog entries for acme (starting at number 162)

pahole on debian!

I was just thinking about (finally) learning how to write debian packages when I came across this. Now I can continue procrastinating… Thank you whoever you are!

Syndicated 2007-07-09 00:46:01 from Arnaldo's Ramblings


So now we have basic support for exposing the vtables information in the DWARF info for C++ objects, class__fprintf will just print something like this (from a struct in the CERN ATLAS project):

        /* vtable has 7 entries: {
           [5] = setProperty(_ZN9IProperty11setPropertyERK8Property),
           [6] = setProperty(_ZN9IProperty11setPropertyERKSs),
           [7] = setProperty(_ZN9IProperty11setPropertyERKSsS1_),
           [8] = getProperty(_ZNK9IProperty11getPropertyEP8Property),
           [9] = getProperty(_ZNK9IProperty11getPropertyERKSs),
           [10] = getProperty(_ZNK9IProperty11getPropertyERKSsRSs),
           [11] = getProperties(_ZNK9IProperty13getPropertiesEv),
        } */

We still have to support multiple vtables, but its a good start, and by looking at the linkage_name (C++ mangle-o-rama) we can get an idea where the vtable entries are from anyway.

Syndicated 2007-07-09 00:09:48 from Arnaldo's Ramblings

Break on thru, to the other side

I spent most of my early life as a contributor to free/open source software as a packager, coming from a life as a software developer in the dark dungeons. Now I’m just happy as a project I finally managed to make go to the 1st version, the funny little peoples one, get on gentoo, mandriva and now in one of the ones I respected the most while a packager: PLD. Thank you guys, its good to be packaged. Too late for a cl package tho :-(

Syndicated 2007-07-07 23:46:54 from Arnaldo's Ramblings

Back Home

The dwarves presentation at OLS went pretty well, people even seem to have liked it. The paper is now available, use it as the documentation.

Implemented –expand_pointers, that unfolds the pointer types in the same way that –expand_types expand non-pointer types. Should be useful in getting a bigger picture of a project data structure maze of relationships.

It should be a good first step on helping with checking ABI breakage, just use it in the old and new binary and use plain old diff to see what changed, perhaps something down three pointer levels. abichk will probably be a combination of this and what codiff does.

Here is an example:

Lets look at struct request_list in the Linux kernel:

$ pahole -C request_list fs/super.o
struct request_list {
        int                        count[2];       /*     0     8 */
        int                        starved[2];     /*     8     8 */
        int                        elvpriv;        /*    16     4 */
        /* XXX 4 bytes hole, try to pack */
        mempool_t *                rq_pool;        /*    24     8 */
        wait_queue_head_t          wait[2];        /*    32    48 */
        /* --- cacheline 1 boundary (64 bytes) was 16 bytes ago --- */
        /* size: 80, cachelines: 2 */
        /* sum members: 76, holes: 1, sum holes: 4 */
        /* last cacheline: 16 bytes */

Now lets expand its pointers, just one, mempool_t, and one that doesn’t have lots of pointers, to fit into this blog entry:

$ pahole --expand_pointers -C request_list fs/super.o
struct request_list {
        int                        count[2];        /*     0     8 */
        int                        starved[2];      /*     8     8 */
        int                        elvpriv;         /*    16     4 */
        /* XXX 4 bytes hole, try to pack */
        /* typedef mempool_t */ struct mempool_s {
                spinlock_t         lock;
                int                min_nr;
                int                curr_nr;
                void *             *elements;
                void *             pool_data;
                /* typedef mempool_alloc_t */ void * (*alloc)(gfp_t, void *);
                /* typedef mempool_free_t */ void (*free)(void *, void *);
                wait_queue_head_t  wait;
                /* --- cacheline 1 boundary (64 bytes) was 8 bytes ago --- */
        } *rq_pool; /*    24     8 */
        wait_queue_head_t          wait[2];         /*    32    48 */
        /* --- cacheline 1 boundary (64 bytes) was 16 bytes ago --- */
        /* size: 80, cachelines: 2 */
        /* sum members: 76, holes: 1, sum holes: 4 */
        /* last cacheline: 16 bytes */

It even seems to naturally avoid expanding opaque types, i.e. struct forward declarations, etc, so if header file with structs in the ABI is well written it just doesn’t goes down the non-ABI type rabbit hole, which seems the right thing to do.

Use it with –expand_types and the complete picture can be seen. And in the Linux kernel it is, humm, big:

acme@mica build]$ pahole --quiet --expand_pointers -C inode fs/super.o | wc -l
[acme@mica build]$ pahole --quiet --expand_pointers --expand_types -C inode fs/super.o | wc -l
[acme@mica build]$

One explanation for this last example is needed tho: –expand_types expands a type possibly many times, as many as there are members of its type, –expand_pointers, on the other hand, only expands any given type once, for the first member that is a pointer to this type.

This is because –expand_types was implemented to help in finding what was the field at some offset from complex data structures with a deep hierarchy, –expand_pointers, on the other hand, used most of the –expand_types code, but was implemented to help in finding ABI breakage deep inside the type.

I’ll eventually implement a config option to tell that only the first type should be expanded in the –expand_types case, make that a shell script that takes as parameters two files, call pahole for the two, do a diff and show where the ABI stopped being a virgin 8-)

Syndicated 2007-07-07 18:38:03 from Arnaldo's Ramblings

Inheriting namespaces

I’d prefer real state space, but for now I’ll have to seattle for C++ namespaces as the only inheritance to tap into. The dwarves now are able to show the wonders of goat guts, oops, of modern C++ techniques hidden behind layers of type within types within templates within namespaces represented in DWARF tags. This time there will be no tool sample output, they wouldn’t be pretty. Just be warned, pull from my kernel.org repo and be sure you have already digested everything you ate in at least two hours. Remember: you’ve been warned.

P.S. yes, there is a typoish message to friends in the northern hemisphere, far from the brazilian winter :o )

Syndicated 2007-05-26 01:07:25 from Arnaldo's Ramblings

No song for 1.0

As part of the review process to get dwarves into Fedora I released 1.0. Numbers are not that much meaningful anyway. In a previous life, as a package pac-man (sorry about the pun, too lame…) in a jungle distro I always looked forward for one dot zero. Even for nfs-server! So, here it goes, one-dot-zero! In a Fedora mirror some day soon!

P.S.: rpms in the usual place.

Syndicated 2007-05-22 19:37:03 from Arnaldo's Ramblings

Virtual doesn’t hurts as much as Real Life: !wii session

Today went with friends to do some non-Wii bowling. What can I say? My fingers are hurting. Yeah, I suck in real life. Nah, back at home listening to some torrents, nevermind I have the CDs for 20 years, just that those Metallica songs are so buried in layers of dust I found it easier to pound my ears with something freshly downloaded 8-) My 5 years old niece still knows nothing about torrents and stuff, but she beats me hands down on the not-so-heavy-as-real-life Wii bowling. She will learn, but lets not hurry her…

Syndicated 2007-05-19 03:27:41 from Arnaldo's Ramblings


- Paper for OLS about the dwarf debugging tools written, will be the badly needed documentation for these tools as soon as it is released. Will continue improving it even after presentation at OLS.
- Several new pahole options, for instance look at this
- libdwarves now uses libdwfl, so works well with RELA architectures such as x86-64

Syndicated 2007-05-10 22:16:57 from Arnaldo's Ramblings

Kernel hacking mostly…

The “mostly” allows me to celebrate my most recent non-kernel-hacking, at least personally, interesting news: I’m keeping up with jogging, now trying to get past the confortable part of jogging, over-achiever, not really… only 17:44.06 on a 3.3 KM circuit at Barigui, if only da beers would keep some distance from myself…

Syndicated 2007-03-30 20:50:37 from Arnaldo's Ramblings

libdwfl conversion

Finally I found time to convert dwarves to use the more active libdwfl library found in elfutils, thanks to Ulrich Drepper and Roland McGrath we can forget about most of the low level details related to RELA architectures and get the dwarves to work with kernel modules on architectures such as x86_64, where we need to do relocation work on the .debug_info section, now just enjoy pahole & friends working on more targets.

There is still some work to do on two of the dwarves that handle more than one target, codiff and ctracer, where dwfl_default_argp is not enough as it only handles one side of the game needed for these two dwarves, we need to open another set to compare in the case of codiff and another set for resolving the kprobes functions in the case of ctracer.

Syndicated 2007-03-30 20:39:56 from Arnaldo's Ramblings

153 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!