Firefly开源社区

打印 上一主题 下一主题

[Linux] valgrind不显示行号

87

积分

0

威望

0

贡献

技术小白

积分
87

valgrind不显示行号

发表于 2022-1-19 15:39:20      浏览:4437 | 回复:0        打印      只看该作者   [复制链接] 楼主
如下,t是我编写的一个存在内存泄露的小程序,用valgrind成功检测到了,但是没有显示行号,在3399的ubuntu系统和buildroot系统下均是如此:
  1. root@firefly:~# valgrind --leak-check=full ./t
  2. ==2693== Memcheck, a memory error detector
  3. ==2693== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
  4. ==2693== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
  5. ==2693== Command: ./t
  6. ==2693==
  7. hi
  8. ==2693==
  9. ==2693== HEAP SUMMARY:
  10. ==2693==     in use at exit: 1 bytes in 1 blocks
  11. ==2693==   total heap usage: 2 allocs, 1 frees, 1,025 bytes allocated
  12. ==2693==
  13. ==2693== 1 bytes in 1 blocks are definitely lost in loss record 1 of 1
  14. ==2693==    at 0x4845BFC: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm64-linux.so)
  15. ==2693==
  16. ==2693== LEAK SUMMARY:
  17. ==2693==    definitely lost: 1 bytes in 1 blocks
  18. ==2693==    indirectly lost: 0 bytes in 0 blocks
  19. ==2693==      possibly lost: 0 bytes in 0 blocks
  20. ==2693==    still reachable: 0 bytes in 0 blocks
  21. ==2693==         suppressed: 0 bytes in 0 blocks
  22. ==2693==
  23. ==2693== For counts of detected and suppressed errors, rerun with: -v
  24. ==2693== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
  25. root@firefly:~#
复制代码



而检测相同的程序t,在x86下就会显示行号,如下:
  1. ==17689== Memcheck, a memory error detector
  2. ==17689== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
  3. ==17689== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
  4. ==17689== Command: ./t
  5. ==17689==
  6. hi
  7. ==17689==
  8. ==17689== HEAP SUMMARY:
  9. ==17689==     in use at exit: 1 bytes in 1 blocks
  10. ==17689==   total heap usage: 2 allocs, 1 frees, 1,025 bytes allocated
  11. ==17689==
  12. ==17689== 1 bytes in 1 blocks are definitely lost in loss record 1 of 1
  13. ==17689==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
  14. ==17689==    [color=Red]by 0x10869B: main (t.c:6)[/color]
  15. ==17689==
  16. ==17689== LEAK SUMMARY:
  17. ==17689==    definitely lost: 1 bytes in 1 blocks
  18. ==17689==    indirectly lost: 0 bytes in 0 blocks
  19. ==17689==      possibly lost: 0 bytes in 0 blocks
  20. ==17689==    still reachable: 0 bytes in 0 blocks
  21. ==17689==         suppressed: 0 bytes in 0 blocks
  22. ==17689==
  23. ==17689== For counts of detected and suppressed errors, rerun with: -v
  24. ==17689== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
复制代码

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

友情链接 : 爱板网 电子发烧友论坛 云汉电子社区 粤ICP备14022046号-2
快速回复 返回顶部 返回列表