我在archlinux手册中使用mtrace作为mtrace示例,但它不生成mtrace数据文件/tmp/t
。
mtrace信息:
mtrace (GNU libc) 2.36
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Ulrich Drepper <[email protected]>
字符串
glibc info:
local/glibc 2.36-6
GNU C Library
型
gcc info:
gcc (GCC) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
型
archlinux info:
Linux ArchLinux 6.0.2-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 15 Oct 2022 14:00:49 +0000 x86_64 GNU/Linux
型
1条答案
按热度按时间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以恢复此功能。