10

How can I display any standard write in visual mode.

For example if I run dc command it runs the program normally and displays all the text normally. But if I enter visual mode with V< enter > and use S to run through the program it displays the output maybe a 1/10th of a second: What I see in visual mode

Can I have it display it for longer, or enter a command and see what has been printed to stdout so far?

1 Answer 1

6

I'm afraid there's no straight way to do so. You'll need to use rarun2 or radare's dd command.

I prefer the rarun2 way, it is more flexible and simple.

From man rarun2 output:

  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

For a step-by-step guide and more detailed answer, check my answer to a similar question here.

dd can be used to change file descriptors at runtime:

[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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.