简体   繁体   English

GDB-将串行输出(从dmesg)重定向到文件,但不重定向gdb输出/ TUI?

[英]GDB - redirect serial output (from dmesg) to file, but not gdb output / TUI?

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. 我正在使用kgdb通过串行电缆调试某些内容,因此我在gdb中“设置了远程/ dev / ttyS1”,这使我可以通过gdb从远程计算机上进行输出。

Is there any way to redirect this output to a file WITHOUT redirecting the rest of gdb's output? 有什么方法可以将此输出重定向到文件,而无需重定向gdb的其余输出? It won't let me enable TUI, either. 它也不会让我启用TUI。 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? 串行既来自我的目标计算机,又来自使用stdout的gdb输出? What uses stdin, what uses stdoutm and what uses stderr? 什么使用stdin,什么使用stdoutm和什么使用stderr?

How about using a redirect with run after setting up your remote target. 设置远程目标后,如何在运行中使用重定向和运行。

  1. Start gdb without giving the debug_kernel as input: 输入debug_kernel作为输入的情况下启动gdb:
  2. Setup your remote connection 设置您的远程连接

    (gdb) set remote /dev/ttyS1 (gdb)设置远程/ dev / ttyS1

  3. Load the debug kernel file for gdb to start debugging 加载gdb的调试内核文件以开始调试

    (gdb) file debug_kernel (gdb)文件debug_kernel

  4. Run and pipe output to a file 运行并将输出通过管道传输到文件

    (gdb) run > file_to_save_kgdb_output (gdb)运行> file_to_save_kgdb_output

Check out this documentation for reference: http://sourceware.org/gdb/onlinedocs/gdb/Input_002fOutput.html 查看此文档以供参考: http : //sourceware.org/gdb/onlinedocs/gdb/Input_002fOutput.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM