03
Apr 14

gdb’ing through a function pointer into a template

Take this (badly mangled to save the names of the guilty) chunk of “code” and run it through the Intel C++ compiler with any -g option you want:


class C {
private:
int (functionA*)(args);

C(){
functionA = functionB;
}

functionC(args) {
rc = (this->*functionA)(args);
}

template <D,E> int functionB(args) const {
/* some code */
}
};

Now try debugging functionB when it’s called via functionC using gdb. In particular, try looking at the args fed to function B.

Now weep for your soul. And TotalView won’t help you now either buddy. You’re down to objdump -t library.a | c++filt | grep functionC and setting some stupid-looking C++ mangled name out of the mess you get back as the breakpoint in gdb.

There has to be a better way…


04
Mar 14

Gravity

I didn’t write this up for a while. I just chalked it up as a really bad movie and a waste of talent and forgot about it. Then some gombeen gave that dross seven Oscars, so I wanted to rant a bit. Who gives out Oscars for proving that with only an obscene amount of money and a team of personal trainers, dieticians, professional lighting experts, veteran cameramen and a ground-breaking special effects team, a fifty-year-old woman can look good in her pants?

There were one or two good parts. I liked the effects. Sod that, I loved the effects, they were outstanding. I liked that someone paid huge amounts of attention to detail in the props (seriously, read any of the commentary by astronauts who worked on the ISS, they’re impressed by the level of detail there). The effects and the set design are hands-down the best I’ve ever seen in a space movie. Go find the guy who did the set design and give him another Oscar and then find the girl who did the effects and give her the Oscar for the next three years, their work was that good (and yes, I know, teams, those are metaphorical guys and girls I’m talking about). But the director and the writer? They took a fresh steaming bowel movement all over the entire thing by ignoring basic physics to shoehorn a really awful plot into a really great set of filmmaking tools and sets. Why didn’t they just take any one of the several hundred other books that have been written in the last few decades that had “space disaster” as a plot and where the math and reality actually didn’t take a day off? Go get the ones that won Hugos or Nebula awards if you think the search would be too difficult or time-consuming. There are hundreds of great plots and huge amounts of great writing out there that would do those sets and effects proud.

But this film? This plot, and this acting?
Utter and total crap. Crap with a capital shite.

What was wrong with it?
Well…
Continue reading →


22
Jan 14

Erlang Token Ring Simulator, updated

ErlangThere’s a directory on my machine called ~/Archives. It’s not exactly… organised. 🙂 It contains bits and pieces from the last 20 or more years – and along with the usual documents, notes and datasheets on the 74 series TTL chipset (computer engineer and computer scientist had rather different flavours in TCD back then), there’s a fair amount of code. Some of that code I can remember, other bits I look at now and think “I wrote that? Eeek…” — but there’s a small amount of code that I look at and think “Hey, I wasn’t all bad back then”. Over the new year’s holiday, I was digging around in there and came across some bits and pieces from the latter category that I thought I’d put up here for kicks, seeing as how I’d put up stuff from the PhD work and other bits and bobs already. I’ll start with this one, it’s a token ring network simulator written in Erlang somewhere in the first half of my final year in college (so late 1996 to early 1997). Continue reading →