Feeds:
Posts
Comments

Archive for the ‘english’ Category

Converting from Ogg Vorbis to MP3 in Amarok

Since version 2.6, you can tell Amarok to convert (transcode) every music track to MP3 when copying it to a given device.

There’s a bug, however which causes MP3 files converted from Ogg Vorbis to lose all metadata (artist, album, title etc). This is a showstopper for me.

This happens because Amarok needs to pass an option to ffmpeg to tell it to get the metadata from the first stream found in the Ogg file as opposed to the default of getting it from global metadata. Unfortunately as far as I can tell there’s no way to configure the ffmpeg command line used by Amarok. The solution then is to replace the ffmpeg binary in the path with a script that will do that, like this one:

#!/usr/bin/python
import os
import sys

AVCONV_FFMPEG = '/usr/bin/ffmpeg.distrib'
os.execv(AVCONV_FFMPEG, sys.argv + ['-map_metadata', '0:0,s0'])

In Debian or Ubuntu, you can divert the real ffmpeg binary and install the script above as /usr/bin/ffmpeg:

$ sudo dpkg-divert --add /usr/bin/ffmpeg
$ sudo cp /tmp/fake-ffmpeg.py /usr/bin/ffmpeg
$ sudo chmod +x /usr/bin/ffmpeg

There’s another bug where Amarok needlessly converts even MP3 files when copying them to the device.

Read Full Post »

Building a kernel for the Dreamplug still requires using a set of out-of-tree patches, since Dreamplug support is still being merged upstream. There are a few versions of these patches adapted for different kernel versions floating around. I have adapted them to apply to 3.4.x. You can get them from my github repository. Follow the README instructions to apply them and build the kernel. I included a kernel config file too.

The Dreamplug support patches that are being merged upstream use a device tree to tell the kernel about board-specific configuration that it needs to run on a given machine. The boot loader is supposed to hand that device tree binary to the kernel, or if your boot loader doesn’t support that (the u-boot version which comes pre-installed with the Dreamplug doesn’t) then you need to append a device tree binary to your kernel image after building it, or flash a new u-boot version.

To avoid all that fuss, the first patch in my series has a small hack that hard-codes the kernel to boot only on the Dreamplug, avoiding the need for a device tree. It also makes the kernel expect the GuruPlug machine id (which is what the factory Dreamplug u-boot advertises) instead of the Dreamplug machine id (which is what newer versions of u-boot advertise). It’s easy to drop this part of the patch if you updated your Dreamplug or made the factory u-boot use the new machine id (apparently you can do that, I didn’t try).

Read Full Post »

isn’t it a pity?

Isn’t it a pity
Now, isn’t it a shame
How we break each other’s hearts
And cause each other pain
How we take each other’s love
Without thinking anymore
Forgetting to give back
Isn’t it a pity

Some things take so long
But how do I explain
When not too many people
Can see we’re all the same
And because of all their tears
Their eyes can’t hope to see
The beauty that surrounds them
Isn’t it a pity

Isn’t it a pity
Isn’t is a shame
How we break each other’s hearts
And cause each other pain
How we take each other’s love
Without thinking anymore
Forgetting to give back
Isn’t it a pity

Forgetting to give back
Isn’t it a pity
Forgetting to give back
Now, isn’t it a pity

George Harrison

Read Full Post »

beware of darkness

Watch out now, take care
Beware of falling swingers
Dropping all around you
The pain that often mingles
In your fingertips
Beware of darkness

Watch out now, take care
Beware of the thoughts that linger
Winding up inside your head
The hopelessness around you
In the dead of night

Beware of sadness
It can hit you
It can hurt you
Make you sore and what is more
That is not what you are here for

Watch out now, take care
Beware of soft shoe shufflers
Dancing down the sidewalks
As each unconscious sufferer
Wanders aimlessly
Beware of maya

Watch out now, take care
Beware of greedy leaders
They take you where you should not go
While weeping atlas cedars
They just want to grow, grow and grow
Beware of darkness (beware of darkness)

George Harrison

Read Full Post »

king of pain

There’s a little black spot on the sun today
It’s the same old thing as yesterday
There’s a black hat caught in a high tree top
There’s a flag pole rag and the wind won’t stop

I have stood here before inside the pouring rain
With the world turning circles running round my brain
I guess I’m always hoping that you’ll end this reign
But it’s my destiny to be the king of pain

There’s a little black spot on the sun today
That’s my soul up there
It’s the same old thing as yesterday
That’s my soul up there
There’s a black hat caught in a high tree top
That’s my soul up there
There’s a flag pole rag and the wind wont stop
That’s my soul up there

I have stood here before inside the pouring rain
With the world turning circles running round my brain
I guess I’m always hoping that you’ll end this reign
But it’s my destiny to be the king of pain

There’s a fossil that’s trapped in a high cliff wall
That’s my soul up there
There’s a dead salmon frozen in a waterfall
That’s my soul up there
There’s a blue whale beached by a springtides ebb
That’s my soul up there
There’s a butterfly trapped in a spider’s web
That’s my soul up there

I have stood here before inside the pouring rain
With the world turning circles running round my brain
I guess I’m always hoping that you’ll end this reign
But it’s my destiny to be the king of pain

There’s a king on a throne with his eyes torn out
There’s a blind man looking for a shadow of doubt
There’s a rich man sleeping on a golden bed
There’s a skeleton choking on a crust of bread

King of pain

There’s a red fox thorn by a huntsman’s pack
That’s my soul up there
There’s a black winged gull with a broken back
That’s my soul up there
There’s a little black spot on the sun today
It’s the same old thing as yesterday

