Who prints the stack information?

33 views Asked by At

when my process double free, I get some print, I wonder those info print by who ?

if I donot need it, can I close the print?

// g++ hel.cpp

#include <iostream> 
int main() {
   int *p = new int;
   delete p;
   delete p;
   return 1;
}

// ./a.out

*** Error in `./a.out': double free or corruption (fasttop): 0x00000000022ccc20 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x81329)[0x7fb4b3e18329]
./a.out[0x400714]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7fb4b3db9555]
./a.out[0x400629]
======= Memory map: ========
00400000-00401000 r-xp 00000000 fd:01 7210287                           
00600000-00601000 r--p 00000000 fd:01 7210287                            
00601000-00602000 rw-p 00001000 fd:01 7210287
....
Aborted
1

There are 1 answers

0
ryryss On

thinks to @Barmar
function malloc_printerr_ calls _libc_message

check _libc_message source code or
see this link [https://sourceware.org/legacy-ml/libc-help/2014-07/msg00015.html]

the answer is set env LIBC_FATAL_STDERR_ can redirect output to standard error