valgrind mips不显示堆栈跟踪

时间:2018-02-18 13:12:56

标签: c mips valgrind

我在mips平台上使用valgrind 3.13,但是我编写了一个测试程序,发现valgrind没有跟踪到文件行号,对于x86它运行正常。可能是什么问题?

# valgrind --trace-children=yes --leak-check=yes --num-callers=20 /tmp/a.out

==2957== Memcheck, a memory error detector
==2957== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==2957== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==2957== Command: /tmp/a.out
==2957==
==2957== Invalid write of size 4
==2957==    at 0x4000B90: ??? (in /lib/ld-uClibc.so.0)
==2957==    by 0x4000B3C: ??? (in /lib/ld-uClibc.so.0)
==2957==  Address 0x7e8bdcbc is on thread 1's stack
==2957==  4 bytes below stack pointer
==2957==
==2957== Conditional jump or move depends on uninitialised value(s)
==2957==    at 0x48B4A44: ??? (in /lib/libc.so.0)
==2957==    by 0x48ADBE4: ??? (in /lib/libc.so.0)
==2957==
buf=test buf

in func1:x[10]=10
/tmp/a.out: can't resolve symbol '__libc_freeres'
==2957==
==2957== HEAP SUMMARY:
==2957==     in use at exit: 0 bytes in 0 blocks
==2957==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==2957==
==2957== All heap blocks were freed -- no leaks are possible
==2957==
==2957== For counts of detected and suppressed errors, rerun with: -v
==2957== Use --track-origins=yes to see where uninitialised values come from
==2957== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)

下面是我的test.c,使用mips工具链编译,选项为“-g -O0”

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

func1()
{
    int *x=malloc(10*sizeof(int *));
    x[10]=10;
    printf("in func1:x[10]=%d\n", x[10]);
}

main()
{
    char buf[2];
    char buf2[10];

    strcpy(buf,"test buf\n");
    printf("buf=%s\n", buf);
    func1();
}

0 个答案:

没有答案
相关问题