[alsa-devel] How to report error in _pointer function?

Timur Tabi timur at freescale.com
Fri Aug 8 17:55:56 CEST 2008

Takashi Iwai wrote:

> What about ltrace?  I'd like to know which functions are called.

This is an embedded system.  I don't have ltrace or strace installed.

I suspect that this problem can easily be reproduced on any system.  Just modify
the _pointer function to always return XRUN, and see what aplay does.

Anyway, I tried debugging aplay.  I'm not familiar with ALSA application
programming (just drivers), so I don't know what to look for, but I did find a

I set a breakpoint on function snd_pcm_hw_writei(), which I presume is an
alsa-lib function.  When I run aplay, the breakpoint is hit:

Breakpoint 1, snd_pcm_hw_writei (pcm=0x10024fd8, buffer=0x100250e8, size=6000)
    at pcm_hw.c:627
627             err = ioctl(fd, SNDRV_PCM_IOCTL_WRITEI_FRAMES, &xferi);

I hit continue, and then it immediately stops at this function again.  I can do
continue four more times and it does the same thing.  On the sixth "continue",
there is an 8-second delay.  Then my driver prints a message saying that it's
returning XRUN, and GDB stops again at snd_pcm_hw_writei().  I don't know what's
happening during that 8-second delay.

This whole process repeats forever.

Timur Tabi
Linux kernel developer at Freescale

More information about the Alsa-devel mailing list