title: gdb python disas - parse output
body: <p>Setup: GDB running the internal python interpreter with a script. The content of the script runs the <code>disas</code> on some memory.</p>
  
  <p><strong>I need the output of this command in a python string. How can I do this?</strong></p>
  
  <p>Thought about logging, but it turned out that only the first line of the  command is logged:</p>
  
  <pre><code>Dump of assembler code from 0x8000 to 0x8030:
  </code></pre>
  
  <p>The expected result of the disas is on the screen, but NOT in the logfile.</p>
  
  <pre><code>0x00008000: fsw fa0,24(a5)
  0x00008002: fsd fs6,16(sp)
  0x00008004: addi    s1,sp,920
  ...
  </code></pre>
  
  <p>Is it possible to redirect stdout into a stream or to get the info on somehow other way?</p>
  
  <p><strong>EDIT:</strong> I've connected GDB to an openOCD server. On my target are the assembler commands. There is no elf-file ore so on, where I get the source code from. It's just pure machine instructions residing on the controllers program memory and I need to get this printed.</p>