1
votes

I'm using kgdb to debug something via a serial cable, so I "set remote /dev/ttyS1" in gdb, which gives me output from the remote machine through gdb.

Is there any way to redirect this output to a file WITHOUT redirecting the rest of gdb's output? It won't let me enable TUI, either. I'm using:

set logging file ~/gdb_output.log
set logging overwrite on
set logging redirect on
set logging on

Thanks!

Is both the serial coming in from my target machine and the output from gdb using stdout? What uses stdin, what uses stdoutm and what uses stderr?

1
Is there any part of the output strings you would like to have in the file unique that would allow you to use grep?ryyker
What is the output you want to redirect, just the kernel messages (aka dmesg) or also the program output? Is it ok to disable the kernel messages output to the serial instead of "redirecting" them to a file? You could grab them after using the "dmesg" command...Fernando Silveira
In this case the kernel messages are the program output coming in over serial, and that's what I want to redirect to a file. I want the GDB initiated output (i.e. not printk messages) and gdb print statements, etc, to still be in the main window.Jordan
You mean like this answer here: stackoverflow.com/questions/5941158/… ?Radu C
@Jordan, how about set logging redirect off? I don't grasp what kind of workflow you're trying to set up (perhaps using screen to record the debugging sessions would work better?), but GDB Manual has pretty good descriptions of the debugging options..Nominal Animal

1 Answers

0
votes

How about using a redirect with run after setting up your remote target.

  1. Start gdb without giving the debug_kernel as input:
  2. Setup your remote connection

    (gdb) set remote /dev/ttyS1

  3. Load the debug kernel file for gdb to start debugging

    (gdb) file debug_kernel

  4. Run and pipe output to a file

    (gdb) run > file_to_save_kgdb_output

Check out this documentation for reference: http://sourceware.org/gdb/onlinedocs/gdb/Input_002fOutput.html