* [Xenomai-help] problem with libanalogy
@ 2010-01-13 17:19 Alessio Margan @ IIT
2010-01-14 14:43 ` Simon Boulay
0 siblings, 1 reply; 5+ messages in thread
From: Alessio Margan @ IIT @ 2010-01-13 17:19 UTC (permalink / raw)
To: xenomai@xenomai.org
Hi,
I've got "Segmentation fault" from libanalogy.so.1
Here is part of code ...
int s526Analogy::Open()
{
int ret = 0;
boardIsOpen = false;
ret = a4l_open(&dsc, dev_name);
if (ret < 0) {
fprintf(stderr, "s526Analogy::Open : a4l_open %s failed (ret=%d)\n",
dev_name, ret);
return boardIsOpen;
}
fprintf(stderr, "s526Analogy::Open : name : %s\nsubd %d\nrd subd %d\nwr
subd %d\nfd %d\nmagic %x\nsize %d\n",
dsc.board_name,
dsc.nb_subd,
dsc.idx_read_subd,
dsc.idx_write_subd,
dsc.fd,
dsc.magic,
dsc.sbsize);
dsc.sbdata = malloc(dsc.sbsize);
if (dsc.sbdata == NULL) {
ret = -ENOMEM;
fprintf(stderr, "s526Analogy::Open : info buffer allocation failed\n");
return boardIsOpen;
}
ret = a4l_fill_desc(&dsc);
if (ret < 0) {
fprintf(stderr, "s526Analogy::Open : a4l_fill_desc failed (ret=%d)\n", ret);
return boardIsOpen;
}
boardIsOpen = true;
printf("Open %s\n", dev_name);
return boardIsOpen;
}
and here is the back trace from gdb ....
s526Analogy::Open : name : analogy_s526
subd 4
rd subd 1
wr subd 2
fd 0
magic 1234abcd
size 1560
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7151990 (LWP 6138)]
0xb773a64a in a4l_sys_desc () from /usr/xenomai/lib/libanalogy.so.1
Current language: auto; currently asm
(gdb) bt
#0 0xb773a64a in a4l_sys_desc () from /usr/xenomai/lib/libanalogy.so.1
#1 0xb773a748 in a4l_fill_desc () from /usr/xenomai/lib/libanalogy.so.1
#2 0x0804ebb2 in s526Analogy::Open (this=0x805e560) at s526Analogy.cpp:55
#3 0x0804f8c6 in configure_board () at s526Main.cpp:95
#4 0x0804f96a in main () at s526Main.cpp:115
(gdb)
dmesg give me ...
app[6454]: segfault at 40 ip b772964a sp bfd372d0 error 4 in
libanalogy.so.1.0.0[b7728000+3000]
Yesterday I pull xenomai-head to get last commits, before I've run the
application without this segfault.
TIA
Alessio
--
ISTITUTO ITALIANO
DI TECNOLOGIA
Alessio Margan
/Senior Technician/
mail me <mailto:alessio.margan@domain.hid>
Via Morego, 30 16163 Genova
<http://maps.google.com/maps?f=q&hl=en&geocode=&q=via+morego,+30+genova&sll=37.0625,-95.677068&sspn=85.420533,191.601563&ie=UTF8&ll=44.474913,8.907037&spn=0.004685,0.011652&t=h&z=17&iwloc=addr>
www.iit.it <http://www.iit.it>
*Legal Disclaimer*
This electronic message contains information that is confidential. The
information is intended for the use of the addressee only. If you are
not the addressee we would appreciate your notification in this respect.
Please note that any disclosure, copy, distribution or use of the
contents of this message is prohibited and may be unlawful. We have
taken every reasonable precaution to ensure that any kind of attachment
to this e-mail has been swept for viruses. However, we cannot accept
liability for any damage sustained as a result of software viruses and
would advise you to carry out your own virus checks before opening any
attachment.
*Avvertenza legale*
Questo messaggio Email contiene informazioni confidenziali riservate ai
soli destinatari. Qualora veniate in possesso di tali informazioni senza
essere definito come destinatario vi reghiamo di leggere le seguenti
note. Ogni apertura, copia, distribuzione del contenuto del messaggio e
dei suoi allegati è proibito e potrebbe violare le presenti leggi.
Abbiamo attivato ogni possibile e ragionevole precauzione per assicurare
che gli allegati non contengano virus. Comunque non assumeremo alcuna
responsabilità per ogni eventuale danno causato da virus software e
simili in quanto è onere del destinatario verificarne l’assenza in ogni
allegato attuando propri indipendenti controlli.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [Xenomai-help] problem with libanalogy
2010-01-13 17:19 [Xenomai-help] problem with libanalogy Alessio Margan @ IIT
@ 2010-01-14 14:43 ` Simon Boulay
2010-01-14 17:07 ` Alessio Margan @ IIT
0 siblings, 1 reply; 5+ messages in thread
From: Simon Boulay @ 2010-01-14 14:43 UTC (permalink / raw)
To: xenomai
Hi,
On 01/13/2010 06:19 PM, Alessio Margan @ IIT wrote:
> Hi,
>
> I've got "Segmentation fault" from libanalogy.so.1
> Here is part of code ...
>
> int s526Analogy::Open()
> {
> int ret = 0;
> boardIsOpen = false;
>
> ret = a4l_open(&dsc, dev_name);
> if (ret< 0) {
> fprintf(stderr, "s526Analogy::Open : a4l_open %s failed (ret=%d)\n",
> dev_name, ret);
> return boardIsOpen;
> }
>
> fprintf(stderr, "s526Analogy::Open : name : %s\nsubd %d\nrd subd %d\nwr
> subd %d\nfd %d\nmagic %x\nsize %d\n",
> dsc.board_name,
> dsc.nb_subd,
> dsc.idx_read_subd,
> dsc.idx_write_subd,
> dsc.fd,
> dsc.magic,
> dsc.sbsize);
>
> dsc.sbdata = malloc(dsc.sbsize);
> if (dsc.sbdata == NULL) {
> ret = -ENOMEM;
> fprintf(stderr, "s526Analogy::Open : info buffer allocation failed\n");
> return boardIsOpen;
> }
> ret = a4l_fill_desc(&dsc);
> if (ret< 0) {
> fprintf(stderr, "s526Analogy::Open : a4l_fill_desc failed (ret=%d)\n", ret);
> return boardIsOpen;
> }
>
> boardIsOpen = true;
> printf("Open %s\n", dev_name);
>
> return boardIsOpen;
> }
>
> and here is the back trace from gdb ....
>
> s526Analogy::Open : name : analogy_s526
> subd 4
> rd subd 1
> wr subd 2
> fd 0
> magic 1234abcd
> size 1560
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0xb7151990 (LWP 6138)]
> 0xb773a64a in a4l_sys_desc () from /usr/xenomai/lib/libanalogy.so.1
> Current language: auto; currently asm
> (gdb) bt
> #0 0xb773a64a in a4l_sys_desc () from /usr/xenomai/lib/libanalogy.so.1
> #1 0xb773a748 in a4l_fill_desc () from /usr/xenomai/lib/libanalogy.so.1
> #2 0x0804ebb2 in s526Analogy::Open (this=0x805e560) at s526Analogy.cpp:55
> #3 0x0804f8c6 in configure_board () at s526Main.cpp:95
> #4 0x0804f96a in main () at s526Main.cpp:115
> (gdb)
>
> dmesg give me ...
>
> app[6454]: segfault at 40 ip b772964a sp bfd372d0 error 4 in
> libanalogy.so.1.0.0[b7728000+3000]
>
>
> Yesterday I pull xenomai-head to get last commits, before I've run the
> application without this segfault.
I can't reproduce your problem.
Does the same thing happen with the following command:
insn_read -v -d analogy0?
Simon.
>
> TIA
>
> Alessio
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [Xenomai-help] problem with libanalogy
2010-01-14 14:43 ` Simon Boulay
@ 2010-01-14 17:07 ` Alessio Margan @ IIT
2010-01-14 18:38 ` Simon Boulay
0 siblings, 1 reply; 5+ messages in thread
From: Alessio Margan @ IIT @ 2010-01-14 17:07 UTC (permalink / raw)
To: xenomai@xenomai.org
Simon Boulay wrote:
> Hi,
>
> On 01/13/2010 06:19 PM, Alessio Margan @ IIT wrote:
>
>> Hi,
>>
>> I've got "Segmentation fault" from libanalogy.so.1
>> Here is part of code ...
>>
>> int s526Analogy::Open()
>> {
>> int ret = 0;
>> boardIsOpen = false;
>>
>> ret = a4l_open(&dsc, dev_name);
>> if (ret< 0) {
>> fprintf(stderr, "s526Analogy::Open : a4l_open %s failed (ret=%d)\n",
>> dev_name, ret);
>> return boardIsOpen;
>> }
>>
>> fprintf(stderr, "s526Analogy::Open : name : %s\nsubd %d\nrd subd %d\nwr
>> subd %d\nfd %d\nmagic %x\nsize %d\n",
>> dsc.board_name,
>> dsc.nb_subd,
>> dsc.idx_read_subd,
>> dsc.idx_write_subd,
>> dsc.fd,
>> dsc.magic,
>> dsc.sbsize);
>>
>> dsc.sbdata = malloc(dsc.sbsize);
>> if (dsc.sbdata == NULL) {
>> ret = -ENOMEM;
>> fprintf(stderr, "s526Analogy::Open : info buffer allocation failed\n");
>> return boardIsOpen;
>> }
>> ret = a4l_fill_desc(&dsc);
>> if (ret< 0) {
>> fprintf(stderr, "s526Analogy::Open : a4l_fill_desc failed (ret=%d)\n", ret);
>> return boardIsOpen;
>> }
>>
>> boardIsOpen = true;
>> printf("Open %s\n", dev_name);
>>
>> return boardIsOpen;
>> }
>>
>> and here is the back trace from gdb ....
>>
>> s526Analogy::Open : name : analogy_s526
>> subd 4
>> rd subd 1
>> wr subd 2
>> fd 0
>> magic 1234abcd
>> size 1560
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> [Switching to Thread 0xb7151990 (LWP 6138)]
>> 0xb773a64a in a4l_sys_desc () from /usr/xenomai/lib/libanalogy.so.1
>> Current language: auto; currently asm
>> (gdb) bt
>> #0 0xb773a64a in a4l_sys_desc () from /usr/xenomai/lib/libanalogy.so.1
>> #1 0xb773a748 in a4l_fill_desc () from /usr/xenomai/lib/libanalogy.so.1
>> #2 0x0804ebb2 in s526Analogy::Open (this=0x805e560) at s526Analogy.cpp:55
>> #3 0x0804f8c6 in configure_board () at s526Main.cpp:95
>> #4 0x0804f96a in main () at s526Main.cpp:115
>> (gdb)
>>
>> dmesg give me ...
>>
>> app[6454]: segfault at 40 ip b772964a sp bfd372d0 error 4 in
>> libanalogy.so.1.0.0[b7728000+3000]
>>
>>
>> Yesterday I pull xenomai-head to get last commits, before I've run the
>> application without this segfault.
>>
> I can't reproduce your problem.
> Does the same thing happen with the following command:
> insn_read -v -d analogy0?
>
> Simon.
>
> >
>
>> TIA
>>
>> Alessio
>>
>>
>>
Thanks,
insn_read and insn_write works fine, seems that reset the buffer wiht
zeroes works ...
dsc.sbdata = malloc(dsc.sbsize);
bzero(dsc.sbdata, dsc.sbsize);
or
dsc.sbdata = calloc(dsc.sbsize,1);
without I got segfaults.
Any idea ?
Alessio
--
ISTITUTO ITALIANO
DI TECNOLOGIA
Alessio Margan
/Senior Technician/
mail me <mailto:alessio.margan@domain.hid>
Via Morego, 30 16163 Genova
<http://maps.google.com/maps?f=q&hl=en&geocode=&q=via+morego,+30+genova&sll=37.0625,-95.677068&sspn=85.420533,191.601563&ie=UTF8&ll=44.474913,8.907037&spn=0.004685,0.011652&t=h&z=17&iwloc=addr>
www.iit.it <http://www.iit.it>
*Legal Disclaimer*
This electronic message contains information that is confidential. The
information is intended for the use of the addressee only. If you are
not the addressee we would appreciate your notification in this respect.
Please note that any disclosure, copy, distribution or use of the
contents of this message is prohibited and may be unlawful. We have
taken every reasonable precaution to ensure that any kind of attachment
to this e-mail has been swept for viruses. However, we cannot accept
liability for any damage sustained as a result of software viruses and
would advise you to carry out your own virus checks before opening any
attachment.
*Avvertenza legale*
Questo messaggio Email contiene informazioni confidenziali riservate ai
soli destinatari. Qualora veniate in possesso di tali informazioni senza
essere definito come destinatario vi reghiamo di leggere le seguenti
note. Ogni apertura, copia, distribuzione del contenuto del messaggio e
dei suoi allegati è proibito e potrebbe violare le presenti leggi.
Abbiamo attivato ogni possibile e ragionevole precauzione per assicurare
che gli allegati non contengano virus. Comunque non assumeremo alcuna
responsabilità per ogni eventuale danno causato da virus software e
simili in quanto è onere del destinatario verificarne l’assenza in ogni
allegato attuando propri indipendenti controlli.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [Xenomai-help] problem with libanalogy
2010-01-14 17:07 ` Alessio Margan @ IIT
@ 2010-01-14 18:38 ` Simon Boulay
2010-01-15 0:58 ` Alexis Berlemont
0 siblings, 1 reply; 5+ messages in thread
From: Simon Boulay @ 2010-01-14 18:38 UTC (permalink / raw)
To: xenomai
On 01/14/2010 06:07 PM, Alessio Margan @ IIT wrote:
> Simon Boulay wrote:
>> Hi,
>>
>> On 01/13/2010 06:19 PM, Alessio Margan @ IIT wrote:
>>
>>> Hi,
>>>
>>> I've got "Segmentation fault" from libanalogy.so.1
>>> Here is part of code ...
>>>
>>> int s526Analogy::Open()
>>> {
>>> int ret = 0;
>>> boardIsOpen = false;
>>>
>>> ret = a4l_open(&dsc, dev_name);
>>> if (ret< 0) {
>>> fprintf(stderr, "s526Analogy::Open : a4l_open %s failed (ret=%d)\n",
>>> dev_name, ret);
>>> return boardIsOpen;
>>> }
>>>
>>> fprintf(stderr, "s526Analogy::Open : name : %s\nsubd %d\nrd subd %d\nwr
>>> subd %d\nfd %d\nmagic %x\nsize %d\n",
>>> dsc.board_name,
>>> dsc.nb_subd,
>>> dsc.idx_read_subd,
>>> dsc.idx_write_subd,
>>> dsc.fd,
>>> dsc.magic,
>>> dsc.sbsize);
>>>
>>> dsc.sbdata = malloc(dsc.sbsize);
>>> if (dsc.sbdata == NULL) {
>>> ret = -ENOMEM;
>>> fprintf(stderr, "s526Analogy::Open : info buffer allocation failed\n");
>>> return boardIsOpen;
>>> }
>>> ret = a4l_fill_desc(&dsc);
>>> if (ret< 0) {
>>> fprintf(stderr, "s526Analogy::Open : a4l_fill_desc failed (ret=%d)\n", ret);
>>> return boardIsOpen;
>>> }
>>>
>>> boardIsOpen = true;
>>> printf("Open %s\n", dev_name);
>>>
>>> return boardIsOpen;
>>> }
>>>
>>> and here is the back trace from gdb ....
>>>
>>> s526Analogy::Open : name : analogy_s526
>>> subd 4
>>> rd subd 1
>>> wr subd 2
>>> fd 0
>>> magic 1234abcd
>>> size 1560
>>>
>>> Program received signal SIGSEGV, Segmentation fault.
>>> [Switching to Thread 0xb7151990 (LWP 6138)]
>>> 0xb773a64a in a4l_sys_desc () from /usr/xenomai/lib/libanalogy.so.1
>>> Current language: auto; currently asm
>>> (gdb) bt
>>> #0 0xb773a64a in a4l_sys_desc () from /usr/xenomai/lib/libanalogy.so.1
>>> #1 0xb773a748 in a4l_fill_desc () from /usr/xenomai/lib/libanalogy.so.1
>>> #2 0x0804ebb2 in s526Analogy::Open (this=0x805e560) at s526Analogy.cpp:55
>>> #3 0x0804f8c6 in configure_board () at s526Main.cpp:95
>>> #4 0x0804f96a in main () at s526Main.cpp:115
>>> (gdb)
>>>
>>> dmesg give me ...
>>>
>>> app[6454]: segfault at 40 ip b772964a sp bfd372d0 error 4 in
>>> libanalogy.so.1.0.0[b7728000+3000]
>>>
>>>
>>> Yesterday I pull xenomai-head to get last commits, before I've run the
>>> application without this segfault.
>>>
>> I can't reproduce your problem.
>> Does the same thing happen with the following command:
>> insn_read -v -d analogy0?
>>
>> Simon.
>>
>> >
>>
>>> TIA
>>>
>>> Alessio
>>>
>>>
>>>
> Thanks,
>
> insn_read and insn_write works fine, seems that reset the buffer wiht
> zeroes works ...
>
> dsc.sbdata = malloc(dsc.sbsize);
> bzero(dsc.sbdata, dsc.sbsize);
> or
> dsc.sbdata = calloc(dsc.sbsize,1);
>
> without I got segfaults.
>
> Any idea ?
It seems more likely that the problem comes from the application this
time but I can't confirm without repoducing the problem. You can send me
more code if you will. I don't see the scope of the dsc variable for
example.
For my tests, I simply replaced S526Analogy::Open() by a main function
and add this at the begining:
const char *dev_name = "analogy0";
bool boardIsOpen = false;
a4l_desc_t dsc = { .sbdata = NULL };
Does this work for you?
Simon.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [Xenomai-help] problem with libanalogy
2010-01-14 18:38 ` Simon Boulay
@ 2010-01-15 0:58 ` Alexis Berlemont
0 siblings, 0 replies; 5+ messages in thread
From: Alexis Berlemont @ 2010-01-15 0:58 UTC (permalink / raw)
To: xenomai@xenomai.org
Simon Boulay wrote:
> On 01/14/2010 06:07 PM, Alessio Margan @ IIT wrote:
>> Simon Boulay wrote:
>>> Hi,
>>>
>>> On 01/13/2010 06:19 PM, Alessio Margan @ IIT wrote:
>>>
>>>> Hi,
>>>>
>>>> I've got "Segmentation fault" from libanalogy.so.1
>>>> Here is part of code ...
>>>>
>>>> int s526Analogy::Open()
>>>> {
>>>> int ret = 0;
>>>> boardIsOpen = false;
>>>>
>>>> ret = a4l_open(&dsc, dev_name);
>>>> if (ret< 0) {
>>>> fprintf(stderr, "s526Analogy::Open : a4l_open %s failed (ret=%d)\n",
>>>> dev_name, ret);
>>>> return boardIsOpen;
>>>> }
>>>>
>>>> fprintf(stderr, "s526Analogy::Open : name : %s\nsubd %d\nrd subd %d\nwr
>>>> subd %d\nfd %d\nmagic %x\nsize %d\n",
>>>> dsc.board_name,
>>>> dsc.nb_subd,
>>>> dsc.idx_read_subd,
>>>> dsc.idx_write_subd,
>>>> dsc.fd,
>>>> dsc.magic,
>>>> dsc.sbsize);
>>>>
>>>> dsc.sbdata = malloc(dsc.sbsize);
>>>> if (dsc.sbdata == NULL) {
>>>> ret = -ENOMEM;
>>>> fprintf(stderr, "s526Analogy::Open : info buffer allocation failed\n");
>>>> return boardIsOpen;
>>>> }
>>>> ret = a4l_fill_desc(&dsc);
>>>> if (ret< 0) {
>>>> fprintf(stderr, "s526Analogy::Open : a4l_fill_desc failed (ret=%d)\n", ret);
>>>> return boardIsOpen;
>>>> }
>>>>
>>>> boardIsOpen = true;
>>>> printf("Open %s\n", dev_name);
>>>>
>>>> return boardIsOpen;
>>>> }
>>>>
>>>> and here is the back trace from gdb ....
>>>>
>>>> s526Analogy::Open : name : analogy_s526
>>>> subd 4
>>>> rd subd 1
>>>> wr subd 2
>>>> fd 0
>>>> magic 1234abcd
>>>> size 1560
>>>>
>>>> Program received signal SIGSEGV, Segmentation fault.
>>>> [Switching to Thread 0xb7151990 (LWP 6138)]
>>>> 0xb773a64a in a4l_sys_desc () from /usr/xenomai/lib/libanalogy.so.1
>>>> Current language: auto; currently asm
>>>> (gdb) bt
>>>> #0 0xb773a64a in a4l_sys_desc () from /usr/xenomai/lib/libanalogy.so.1
>>>> #1 0xb773a748 in a4l_fill_desc () from /usr/xenomai/lib/libanalogy.so.1
>>>> #2 0x0804ebb2 in s526Analogy::Open (this=0x805e560) at s526Analogy.cpp:55
>>>> #3 0x0804f8c6 in configure_board () at s526Main.cpp:95
>>>> #4 0x0804f96a in main () at s526Main.cpp:115
>>>> (gdb)
>>>>
>>>> dmesg give me ...
>>>>
>>>> app[6454]: segfault at 40 ip b772964a sp bfd372d0 error 4 in
>>>> libanalogy.so.1.0.0[b7728000+3000]
>>>>
>>>>
>>>> Yesterday I pull xenomai-head to get last commits, before I've run the
>>>> application without this segfault.
>>>>
>>> I can't reproduce your problem.
>>> Does the same thing happen with the following command:
>>> insn_read -v -d analogy0?
>>>
>>> Simon.
>>>
>>> >
>>>
>>>> TIA
>>>>
>>>> Alessio
>>>>
>>>>
>>>>
>> Thanks,
>>
>> insn_read and insn_write works fine, seems that reset the buffer wiht
>> zeroes works ...
>>
>> dsc.sbdata = malloc(dsc.sbsize);
>> bzero(dsc.sbdata, dsc.sbsize);
>> or
>> dsc.sbdata = calloc(dsc.sbsize,1);
>>
>> without I got segfaults.
>>
>> Any idea ?
> It seems more likely that the problem comes from the application this
> time but I can't confirm without repoducing the problem. You can send me
> more code if you will. I don't see the scope of the dsc variable for
> example.
> For my tests, I simply replaced S526Analogy::Open() by a main function
> and add this at the begining:
> const char *dev_name = "analogy0";
> bool boardIsOpen = false;
> a4l_desc_t dsc = { .sbdata = NULL };
>
> Does this work for you?
Argh! There was a bug in the initialization procedure of the allocated
buffer (with malloc(dsc.sbsize)). Some field of an internal analogy
structure (a4l_root) was not set to 0.
I reproduced the bug by memsetting random values into the allocated buffer.
I committed the fixes and made a pull request.
>
> Simon.
>
>
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help
>
Alexis.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-01-15 0:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-13 17:19 [Xenomai-help] problem with libanalogy Alessio Margan @ IIT
2010-01-14 14:43 ` Simon Boulay
2010-01-14 17:07 ` Alessio Margan @ IIT
2010-01-14 18:38 ` Simon Boulay
2010-01-15 0:58 ` Alexis Berlemont
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.