Всем привет!
Эта тема была уже неоднократно прожёвана, однако ответы на неё разнятся, а сама суть по-прежнему проявляется. А суть в том, что valgrind сегфолтится(!) даже на простейшем хелловорлде.
ecko@localhost ~/develop $ cat test.c
#include <stdio.h>
int main(void)
{
int m = 5;
printf("m=%d\n", m);
return 0;
}
ecko@localhost ~/develop $ valgrind --leak-check=yes ./test
==17113== Memcheck, a memory error detector
==17113== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==17113== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info
==17113== Command: ./test
==17113==
vex amd64->IR: unhandled instruction bytes: 0x8F 0xEA 0xF8 0x10 0xCE 0x3 0x1D 0x0
vex amd64->IR: REX=0 REX.W=0 REX.R=0 REX.X=0 REX.B=0
vex amd64->IR: VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=NONE
vex amd64->IR: PFX.66=0 PFX.F2=0 PFX.F3=0
==17113== valgrind: Unrecognised instruction at address 0x4011616.
==17113== at 0x4011616: _dl_allocate_tls_storage (dl-tls.c:353)
==17113== by 0x40010FF: init_tls (rtld.c:765)
==17113== by 0x4003D3D: dl_main (rtld.c:1816)
==17113== by 0x401543F: _dl_sysdep_start (dl-sysdep.c:249)
==17113== by 0x4004C93: _dl_start (rtld.c:331)
==17113== by 0x4001407: ??? (in /lib64/ld-2.19.so)
==17113== Your program just tried to execute an instruction that Valgrind
==17113== did not recognise. There are two possible reasons for this.
==17113== 1. Your program has a bug and erroneously jumped to a non-code
==17113== location. If you are running Memcheck and you just saw a
==17113== warning about a bad jump, it's probably your program's fault.
==17113== 2. The instruction is legitimate but Valgrind doesn't handle it,
==17113== i.e. it's Valgrind's fault. If you think this is the case or
==17113== you are not sure, please let us know and we'll try to fix it.
==17113== Either way, Valgrind will now raise a SIGILL signal which will
==17113== probably kill your program.
==17113==
==17113== Process terminating with default action of signal 4 (SIGILL)
==17113== Illegal opcode at address 0x4011616
==17113== at 0x4011616: _dl_allocate_tls_storage (dl-tls.c:353)
==17113== by 0x40010FF: init_tls (rtld.c:765)
==17113== by 0x4003D3D: dl_main (rtld.c:1816)
==17113== by 0x401543F: _dl_sysdep_start (dl-sysdep.c:249)
==17113== by 0x4004C93: _dl_start (rtld.c:331)
==17113== by 0x4001407: ??? (in /lib64/ld-2.19.so)
==17113== Jump to the invalid address stated on the next line
==17113== at 0x626: ???
==17113== Address 0x626 is not stack'd, malloc'd or (recently) free'd
==17113==
==17113==
==17113== Process terminating with default action of signal 11 (SIGSEGV)
==17113== Bad permissions for mapped region at address 0x626
==17113== at 0x626: ???
==17113==
==17113== HEAP SUMMARY:
==17113== in use at exit: 0 bytes in 0 blocks
==17113== total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==17113==
==17113== All heap blocks were freed -- no leaks are possible
==17113==
==17113== For counts of detected and suppressed errors, rerun with: -v
==17113== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 1 from 1)
Ошибка сегментирования
Конфиги здесь:
ecko@localhost /etc/portage $ cat package.env
## Offtop skipped ##
sys-devel/gcc no-tmpfs.conf splitdebug.conf
sys-libs/glibc splitdebug.conf
ecko@localhost /etc/portage $ cat env/splitdebug.conf
CFLAGS="${CFLAGS} -ggdb"
FEATURES="splitdebug"
Кто-нибудь, объясните, пожалуйста, внятно, что я здесь сделал не так! Заранее спасибо!