How to redirect Valgrind's output to a file?

前端 未结 4 2057
再見小時候
再見小時候 2021-01-30 02:08

While working with Valgrind tool, i need to log the details produced by valgrind tool. How can I accomplish that? I tried something like,

 valgrind a.out | test
         


        
4条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-30 02:23

    By default, Valgrind writes its output to stderr. So you need to do something like:

    valgrind a.out > log.txt 2>&1
    

    Alternatively, you can tell Valgrind to write somewhere else; see http://valgrind.org/docs/manual/manual-core.html#manual-core.comment (but I've never tried this).

提交回复
热议问题