valgrind:如何获得有意义的回溯?

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (1)
  • 关注 (0)
  • 查看 (51)

在我的Debian / sid系统上,通过valgrind运行程序时出现了大量错误。不幸的是,错误并没有告诉我原因,valgrind认为问题在于:

==24268== Use of uninitialised value of size 8
==24268==    at 0x51CF257: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==24268==    by 0x18D4F9: ??? (in /path/to/app)
==24268==    by 0x19A369: ??? (in /path/to/app)
==24268==    by 0x19A6F0: ??? (in /path/to/app)
==24268==    by 0x19A8C7: ??? (in /path/to/app)
==24268==    by 0x19267A: ??? (in /path/to/app)
==24268==    by 0x192857: ??? (in /path/to/app)
==24268==    by 0x192A20: ??? (in /path/to/app)
==24268==    by 0x19ABF6: ??? (in /path/to/app)
==24268==    by 0x11E0B9: ??? (in /path/to/app)
==24268==    by 0x5155B16: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==24268==  Uninitialised value was created by a stack allocation
==24268==    at 0x19A2E0: ??? (in /path/to/app)
==24268== 
==24268== Use of uninitialised value of size 8
==24268==    at 0x51CF440: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==24268==    by 0x18D4F9: ??? (in /path/to/app)
==24268==    by 0x19A369: ??? (in /path/to/app)
==24268==    by 0x19A6F0: ??? (in /path/to/app)
==24268==    by 0x19A8C7: ??? (in /path/to/app)
==24268==    by 0x19267A: ??? (in /path/to/app)
==24268==    by 0x192857: ??? (in /path/to/app)
==24268==    by 0x192A20: ??? (in /path/to/app)
==24268==    by 0x19ABF6: ??? (in /path/to/app)
==24268==    by 0x11E0B9: ??? (in /path/to/app)
==24268==    by 0x5155B16: ??? (in /lib/x86_64-linux-gnu/libc-2.27.so)
==24268==  Uninitialised value was created by a stack allocation
==24268==    at 0x19A2E0: ??? (in /path/to/app)
==24268== 

当然程序已编译-g,之后没有删除调试符号:

$ file app
app: ELF 64-bit LSB pie executable x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=6a2de5a8779ca1f745cb79999f6e24adc73def7d, with debug_info, not stripped

还有一些系统信息:

$ dpkg-query -W gcc libc6 valgrind
gcc         4:7.3.0-3
libc6:amd64 2.27-4
libc6:i386  2.27-4
valgrind    1:3.13.0-2+b1
$ valgrind --version
valgrind-3.13.0

所以我的问题是:为什么valgrind没有告诉我问题发生在哪里,我该如何解决?

提问于

所属标签

可能回答问题的人

  • 嗨喽你好

    7 粉丝480 提问8 回答
  • uncle_light

    5 粉丝518 提问7 回答
  • 富有想象力的人

    3 粉丝0 提问6 回答
  • 人生的旅途

    10 粉丝484 提问6 回答

扫码关注云+社区

领取腾讯云代金券