Clang's AST dump AKA 'WTH is the compiler doing???'
If Clang is invoked also with -Xclang -ast-dump options, it'll dump its internal representation of the compiled source. Which can be pretty useful when the source code doesn't actually mean what one expects, or if there's something unexpected from elsewhere interfering. Consider the following (simple, for clarity) example:
#include <iostream>
using namespace std;
class A
{
};
class B
{
public:
operator A() const { return A(); }
};
class C
: public B
{
};
void foo( const A& )
{
cout << "A" << endl;
}
void foo( B& )
{
cout << "B" << endl;
}
int main()
{
foo( C());
} Looking only at class C, it may perhaps come as a surprise to some that this prints "A" and not "B". And overlooking the missing const or not knowing that it will prevent passing the temporary to the function certainly helps with the surprise, but even if not, still, so what is actually going on? With larger codebase, that can be a lot of time to find out. But finding out what the compiler thinks about the code can help:
$ clang++ -Wall a.cpp -Xclang -ast-dump...
`-FunctionDecl 0x90ffb90 <line:29:1, line:32:5> main 'int (void)'
`-CompoundStmt 0x9100078 <line:30:5, line:32:5>
`-CallExpr 0x90fffb8 <line:31:5, col:13> 'void'
|-ImplicitCastExpr 0x90fffa8 <col:5> 'void (*)(const class A &)' <FunctionToPointerDecay>
| `-DeclRefExpr 0x90fff74 <col:5> 'void (const class A &)' lvalue Function 0x90fec80 'foo' 'void (const class A &)'
`-MaterializeTemporaryExpr 0x9100068 <col:10, col:12> 'const class A' lvalue
`-ImplicitCastExpr 0x9100058 <col:10, col:12> 'const class A' <NoOp>
`-ImplicitCastExpr 0x9100048 <col:10, col:12> 'class A' <UserDefinedConversion>
`-CXXMemberCallExpr 0x9100028 <col:10, col:12> 'class A'
`-MemberExpr 0x9100008 <col:10, col:12> '<bound member function type>' .operator A 0x90fe740
`-ImplicitCastExpr 0x90ffff8 <col:10, col:12> 'const class B' <UncheckedDerivedToBase (B)>
`-CXXTemporaryObjectExpr 0x90ffdd8 <col:10, col:12> 'class C' 'void (void)' zeroing
Knowing a bit about how compilers work helps a lot, but even without it this is quite simple to read. From bottom to up, there's a temporary object of class C created and it's cast to its base class B. That's the expected part, the unexpected part is the 3 AST nodes up, which show that the object is converted to class A by a user defined conversion using operator A(). Which, as the rest of this part of the AST dump shows, results in calling foo( const A& ). Mystery solved.
(Fun trivia: I once helped a GCC developer to disentangle a problem in a complex C++ testsuite using this. But don't tell anyone ;) . )
Xen: проброс USB устройств
Вся конструкция управляется несколькими командами. Посмотреть, какие устройства доступны:
# xm usb-list-assignable-devices 4-2 : ID 067b:2303 Prolific Technology Inc. USB-Serial ControllerСоздать в домене паравиртуальный USB хост контроллер: xm usb-hc-create Domain UsbVer PortNum, где параметры — название домена, версия USB (поддерживаются 1 и 2) и количество USB-портов. После этого, в гостевом домене с помощью lsusb видно появившийся контроллер. Для удаления есть обратная команда xm usb-hc-destroy
Для присваивания устройства есть команда xm usb-attach Domain HostNum PortNum Device, где параметры — название домена, номер хост контроллера (их можно хоть пачку создать), номер порта на виртуальном контроллере, первая колонка выдачи usb-list-assignable-devices. Обратная команда — xm usb-destroy. При этом, в dom0 устройство пропадет на глазах у изумленного драйвера:
[12129.803899] pl2303 ttyUSB0: pl2303 converter now disconnected from ttyUSB0 [12129.803938] pl2303 4-2:1.0: device disconnectedно появится в гостевом домене:
# lsusb Bus 001 Device 002: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Важное замечание. Если в гостевом домене ничего не появилось, кроме записей в dmesg:
[12332.892117] usb 1-1: new full-speed USB device number 70 using vusb [12332.892126] usb 1-1: parent hub has no TTто скорее всего, устройство не поддерживает USB 2.0, к которому его прицепили, нужно сделать другой контроллер с правильным параметром UsbVer.
Кроме того, устройство можно прибить гвоздями в конфигурационном файле домена:
vusb=['usbver=1, numports=4, port_1=4-2']Список литературы:
Elixir
Брать здесь — http://software.opensuse.org/package/elixir.
Organizing oSC13 - 13 days before(A morning inside my head)
Less than two weeks left. OMG it's getting closer.
Here in Thessaloniki it almost started. As in 3 days from now we will be at the conference testing the network, start setting up the rooms and getting the whole venue ready to accept the 350 to 500 guests and the 50+ volunteers. Not much things are left in their fate those last days. So far we were on a marathon, now we are going on a sprint... After the marathon...
Of course have in mind just in case you decide to organize a conference that luck is not on your side amazing things can go wrong and affect your work. Like, let's see... Having a network upgrade in your neighbor and have no internet for the next 5 days...Without a previous warning from your provider... What are the chances for that? Luckily I have a great girlfriend who lets me stay at her place and use her internet.
Waiting for the conference to start made me think how I got here. I mean it is interesting how I got into this. No I am not gong to tell you that story, at least not tonight, you will be bored to death, or not :D
The last couple of days I am on to checklists. Me along with Stella and Henne are checking again and again what was done,what was not done and what is left behind and needs a boosting. The thing is that things are going better than even I originally have calculated. Having people like Carlos, Juergen and Jos onto doing things is simply a miracle producing machine. Let's hope that by the end of the Conference they will still want to talk to me :P
Today I remembered that I have a presentation about oSC13 in oSC13. I would like to find some time and prepare that at some point but my guess is that this will be done just a few hours before the talk. Don't get me wrong, I love making presentations, I just hate preparing them. The good thing with that particular presentation is that I know the talk, I just need the slides for it,mmmm
In a while I have a meeting, with 13 days to go I calculate than I have less than 10 meetings to go before the conference, yeaaaaaaah.
Working in openSUSE Team
Some of you probably noticed I work at SUSE for a while. I was working on SLE maintenance and thus it was bit hidden work, not really in touch with upstream and other projects. This all changes starting this week because 1.7. I changed my post so I will be one of the few working on openSUSE.
I have high hopes for what we can achieve in the team and I really look forward on all the coding and fixing possibilities ahead. Currently I am mostly focusing on the great beach party^W^Wconference where I will be giving few talks and handle creative autootols workshop. Writing those presentations is quite task, specially for the workshop, because I am used for 90 min lectures and this one will be even 30 minutes longer and I really want to have it interesting and educational.
After this party there is even more fun ahead for me. I will be focusing my breaking skills on openSUSE:Factory trying to improve the next release so I could happily keep using it on my and my family laptops.
As an endnote please do not expect from me to magically change all the bugs you might have on openSUSE, tho I will try my best to have it working well. :-)
Easy-to-try Appliance with Yast Services Manager written in Ruby
To make trying and testing easier for you, I've created an appliance Yast in Ruby based on YaST:Head project built for openSUSE 12.3 target in Open Build Service. Only root user with password linux is there.
Above, you can see screenshot from this appliance running in SUSE Studio TestDrive. Appliance is currently built for VirutalBox/VMware.
If you now want to see or try to edit source files, they are just a few of them:
#> rpm -ql yast2-services-managerAfter you edit these files, you don't need to compile anything. Ruby is a scripting programming language so it works as-is. Logs can be found at /var/log/YaST2/y2log.
/usr/share/YaST2/clients/services-manager.rb
/usr/share/YaST2/modules/systemd_service.rb
/usr/share/YaST2/modules/systemd_target.rb
/usr/share/applications/YaST2/services-manager.desktop
I hope it's going to be useful for you!
Organizing oSC13 - 16 days before
So here we are 2 days and 2 weeks before the conference starts. One part of myself is finding it hard to believe that we are close to the end of preparation and so close to the start of the conference. Those days I find myself singing "Nothing else matters" from Metallica every few minutes. I mean really the first turn seem to me it is written for the state I am on those days :
Couldn't be much more from the heart
Forever trusting who we are
And nothing else matters
OpenStack Rhône-Alpes Meet-up #1
Last Thursday was the first meet-up of the OpenStack Rhône-Alpes group, in Grenoble. The idea of organizing such a meet-up came up just one month ago, at Solutions Linux; having such an OpenStack meet-up in Rhône-Alpes feels so natural, given the amount of people we have in the area (we can even include Geneva ;-)). Dave did a great job with the organization, and HP provided a pretty nice venue (and sponsored food!).

We managed to attract around 25 people to this event, and given that it was our first and that we did nearly no noise about it, it's not too bad :-) We had people attending from HP, Bull, Red Hat, SUSE and more, and four of us delivered quick talks about XLcloud (by Patrick Petit, from Bull), oVirt (by Dave Neary, from Red Hat), HP's public cloud (by Gavin Brebner, from HP) and Crowbar (by yours truly). I must admit that Gavin Brebner's presentation about abusing HP's public cloud was extremely interesting; there's a lot of cool stuff happening to keep a public cloud running.
Of course, we enjoyed some nice food afterwards and stayed chatting a bit longer about OpenStack and other technical bits. And best of all: we celebrated OpenStack's third birthday a bit early:

If everything goes well, the next meet-up of the group will be in Lyon, in September, stay tuned! And we'll make more noise, so we hope more people will join!
4.11 beta 2 openSUSE packages available
KDE released the second beta of the KDE Platform, Workspaces and Applications 4.11, and after the necessary time for the OBS to build packages from the released tarballs, packages are available for openSUSE 12.3 and openSUSE Factory. Like the previous beta, they are available through the KDE:Distro:Factory repository. 4.11.x is is targeted for inclusion in the upcoming openSUSE 13.1.
So far 4.11 has been pretty stable for me, but you should never forget these packages are for testing and bug reporting purposes: don’t use them on production systems. In case you find a bug:
- if it is a _packaging bug, _report it to Novell’s bugzilla;
- if it is a bug in the software, report it directly upstream to KDE. Don’t forget there is a specific area on the KDE forums to discuss this beta release.
With that said, let’s find and kill these bugs out there, to make 4.11 rock!
3.10 Linux Kernel Development Rate
While working on the latest statistics for the yearly Linux Foundation “Who Writes Linux” paper, I noticed the rate-of-change for the 3.10 kernel release that just happened this weekend:

Every year I think we can’t go faster, and every year I’m wrong.
Note, the “number of employers” row is not correct, I haven’t updated those numbers yet, that takes a lot more work, which I will be doing this week.
Spreadsheet source, and scripts used to generate the numbers, and “cleaned up” kernel logs can be found in my kernel-history repo here.


