I am trying to run valgrind on my Cavium Octeon III processor. I cross-compiled the valgrind package using below configure command -
export CROSS_COMPILE=/opt/CAVIUMsdk312/OCTEON-SDK/tools/bin/mips64-octeon-linux-gnu-
./configure --target=mips64-octeon-linux-gnu \
--host=mips64-octeon-linux-gnu \
--prefix=/home/prateeka/packages/valgrind-3.19.0/install \
CFLAGS=-static \
CC=${CROSS_COMPILE}gcc \
CPP=${CROSS_COMPILE}cpp \
CXX=${CROSS_COMPILE}g++ \
LD=${CROSS_COMPILE}ld \
AR=${CROSS_COMPILE}ar
I also created a small application with deliberate memory leak to test the valgrind. On running the application with valgrind, I am getting Bus error.
Command line log:
-bash-4.3# export VALGRIND_LIB=/etc/valgrind-bins/libexec/valgrind
-bash-4.3# ./bin/valgrind ./mem-leak
==20887== Memcheck, a memory error detector
==20887== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==20887== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info
==20887== Command: ./mem-leak
==20887==
==20887== Invalid read of size 8
==20887== at 0x40BEEE4: __ctype_init (in /lib64/libc-2.16.so)
==20887== by 0x40AFC8C: _init (in /lib64/libc-2.16.so)
==20887== by 0x40129D8: call_init (in /lib64/ld-2.16.so)
==20887== by 0x4012BC8: _dl_init (in /lib64/ld-2.16.so)
==20887== by 0x400328C: _dl_start_user (in /lib64/ld-2.16.so)
==20887== Address 0xffffffffffff9000 is not stack'd, malloc'd or (recently) free'd
==20887==
==20887==
==20887== Process terminating with default action of signal 10 (SIGBUS)
==20887== at 0x40BEEE4: __ctype_init (in /lib64/libc-2.16.so)
==20887== by 0x40AFC8C: _init (in /lib64/libc-2.16.so)
==20887== by 0x40129D8: call_init (in /lib64/ld-2.16.so)
==20887== by 0x4012BC8: _dl_init (in /lib64/ld-2.16.so)
==20887== by 0x400328C: _dl_start_user (in /lib64/ld-2.16.so)
==20887==
==20887== HEAP SUMMARY:
==20887== in use at exit: 0 bytes in 0 blocks
==20887== total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==20887==
==20887== All heap blocks were freed -- no leaks are possible
==20887==
==20887== For lists of detected and suppressed errors, rerun with: -s
==20887== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Bus error
I didn't find any illegal virtual address access error in dmesg kernel message buffer.
Please suggest how to debug.