4 May 2000 johnm   » (Journeyer)

Not happy. I've just spent a few hours tracking down a bug in gdb.

We have a bunch of patches against stock gdb, which mostly add a new remote protocol to communicate with the monitor in a Palm OS ROM. A while back, I pushed the patches from applying to gdb 4.16 up to 4.18, and I assumed that today's problem was that I'd missed some subtle change in gdb's interface to its remote modules between the releases. An hour of poring over serial line logs and gdb stack traces pretty much disabused me of that notion.

(Yes, I've finally tried using gdb to debug another gdb while it's debugging another program running on an emulator on another computer. Fun. The set prompt command comes in handy!)

Grovelling through the stack traces turned out to be the way to go. I was able to find the exact point where a nice machine address got turned into a big invalid zero. Deep inside gdb's expression parser was a function that just copied the address in 4.16 and 4.17, but did an endianness conversion in 4.18.

On big-endian machines [...] the wrong bits [are] being stored. Only the simplest case is fixed here, the others just get the old behavior.

I don't know what the old behaviour was. All I know is that in 4.18, cross-debugging between machines of different endianness was broken, and it wasn't in 4.16 or 4.17. Here you can see the code getting ripped out again, apparently about two weeks after the 4.18 release.

So I've achieved a few things:

  • Before today, I knew two gdb commands: backtrace and quit. Now I know a whole lot more.

  • I've found some good ammunition for my battle against misguided endianness munging. But that's another story...

  • I've tracked down a bug that was fixed a year ago.

It just goes to prove what we've known and have been working towards for a long time: we ought to be working against the current mainline and even contributing to it. But there are all the usual stupid release and support issues on the one hand, and, on the other, all of binutils, GCC, and gdb are working on consolidation releases at the moment. It doesn't seem like the right time to be bugging them with a new port, especially one that still has some truly crazy requirements like ours.

Latest blog entries     Older blog 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!