如何在可视模式下显示任何标准写入。

例如,如果我运行dc命令,它将正常运行该程序并正常显示所有文本。但是,如果我使用V< enter >进入可视模式并使用S来运行程序,它将显示输出可能是1/10的秒: ,或输入命令并查看到目前为止已打印到stdout的内容?

#1 楼

恐怕没有直接的方法可以做到这一点。您需要使用rarun2或radare的dd命令。

我更喜欢rarun2方式,它更加灵活和简单。 br />
  Debugging a program redirecting io to another terminal

   ## open a new terminal and type 'tty' to get
   $ tty ; clear ; sleep 999999
   /dev/ttyS010

   ## in another terminal run r2
   $ r2 -e dbg.profile=foo.rr2 -d ls

   ## or you can use -R option
   $ r2 -R foo.rr2 -d ls
   $ cat foo.rr2
   #!/usr/bin/rarun2
   stdio=/dev/ttys010


有关逐步指南和更详细的答案,请在此处检查我对类似问题的答案。

man rarun2可用于更改文件描述符在运行时:

[0x00000000]> dd?
|Usage: dd Descriptors commands
| dd                   List file descriptors
| dd <file>            Open and map that file into the UI
| dd-<fd>              Close stdout fd
| dd*                  List file descriptors (in radare commands)
| dds <fd> <off>       Seek given fd)
| ddd <fd1> <fd2>      Dup2 from fd1 to fd2
| ddr <fd> <size>      Read N bytes from fd
| ddw <fd> <hexpairs>  Write N bytes to fd