[riot-users] ccnx-lite-relay example crashing in native board

Nazmul Alam fadedreamz at gmail.com
Wed Aug 31 01:50:20 CEST 2016


Hi,
The issue previously mentioned was due to same signature of two different
types of malloc/free function.
The malloc/free used by printf was causing the crash as it was trying to
use the malloc/free defined from tlsf library, causing the call to
search_suitable_block() before actually allocating memory by the library.

It can be solved by adding following define in the Makefile to specify any
prefix for the tlsf specific malloc/free

CFLAGS += -DTLSF_MALLOC_PREFIX=mytlsf_

this will make tlsf malloc to become mytlsf_malloc/mytlsf_free and then the
printf will use the correct malloc/free function.


On Tue, Aug 30, 2016 at 5:05 PM, Nazmul Alam <fadedreamz at gmail.com> wrote:

> Hello,
> I am new to RIOT and trying to run the ccnx-lite-relay example on native
> system. The compilation goes fine but when I try to run, it crashes with
> following error (with stacktrace):
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x0805924e in search_suitable_block (fli=0xffffc830, sli=0xffffc834)
>     at /home/fadedreamz/riotos/RIOT/examples/ccn-lite-relay/bin/
> pkg/native/tlsf/src/tlsf.c:346
> 346        unsigned int sl_map = control->sl_bitmap[fl] & (((unsigned
> int)~0) << sl);
> (gdb) bt
> #0  0x0805924e in search_suitable_block (fli=0xffffc830, sli=0xffffc834)
>     at /home/fadedreamz/riotos/RIOT/examples/ccn-lite-relay/bin/
> pkg/native/tlsf/src/tlsf.c:346
> #1  0x08059a0c in block_locate_free (size=1024)
>     at /home/fadedreamz/riotos/RIOT/examples/ccn-lite-relay/bin/
> pkg/native/tlsf/src/tlsf.c:555
> #2  0x08059ed7 in tlsf_malloc (size=1024)
>     at /home/fadedreamz/riotos/RIOT/examples/ccn-lite-relay/bin/
> pkg/native/tlsf/src/tlsf.c:715
> #3  0x0805a26c in malloc (bytes=1024)
>     at /home/fadedreamz/riotos/RIOT/examples/ccn-lite-relay/bin/
> pkg/native/tlsf/src/tlsf-malloc.c:9
> #4  0xf7e5cd3e in _IO_file_doallocate () from /lib32/libc.so.6
> #5  0xf7e6a457 in _IO_doallocbuf () from /lib32/libc.so.6
> #6  0xf7e697f9 in _IO_file_overflow () from /lib32/libc.so.6
> #7  0xf7e68964 in _IO_file_xsputn () from /lib32/libc.so.6
> #8  0xf7e41d17 in vfprintf () from /lib32/libc.so.6
> #9  0xf7e48f66 in printf () from /lib32/libc.so.6
> #10 0x08049749 in usage_exit ()
>     at /home/fadedreamz/riotos/RIOT/cpu/native/startup.c:198
> #11 0x08048eb4 in startup (argc=1, argv=0xffffd024)
>     at /home/fadedreamz/riotos/RIOT/cpu/native/startup.c:254
> #12 0x0805cdcb in __libc_csu_init ()
>
> gdb shows that
> 5: control = (control_t *) 0x0
>
> The control is a null pointer, so I guess the crash is due to null pointer
> dereferencing.
>
> Is there any additional parameter required for ccnx-lite-relay for running
> it over the native system?
>
> Thanks in advance.
>
> --
> with best regards,
>        Nazmul Alam Shovon
>
>
> *শুভেচ্ছান্তে,       নাজমুল আলম শোভন*
>
> blog : https://yourdigitaleffects.wordpress.com/
>



-- 
with best regards,
       Nazmul Alam Shovon


*শুভেচ্ছান্তে,       নাজমুল আলম শোভন*

blog : https://yourdigitaleffects.wordpress.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/users/attachments/20160830/88cec631/attachment.html>


More information about the users mailing list