On Mon, Aug 08, 2011 at 05:31:39PM +0800, David Henningsson wrote:
> On 2011-07-07 13:23, David Henningsson wrote:
> > diff --git a/src/pulse/introspect.h b/src/pulse/introspect.h
> > index 8e4cc97..259c57b 100644
> > --- a/src/pulse/introspect.h
> > +++ b/src/pulse/introspect.h
> > @@ -452,6 +452,10 @@ typedef struct pa_card_profile_info {
> >       uint32_t n_sinks;                   /**<  Number of sinks this 
> > profile would create */
> >       uint32_t n_sources;                 /**<  Number of sources this 
> > profile would create */
> >       uint32_t priority;                  /**<  The higher this value is 
> > the more useful this profile is as a default */
> > +    uint32_t n_sink_ports;              /**<  Number of entries in 
> > sink_ports array \since MERGE_OF_JACK_DETECTION */
> > +    pa_sink_port_info** sink_ports;     /**<  Array of available output 
> > ports, or NULL. Array is terminated by an entry set to NULL. The number of 
> > entries is stored in n_sink_ports. \since MERGE_OF_JACK_DETECTION */
> > +    uint32_t n_source_ports;            /**<  Number of entries in 
> > source_ports array \since MERGE_OF_JACK_DETECTION */
> > +    pa_source_port_info** source_ports; /**<  Array of available input 
> > ports, or NULL. Array is terminated by an entry set to NULL. The number of 
> > entries is stored in n_source_ports. \since MERGE_OF_JACK_DETECTION */
> >   } pa_card_profile_info;
> 
> I think I figured out why the addition above breaks the ABI: It's 

What's the symptom of your breaking?

I'm not sure whether they fall into the same category but I'd like to
point this out.  I met with some weird issues when I add some new fields
in `struct userdata` in alsa-sink.c, the problem is the module segfaults
when it runs to pa_alsa_refcnt_inc().

>From gdb output message, it seems the module loading mechanism forgot to
add some kind of base address to it. so it directly jumps to a smaller
address, which causes the seg fault.

(gdb) info reg
eax            0x8060e08        134614536
ecx            0x1      1
edx            0x0      0
ebx            0xb3ab2d1c       -1280627428
esp            0xbfffe960       0xbfffe960
ebp            0xbfffe9f8       0xbfffe9f8
esi            0x808d318        134796056
edi            0xb3ab6dd2       -1280610862
eip            0xb3ab04dc       0xb3ab04dc
<module_alsa_card_LTX_pa__init+28>
eflags         0x282    [ SF IF ]
cs             0x73     115
ss             0x7b     123
ds             0x7b     123
es             0x7b     123
fs             0x0      0
gs             0x33     51
(gdb) s

Program received signal SIGSEGV, Segmentation fault.
0x000015ba in ?? ()
(gdb) info reg
eax            0x8060e08        134614536
ecx            0x1      1
edx            0x0      0
ebx            0xb3ab2d1c       -1280627428
esp            0xbfffe95c       0xbfffe95c
ebp            0xbfffe9f8       0xbfffe9f8
esi            0x808d318        134796056
edi            0xb3ab6dd2       -1280610862
eip            0x15ba   0x15ba                  <------
eflags         0x10282  [ SF IF RF ]
cs             0x73     115
ss             0x7b     123
ds             0x7b     123
es             0x7b     123
fs             0x0      0
gs             0x33     51

the correct address for refcnt_inc should be:
(gdb) p pa_alsa_refcnt_inc
$1 = {void (void)} 0xb3a73460 <pa_alsa_refcnt_inc>

> because pa_card_info has a pointer to an array of these objects, with 
> the following comment:
> 
> pa_card_profile_info* profiles;      /**< Array of available profile, or 
> NULL. Array is terminated by an entry with name set to NULL. Number of 
> entries is stored in n_profiles */
> 
> Which means the client has to rely on sizeof(pa_card_profile_info) to 
> know the address of the second (and third, and so on) array entry. As 
> sizeof(pa_card_profile_info) is changed, recompilation of clients is 
> necessary.
> 
> :-(
> 
> Any good ideas as of how to avoid it?
> 
> -- 
> David Henningsson
> http://launchpad.net/~diwic
> _______________________________________________
> pulseaudio-discuss mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

-- 
guanqun
_______________________________________________
pulseaudio-discuss mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

Reply via email to