TI AM335x Valgrind
Valgrind 3.15
先 source 環境設定。
vi configure
找 armv7,將它改成 arm
修改原始碼
vi coregrind/m_redir.c
分別找以下的字串
strcmp
index
memcpy
strlen
並將 add_hardwired_spec 針對 ld-linux.so.3/ld-linux-armhf.so.3 的部份註解掉。如:
/* strcmp */
// add_hardwired_spec(
// "ld-linux.so.3", "strcmp",
// (Addr)&VG_(arm_linux_REDIR_FOR_strcmp),
// complain_about_stripped_glibc_ldso
// );
// add_hardwired_spec(
// "ld-linux-armhf.so.3", "strcmp",
// (Addr)&VG_(arm_linux_REDIR_FOR_strcmp),
// complain_about_stripped_glibc_ldso
// );
編譯指令:
CC=arm-linux-gnueabi-gcc ./configure --host=arm-linux-gnueabi --target=arm-linux-gnueabi CFLAGS=-static
make
make install DESTDIR=XXX
目前看起來「似乎」可以用,但要檢查的時候有出現以下的錯誤。不過仍可以檢查的樣子。
==2920== Memcheck, a memory error detector
==2920== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==2920== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==2920== Command: ./XXX
==2920==
disInstr(arm): unhandled instruction: 0xEE190F1D
cond=14(0xE) 27:20=225(0xE1) 4:4=1 3:0=13(0xD)
==2920== valgrind: Unrecognised instruction at address 0x4cca188.
==2920== at 0x4CCA188: ??? (in /lib/libcrypto.so.1.0.0)
==2920== Your program just tried to execute an instruction that Valgrind
==2920== did not recognise. There are two possible reasons for this.
==2920== 1. Your program has a bug and erroneously jumped to a non-code
==2920== location. If you are running Memcheck and you just saw a
==2920== warning about a bad jump, it's probably your program's fault.
==2920== 2. The instruction is legitimate but Valgrind doesn't handle it,
==2920== i.e. it's Valgrind's fault. If you think this is the case or
==2920== you are not sure, please let us know and we'll try to fix it.
==2920== Either way, Valgrind will now raise a SIGILL signal which will
==2920== probably kill your program.
==2920== Warning: noted but unhandled ioctl 0x4611 with no size/direction hints.
==2920== This could cause spurious value errors to appear.
==2920== See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper.
==2920== Warning: noted but unhandled ioctl 0x4b51 with no size/direction hints.
==2920== This could cause spurious value errors to appear.
==2920== See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper.
==2920== Syscall param ioctl(generic) points to unaddressable byte(s)
==2920== at 0x617D1BC: ioctl (in /lib/libc-2.15.so)
==2920== by 0x70A7703: ??? (in /usr/local/Qt-5.5.0/plugins/platforms/libqlinuxfb.so)
==2920== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==2920==
先 source 環境設定。
vi configure
找 armv7,將它改成 arm
修改原始碼
vi coregrind/m_redir.c
分別找以下的字串
strcmp
index
memcpy
strlen
並將 add_hardwired_spec 針對 ld-linux.so.3/ld-linux-armhf.so.3 的部份註解掉。如:
/* strcmp */
// add_hardwired_spec(
// "ld-linux.so.3", "strcmp",
// (Addr)&VG_(arm_linux_REDIR_FOR_strcmp),
// complain_about_stripped_glibc_ldso
// );
// add_hardwired_spec(
// "ld-linux-armhf.so.3", "strcmp",
// (Addr)&VG_(arm_linux_REDIR_FOR_strcmp),
// complain_about_stripped_glibc_ldso
// );
編譯指令:
CC=arm-linux-gnueabi-gcc ./configure --host=arm-linux-gnueabi --target=arm-linux-gnueabi CFLAGS=-static
make
make install DESTDIR=XXX
目前看起來「似乎」可以用,但要檢查的時候有出現以下的錯誤。不過仍可以檢查的樣子。
==2920== Memcheck, a memory error detector
==2920== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==2920== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==2920== Command: ./XXX
==2920==
disInstr(arm): unhandled instruction: 0xEE190F1D
cond=14(0xE) 27:20=225(0xE1) 4:4=1 3:0=13(0xD)
==2920== valgrind: Unrecognised instruction at address 0x4cca188.
==2920== at 0x4CCA188: ??? (in /lib/libcrypto.so.1.0.0)
==2920== Your program just tried to execute an instruction that Valgrind
==2920== did not recognise. There are two possible reasons for this.
==2920== 1. Your program has a bug and erroneously jumped to a non-code
==2920== location. If you are running Memcheck and you just saw a
==2920== warning about a bad jump, it's probably your program's fault.
==2920== 2. The instruction is legitimate but Valgrind doesn't handle it,
==2920== i.e. it's Valgrind's fault. If you think this is the case or
==2920== you are not sure, please let us know and we'll try to fix it.
==2920== Either way, Valgrind will now raise a SIGILL signal which will
==2920== probably kill your program.
==2920== Warning: noted but unhandled ioctl 0x4611 with no size/direction hints.
==2920== This could cause spurious value errors to appear.
==2920== See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper.
==2920== Warning: noted but unhandled ioctl 0x4b51 with no size/direction hints.
==2920== This could cause spurious value errors to appear.
==2920== See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a proper wrapper.
==2920== Syscall param ioctl(generic) points to unaddressable byte(s)
==2920== at 0x617D1BC: ioctl (in /lib/libc-2.15.so)
==2920== by 0x70A7703: ??? (in /usr/local/Qt-5.5.0/plugins/platforms/libqlinuxfb.so)
==2920== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==2920==
留言
張貼留言