I have stood here before inside the pouring rain
With the world turning circles running round my brain
I guess I’m always hoping that you’ll end this reign
But it’s my destiny to be the king of pain

King of pain
King of pain
King of pain
I’ll always be king of pain
I’ll always be king of pain
I’ll always be king of pain…

Police

Read Full Post »

Ok, so this time I won’t talk about Python scripting support in GDB. I’m getting tired of it myself. :-) I’ll just comment that it’s amazing the number of problems people in IRC report with GDB that can be solved with the Python support that we’re adding to it. Sometimes they need stuff which is only on the branch, but sometimes even the few bits already in CVS HEAD are enough!

Er, I actually do have one more thing to say about the subject: GDB had one project accepted in the Google Summer of Code 2009. Oguz Kayral is the student working on it, and I am his mentor. He will add support for subscribing to inferior events (e.g., signals, process and thread stops, thread creation) from Python. One use case for which this is useful was given by an IRC user at the #gdb channel:

<LimCore> how to run gdb from command line, so that it will run ./foo.bin with arguments: foo bar baz and it will run it instantly without waiting for ‘r’; And if program segfaults then it will do ‘bt’ without waiting for the command. (and if program terminates normally then it will also just quit)

LimCore will be able to write a simple and short Python script using the events API to solve his problem.

Now, moving on to other items: my team has been asked to improve GDB support for the hardware debug facilities in embedded PowerPC processors (for more info about these facilities, see Chapter 10 of Book III-E of the Power ISA v2.06). I announced this work to the GDB mailing list back in early March, and got useful insight from Joel Brobecker.

Today I posted an update on where we are with this work. We have the following ready for both native GDB and gdbserver on Linux:

  • one additional hardware watchpoint (two in total),
  • four hardware breakpoints,
  • one ranged hardware watchpoint.

And we still have the following features ahead of us:

  • support for the two DVC (Data Value Compare) registers, which enable hardware-accelerated conditions for hardware watchpoints,
  • two ranged hardware breakpoints.

Last and least, I was thinking of posting monthly GDB updates on what happened in GDB in the previous month as I did back in February, but I got busy and didn’t get around to it. I still entertain the idea though, so if you think it’s worth it, I’d be glad to know.

Read Full Post »

It’s been a while since I last talked about Python scripting support in GDB. Mostly because I’ve been focusing on getting stuff from the branch merged into CVS HEAD, so that GDB 7.0 can have some useful Python bindings.

The latest two patches committed upstream are for creating convenience functions in Python, and fo manipulating a program’s stack frames as Python objects. So, what can you do with those? I’ll borrow an example from Tom Tromey here: suppose you want to set a breakpoint which triggers only when the code is called by one specific function. You can create a convenience function like this:

import gdb
import re

class CallerIs (gdb.Function):
    """Return True if the calling function's name is equal to a string.
This function takes one or two arguments.
The first argument is the name of a function; if the calling function's
name is equal to this argument, this function returns True.
The optional second argument tells this function how many stack frames
to traverse to find the calling function.  The default is 1."""

    def __init__ (self):
        super (CallerIs, self).__init__ ("caller_is")

    def invoke (self, name, nframes = 1):
        frame = gdb.selected_frame ()
        while nframes > 0:
            frame = frame.older ()
            nframes = nframes - 1
        return frame.name () == name.string ()

CallerIs ()

And then create a conditional breakpoint using it, as in:

(gdb) break foo.c:42 if $caller_is ("some_function")

Or, to check the name of the grand-grand-caller of the code:

(gdb) break foo.c:42 if $caller_is ("some_function", 3)

Cool, huh? Now, why bother writing that big doc comment? GDB will use it as online help for the function you wrote:

(gdb) help function caller_is
Return True if the calling function's name is equal to a string.
This function takes one or two arguments.
The first argument is the name of a function; if the calling function's
name is equal to this argument, this function returns True.
The optional second argument tells this function how many stack frames
to traverse to find the calling function.  The default is 1.

One other patch which was merged in HEAD enables creating new GDB commands in Python, so you can write new commands to do some frame tricks too!

If you’d like to know more about the Python scripting work in GDB, I suggest you read the series of blog posts from Tom Tromey on this subject. It’ll give you a pretty good idea of what we have in the Python branch, and the direction we’re heading. Just keep in mind that some method names and syntax changed since he wrote that. Refer to the GDB manual in the Python branch (“make gdb.pdf” in gdb/doc/) or the example scripts (also in the Python branch, in gdb/python/lib/gdb/) for up-to-date details.

Read Full Post »

I’d like to be able to say this every once in a while:

All in all, it was a pretty crazy year. My life kind of turned upside down and I found myself to be very often far removed from anything resembling a comfort zone. I expect 2009 to be pretty crazy as well.

http://she.geek.nz/archives/528-2008-summary.html

Read Full Post »

news from GDB-land

Nick Clifton publishes in his blog monthly news from the toolchain world, which is very interesting and very nice of him. Unfortunately he has not been able to provide news from GDB-land. I compiled a list of interesting events which happened in the GDB community this February to post as a comment in his blog, and figured it could be useful to post it here as well:

This is an incomplete list (doesn’t mention bugfixes, for instance) hacked up in the wee hours of the night, while waiting for sleep to come. If you are a GDB hacker who committed something interesting this month, I apologize in advance for not listing it here.

Read Full Post »

just do it.

ps: it’s just marketing, I know. But I really liked the  message…

Read Full Post »

Older Posts »

Follow

Get every new post delivered to your Inbox.

Join 348 other followers