2 hmzx0606 1 hmzx0606_1 于 2014.09.27 15:48 提问

android平台使用valgrind分析内存,行号不正确

android 4.4.4,使用源码里自带的valgrind进行分析,自己写了个数组越界的demo。然后使用valgrind分析,结果发现定位的行号有问题。请教一下如何才能得到正确的行号。分析结果如下。

`==2687== Memcheck, a memory error detector

==2687== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.

==2687== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==2687== Command: /system/bin/app_process /system/bin --application --nice-name=com.lhkj.blurdemo com.android.internal.os.WrapperInit 37 18 android.app.ActivityThread
==2687== Parent PID: 2686
==2687==
==2687== Warning: set address range perms: large range [0x6133000, 0x26133000) (noaccess)
==2687== Invalid read of size 4
==2687== at 0x40053C8: ??? (in /system/bin/linker)
==2687== Address 0x374975e0 is 32 bytes inside a block of size 35 alloc'd
==2687== at 0x48993CC: malloc (in /system/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==2687== by 0x60D6677: dvmCreateCstrFromString(StringObject const*) (in /system/lib/libdvm.so)
==2687==
disInstr(thumb): unhandled instruction: 0x4771 0x5F43
==2687== Mismatched free() / delete / delete []
==2687== at 0x48972B4: operator delete (in /system/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==2687== by 0x60E714D: ??? (in /system/lib/libdvm.so)
==2687== Address 0x3c5ce740 is 0 bytes inside a block of size 188 alloc'd
==2687== at 0x48993CC: malloc (in /system/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==2687== by 0x61059B9: dexReadAndVerifyClassData(unsigned char const**, unsigned char const*) (in /system/lib/libdvm.so)
==2687==
==2687== Conditional jump or move depends on uninitialised value(s)
==2687== at 0x4004D74: ??? (in /system/bin/linker)
==2687== by 0x400101D: _start (in /system/bin/linker)
==2687== Uninitialised value was created by a stack allocation
==2687== at 0x4AC959C: ??? (in /system/lib/libEGL.so)
==2687==
==2687== Conditional jump or move depends on uninitialised value(s)
==2687== at 0x482AC66: mmap (in /system/lib/libc.so)
==2687== Uninitialised value was created by a stack allocation
==2687== at 0x3E0BF9E8: ioctl_kgsl_device_getproperty (in /system/vendor/lib/libgsl.so)
==2687==
==2687== Syscall param mmap2(length) contains uninitialised byte(s)
==2687== at 0x483842C: __mmap2 (in /system/lib/libc.so)
==2687== Uninitialised value was created by a stack allocation
==2687== at 0x3E0BF9E8: ioctl_kgsl_device_getproperty (in /system/vendor/lib/libgsl.so)
==2687==
==2687== Syscall param mmap2(offset) contains uninitialised byte(s)
==2687== at 0x483842C: __mmap2 (in /system/lib/libc.so)
==2687== Uninitialised value was created by a stack allocation
==2687== at 0x3E0BF9E8: ioctl_kgsl_device_getproperty (in /system/vendor/lib/libgsl.so)
==2687==
==2687== Invalid read of size 4
==2687== at 0x4004EE4: ??? (in /system/bin/linker)
==2687== by 0x400101D: _start (in /system/bin/linker)
==2687== Address 0x368aabf0 is 48 bytes inside a block of size 50 alloc'd
==2687== at 0x48993CC: malloc (in /system/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==2687== by 0x60D0BC9: ??? (in /system/lib/libdvm.so)
==2687==
==2687== Conditional jump or move depends on uninitialised value(s)
==2687== at 0x3E0B8400: gsl_command_readtimestamp (in /system/vendor/lib/libgsl.so)
==2687== Uninitialised value was created by a stack allocation
==2687== at 0x3E0BF9E8: ioctl_kgsl_device_getproperty (in /system/vendor/lib/libgsl.so)
==2687==
==2687== Conditional jump or move depends on uninitialised value(s)
==2687== at 0x3E0B840C: gsl_command_readtimestamp (in /system/vendor/lib/libgsl.so)
==2687== Uninitialised value was created by a stack allocation
==2687== at 0x3E0BF9E8: ioctl_kgsl_device_getproperty (in /system/vendor/lib/libgsl.so)
==2687==
==2687== Syscall param socketcall.sendto(msg) points to uninitialised byte(s)
==2687== at 0x48392F4: sendto (in /system/lib/libc.so)
==2687== Address 0xbdafd72c is on thread 1's stack
==2687== Uninitialised value was created by a stack allocation
==2687== at 0x4B4FF66: android::InputConsumer::sendUnchainedFinishedSignal(unsigned int, bool) (in /system/lib/libinput.so)
==2687==
`

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!