rt,Heap segfault with unittest
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hello,
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@entry=0x804a7b0 "outil_automat", taille=taille@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
/lib/copperplate/heapobj-pshared.c
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
https://drive.google.com/drive/folders/0B7MmKH2j6iMYWjJfTzVOcFVTRDQ?usp=sharing).
Cordially,
B. Rouzaud
R&D Numalliance
Quoted 11 lines · Philippe Gerum
Quoted 4 lines · Benjamin ROUZAUD
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.