title: gdb log file format
body: <p>When I use <code>set logging on</code> in gdb, the output to the log file has a different format than what I see on the terminal screen. The logfile is not very readable. How can I get the log file in a readable format?</p>
  
  <p><strong>Output to screen is fine:</strong></p>
  
  <pre><code>(gdb) p foo
  $1 = {
    static npos = 18446744073709551615,
    _M_dataplus = {
      &lt;std::allocator&lt;char&gt;&gt; = {
        &lt;__gnu_cxx::new_allocator&lt;char&gt;&gt; = {&lt;No data fields&gt;}, &lt;No data fields&gt;},
      members of std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt; &gt;::_Alloc_hider:
      _M_p = 0x601028 "Hello World!\n"
    }
  }
  </code></pre>
  
  <p><strong>Output to log file is not very readable:</strong></p>
  
  <pre><code>^Z^Zpost-prompt
  
  ^Z^Zbreakpoints-headers
  
  ^Z^Zfield 0
  Num     
  ^Z^Zfield 1
  Type           
  ^Z^Zfield 2
  Disp 
  ^Z^Zfield 3
  Enb 
  ^Z^Zfield 4
  Address            
  ^Z^Zfield 5
  What
  
  ^Z^Zbreakpoints-table
  
  ^Z^Zrecord
  
  ^Z^Zfield 0
  1       
  ^Z^Zfield 1
  breakpoint     
  ^Z^Zfield 2
  keep 
  ^Z^Zfield 3
  y   
  ^Z^Zfield 4
  0x0000000000400961 
  ^Z^Zfield 5
  in main at test.cpp:9
          breakpoint already hit 1 time
  
  ^Z^Zbreakpoints-table-end
  
  ^Z^Zpost-prompt
  
  ^Z^Zvalue-history-begin 1 -
  $1 = 
  ^Z^Zvalue-history-value
  {
  
  ^Z^Zfield-begin -
  static npos
  ^Z^Zfield-name-end
   = 
  ^Z^Zfield-value
  18446744073709551615
  ^Z^Zfield-end
  , 
  
  ^Z^Zfield-begin -
  _M_dataplus
  ^Z^Zfield-name-end
   = 
  ^Z^Zfield-value
  {
      &lt;std::allocator&lt;char&gt;&gt; = {
        &lt;__gnu_cxx::new_allocator&lt;char&gt;&gt; = {&lt;No data fields&gt;}, &lt;No data fields&gt;}, 
      members of std::basic_string&lt;char,std::char_traits&lt;char&gt;,std::allocator&lt;char&gt; &gt;::_Alloc_hider: 
  
  ^Z^Zfield-begin *
  _M_p
  ^Z^Zfield-name-end
   = 
  ^Z^Zfield-value
  0x601028 "Hello World!\n"
  ^Z^Zfield-end
  
    }
  ^Z^Zfield-end
  
  }
  
  ^Z^Zvalue-history-end
  
  ^Z^Zpost-prompt
  
  ^Z^Zbreakpoints-headers
  
  ^Z^Zfield 0
  Num     
  ^Z^Zfield 1
  Type           
  ^Z^Zfield 2
  Disp 
  ^Z^Zfield 3
  Enb 
  ^Z^Zfield 4
  Address            
  ^Z^Zfield 5
  What
  
  ^Z^Zbreakpoints-table
  
  ^Z^Zrecord
  
  ^Z^Zfield 0
  1       
  ^Z^Zfield 1
  breakpoint     
  ^Z^Zfield 2
  keep 
  ^Z^Zfield 3
  y   
  ^Z^Zfield 4
  0x0000000000400961 
  ^Z^Zfield 5
  in main at test.cpp:9
          breakpoint already hit 1 time
  
  ^Z^Zbreakpoints-table-end
  
  ^Z^Zpost-prompt
  </code></pre>