gcc mtrace在archlinux中不生成mtrace数据文件,但在debian中可以工作

xzv2uavs  于 2023-11-19  发布在  Linux
关注(0)|答案(1)|浏览(197)

我在archlinux手册中使用mtrace作为mtrace示例,但它不生成mtrace数据文件/tmp/t
mtrace信息:

  1. mtrace (GNU libc) 2.36
  2. Copyright (C) 2022 Free Software Foundation, Inc.
  3. This is free software; see the source for copying conditions. There is NO
  4. warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  5. Written by Ulrich Drepper <[email protected]>

字符串
glibc info:

  1. local/glibc 2.36-6
  2. GNU C Library


gcc info:

  1. gcc (GCC) 12.2.0
  2. Copyright (C) 2022 Free Software Foundation, Inc.
  3. This is free software; see the source for copying conditions. There is NO
  4. warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


archlinux info:

  1. Linux ArchLinux 6.0.2-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 15 Oct 2022 14:00:49 +0000 x86_64 GNU/Linux

hts6caw3

hts6caw31#

运行程序时,需要添加环境变量LD_PRELOAD=/usr/lib/libc_malloc_debug.so(或类似变量,取决于libc路径)。
我发现了这个reported in the Arch bug tracker,它进一步链接到glibc.git/NEWS项目,它说:
malloc中的调试功能,如MALloc_environment_variable(或glibc.malloc.check可调参数)、mtrace()和mcheck(),现在在主C库中默认已被禁用。希望使用这些功能的用户现在需要预加载一个新的调试DSO libc_malloc_debug.so以恢复此功能。

相关问题