Skip to contentSkip to conversation

Using GDB for ALSA How to?

DISCUSSION William Estrada 2 participants 6 messages Sep 1, 2008 – Sep 4, 2008

lore
Share & tools
lore
#0 lore raw

Hi group,

I am trying to use GDB with my ALSA program. I wish to display (print)
a handle for
an snd_pcm_t pointer. I am getting the following error:

Quoted 4 lines

(gdb) p Device
$9 = (snd_pcm_t *) 0x92be458
(gdb) p *Device
$10 = <incomplete type>

How do I display the snd_pcm_t structure?

Thanks for your time.

Signature · 4 lines
William Estrada
[email protected]
Mt-Umunhum-Wireless.net ( http://Mt-Umunhum-Wireless.net )
Ymessenger: MrUmunhum
#1 lore raw
Quoted 8 lines · William Estrada

I am trying to use GDB with my ALSA program. I wish to display (print)
a handle for
an snd_pcm_t pointer. I am getting the following error:

Quoted 4 lines

(gdb) p Device
$9 = (snd_pcm_t *) 0x92be458
(gdb) p *Device
$10 = <incomplete type>

How do I display the snd_pcm_t structure?

My guess is that this pointer is simply uninitialized. Did you check that it was properly prepared?

MfG, JBG

Signature · 3 lines
      Jan-Benedict Glaw      [email protected]              +49-172-7608481
Signature of:              What we do for ourselves dies with us. What we do for
the second  :         others and the world remains and is immortal. (Albert Pine)

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#2 lore raw

Yes, the device is opened. Is that what you mean??

Quoted 20 lines · Jan-Benedict Glaw
Quoted 11 lines · William Estrada

I am trying to use GDB with my ALSA program. I wish to display (print)
a handle for
an snd_pcm_t pointer. I am getting the following error:

Quoted 5 lines

(gdb) p Device
$9 = (snd_pcm_t *) 0x92be458
(gdb) p *Device
$10 = <incomplete type>

How do I display the snd_pcm_t structure?

My guess is that this pointer is simply uninitialized. Did you check that it was properly prepared?

MfG, JBG

Signature · 4 lines
William Estrada
[email protected]
Mt-Umunhum-Wireless.net ( http://Mt-Umunhum-Wireless.net )
Ymessenger: MrUmunhum
#3 lore raw
Quoted 11 lines · William Estrada
Quoted 10 lines · Jan-Benedict Glaw
Quoted 9 lines · William Estrada

I am trying to use GDB with my ALSA program. I wish to display (print)
a handle for
an snd_pcm_t pointer. I am getting the following error:

Quoted 4 lines

(gdb) p Device
$9 = (snd_pcm_t *) 0x92be458
(gdb) p *Device
$10 = <incomplete type>

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

How do I display the snd_pcm_t structure?

My guess is that this pointer is simply uninitialized. Did you check that it was properly prepared?

Yes, the device is opened. Is that what you mean??

Partially. But I misread your log, too. Seems that gdb failed to figure out how snd_pcm_t is actually defined. You'd try casting it to struct _snd_pcm * if the type information got lost somewhere. (You'd check the later by examining the `readelf -wi' output for your binary or library you're hacking on.)

MfG, JBG

Signature · 3 lines
      Jan-Benedict Glaw      [email protected]              +49-172-7608481
Signature of: They that give up essential liberty to obtain temporary safety,
the second  : deserve neither liberty nor safety.  (Ben Franklin)

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#4 lore raw
Quoted 7 lines · Jan-Benedict Glaw
Quoted 6 lines · William Estrada
Quoted 5 lines · Jan-Benedict Glaw
Quoted 4 lines · William Estrada

I am trying to use GDB with my ALSA program. I wish to display (print)
a handle for
an snd_pcm_t pointer. I am getting the following error:

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

(gdb) p Device
$9 = (snd_pcm_t *) 0x92be458
(gdb) p *Device
$10 = <incomplete type>

How do I display the snd_pcm_t structure?

So... Looking at it, snd_pcm_t is willfully specified as a hidden struct, the real definition is only used where *really* needed, that
is: inside libasound2. It's in pcm_local.h, to not allow an arbitrary user to easily fiddle with the lib's internal state.

As you want to peek into it, I guess you're facing a problem somewhere. It would probably help if you describe your actual problem.

MfG, JBG

Signature · 4 lines
      Jan-Benedict Glaw      [email protected]              +49-172-7608481
Signature of:               The real problem with C++ for kernel modules is:
the second  :                                 the language just sucks.
                                                   -- Linus Torvalds

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#5 lore raw

Jan,

I have several programs that use the ALSA interface, most work the way
they are supposed to.
The one that require real time record and then play back are not working the way I want them
to, There is a 4.09 second delay in the read interrupt. I think it is
because the period value
of the handle is not being saved correctly? So I wrote a test program to try and debug my
problem. It would be helpful if these structures where not hidden.

I wrote a test program to try and debug my problem. From the output I
can see that the data
in the handle is getting messed up? I am not sure if this is another programming problem with
in the display program (status.c)? The program works but the delay makes it unusable for my application.
'show_1' and 'show_2' are the same code just compiled differently.

The program(s) are
here: http://64.124.13.3/_ALSA_ along with the source. The output <64.124.13.3/_ALSA_>of show_1 is:

Quoted 80 lines
$ ./show_1
14:37:52.266 Display_Audio_From_Function
Device: 8c477b8
PCM Device name = 'default'         PCM state         = PREPARED
access type     = MMAP_NONINTERLEAV format            = 'U8' (Unsigned 
8 bit)
subformat       = 'STD' (Standard)  channels          = 1
rate            = 8000 bps          period time       = 10000 us
period size     = 80 frame          buffer time       = 8192000 us
buffer size     = 65536 frames      periods/buffer    = 819 frames
exact rate      = 8000/1 bps        significant bits  = 8000
is batch        = 0                 is block transfer = 1
is double       = 0                 is half duplex    = 0
is joint duplex = 0                 can overrange     = 0
can mmap        = 1                 can pause         = 0
can resume      = 1                 can sync start    = 1
--------------------------------------------------------------------------------
Device: 8c47b00
PCM Device name = 'default'         PCM state         = PREPARED
access type     = MMAP_NONINTERLEAV format            = 'U8' (Unsigned 
8 bit)
subformat       = 'STD' (Standard)  channels          = 1
rate            = 8000 bps          period time       = 10000 us
period size     = 80 frame          buffer time       = 8192000 us
buffer size     = 65536 frames      periods/buffer    = 819 frames
exact rate      = 8000/1 bps        significant bits  = 8000
is batch        = 0                 is block transfer = 1
is double       = 0                 is half duplex    = 0
is joint duplex = 0                 can overrange     = 0
can mmap        = 1                 can pause         = 0
can resume      = 1                 can sync start    = 1
--------------------------------------------------------------------------------
14:37:52.267 Voice On
14:37:52.267 Display_Audio_After_Function_Return
Label: In, Device: 8c477b8
PCM Device name = 'default'         PCM state         = PREPARED
access type     = (null)            format            = 'FLOAT_LE' 
(Float 32 bit Little Endian)
subformat       = 'STD' (Standard)  channels          = 0
rate            = 0 bps             period time       = -1081229612 us
period size     = 80 frame          buffer time       = 0 us
buffer size     = 0 frames          periods/buffer    = -1081229612 frames
exact rate      = 0/-1081229612 bps significant bits  = 0
is batch        = 0                 is block transfer = 1
is double       = 0                 is half duplex    = 0
is joint duplex = 0                 can overrange     = 0
can mmap        = 0                 can pause         = 0
can resume      = 1                 can sync start    = 1
--------------------------------------------------------------------------------
Label: Out, Device: 8c47b00
PCM Device name = 'default'         PCM state         = PREPARED
access type     = (null)            format            = 'FLOAT_LE' 
(Float 32 bit Little Endian)
subformat       = 'STD' (Standard)  channels          = 0
rate            = 0 bps             period time       = -1081229612 us
period size     = 80 frame          buffer time       = 0 us
buffer size     = 0 frames          periods/buffer    = -1081229612 frames
exact rate      = 0/-1081229612 bps significant bits  = 0
is batch        = 0                 is block transfer = 1
is double       = 0                 is half duplex    = 0
is joint duplex = 0                 can overrange     = 0
can mmap        = 0                 can pause         = 0
can resume      = 1                 can sync start    = 1
--------------------------------------------------------------------------------
14:37:52.284 Starting Callback
14:37:52.284 Sleep 5
14:37:56.380 Enter Callback
Label: Callback, Device: 8c477b8
PCM Device name = 'default'         PCM state         = RUNNING
access type     = (null)            format            = 'FLOAT_LE' 
(Float 32 bit Little Endian)
subformat       = 'STD' (Standard)  channels          = 0
rate            = 0 bps             period time       = -1081230956 us
period size     = 80 frame          buffer time       = 0 us
buffer size     = 0 frames          periods/buffer    = -1081230956 frames
exact rate      = 0/-1081230956 bps significant bits  = 0
is batch        = 0                 is block transfer = 1
is double       = 0                 is half duplex    = 0
is joint duplex = 0                 can overrange     = 0
can mmap        = 0                 can pause         = 0
Quoted 8 lines
can resume      = 1                 can sync start    = 1
--------------------------------------------------------------------------------
14:37:56.381 Audio Ready: 32768
14:37:56.381 Voice 1
14:38:00.479 Exit Callback
14:38:00.479 Voice off
14:38:05.486
Exiting

If you have any ideas I would like to hear them.

Thanks again for your time.

Quoted 24 lines · Jan-Benedict Glaw
Quoted 7 lines · Jan-Benedict Glaw
Quoted 6 lines · William Estrada
Quoted 5 lines · Jan-Benedict Glaw
Quoted 4 lines · William Estrada

I am trying to use GDB with my ALSA program. I wish to display (print)
a handle for
an snd_pcm_t pointer. I am getting the following error:

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

(gdb) p Device
$9 = (snd_pcm_t *) 0x92be458
(gdb) p *Device
$10 = <incomplete type>

How do I display the snd_pcm_t structure?

So... Looking at it, snd_pcm_t is willfully specified as a hidden struct, the real definition is only used where *really* needed, that
is: inside libasound2. It's in pcm_local.h, to not allow an arbitrary user to easily fiddle with the lib's internal state.

As you want to peek into it, I guess you're facing a problem somewhere. It would probably help if you describe your actual problem.

MfG, JBG

Signature · 4 lines
William Estrada
[email protected]
Mt-Umunhum-Wireless.net ( http://Mt-Umunhum-Wireless.net )
Ymessenger: MrUmunhum