coredump-n: malloc-hook 里带printf

如果在malloc的hook函数里有打印输出,就会导致栈被占满的情况,因为会发送死循环。
(gdb) bt
#0 0x00007ffff77079fb in _IO_vfprintf_internal (s=0x7ffff7a616e0 <IO_2_1_stdout>, format=0x400918 “malloc: size=%d, d=%p\n”, ap=ap@entry=0x7fffff7ff2c0) at vfprintf.c:1273
#1 0x00007ffff770ff0a in __printf (format=) at printf.c:33
#2 0x0000000000400821 in malloc (size=1024) at xml.c:17
#3 0x00007ffff7726d40 in __GI__IO_file_doallocate (fp=0x7ffff7a616e0 <IO_2_1_stdout>) at filedoalloc.c:101
#4 0x00007ffff7734cb0 in __GI__IO_doallocbuf (fp=fp@entry=0x7ffff7a616e0 <IO_2_1_stdout>) at libioP.h:838
#5 0x00007ffff7733f18 in _IO_new_file_overflow (f=0x7ffff7a616e0 <IO_2_1_stdout>, ch=-1) at fileops.c:749
#6 0x00007ffff77330bf in _IO_new_file_xsputn (n=13, data=, f=0x7ffff7a616e0 <IO_2_1_stdout>) at libioP.h:838
#7 _IO_new_fi

猜你喜欢

转载自blog.csdn.net/qq_36428903/article/details/134849939