0

I have a script that I'm running within GDB. I'm using the printf statement just once (I need just one value) and storing the output in a file. The problem that I'm facing is that it is not just the value I need, that is being stored but the entire output of GDB (including the welcome script and register values at every breakpoint) is also being stored along with it. Is there a way I can get just the value I need inside the file?

  • See this question: [https://stackoverflow.com/questions/5941158/gdb-print-to-file-instead-of-stdout](https://stackoverflow.com/questions/5941158/gdb-print-to-file-instead-of-stdout) – AmeyaVS May 31 '17 at 06:24
  • Hi. I tried it but it still logs the register values and assembly code in my output file. I just need a particular value to be stored in the file. – Vinayak Aggarwal May 31 '17 at 06:55
  • According to [this](https://sourceware.org/gdb/onlinedocs/gdb/Input_002fOutput.html) redirection should work. Can you try [remote debugging](http://davis.lbl.gov/Manuals/GDB/gdb_17.html) with gdbserver. Just redirect the stdout to the file you want. – AmeyaVS May 31 '17 at 08:36

0 Answers0