[Xenomai] Fwd: rt,Heap segfault with unittest

Benjamin ROUZAUD brouzaud at numalliance.com
Tue Dec 20 11:07:36 CET 2016


After your answer, we run our test application over GDB and inspect the
stack backtrace for locate the offending code.
We run the two applications with a session (run --session=mysession) and
the second return a seg fault with this backtrace :

#0  0xb7fa58bb in alloc_block () from /usr/xenomai/lib/libcopperplate.so.0
No symbol table info available.
#1  0xb7fb30f5 in rt_heap_create () from /usr/xenomai/lib/libalchemy.so.0
No symbol table info available.
#2  0x08049653 in mbuff_alloc (nom=nom at entry=0x804a7b0 "outil_automat",
taille=taille at entry=3353) at projetC.cpp:69
         ptr = 0xb6865578 ""
         err = <optimized out>
         already_allocated = 6144
         loc_taille = <optimized out>
#3  0x08049129 in main () at projetC.cpp:31

We try to debug and we find the line bug. This is the file


in the function

static void  *alloc_block(struct shared_heap *heap, size_t size)

at the line

heap->buckets[ilog].freelist = *((memoff_t *)block);

The bug appears when we try to allocate an existing block memory with
the function

rt_heap_create () from /usr/xenomai/lib/libalchemy.so.0

using xnmalloc()

We use a new 32 bits system with the xenomai-3.0.3 version (work with
the old xenomai-3. version). We find again the differents file at this
google drive (cf

B. Rouzaud
R&D Numalliance

Le 03/12/2016 18:16, Philippe Gerum a écrit :
> On 12/01/2016 04:21 PM, Benjamin ROUZAUD wrote:
>> the process C tries to create or link differents allocation areas but it
>> crashes with segfault after many
>> creation.
> Then you may want to run your test application over GDB, and inspect the
> stack backtrace for locating the offending code. You could also build it
> for Mercury in debug mode (--enable-debug=full) instead of Cobalt, and
> use Valgrind to detect memory errors.

More information about the Xenomai mailing list