Search code examples
linuxassemblynasmkdbg

How to handle user input/output in kdbg (testing assembly code)?


Read macro:

%macro read 2
  mov rax, 0  
  mov rdi, 0  
  mov rsi, %1 
  mov rdx, %2 i
  syscall
%endmacro

Write macro:

%macro write 2
  mov rax, 1  
  mov rdi, 0  
  mov rsi, %1 
  mov rdx, %2
  syscall
%endmacro

I'm trying to test my program by using kdbg, but I'm not sure on how to input something, as kdbg doesn't even prompt me to do so, and going to the output window when I try to write something to the stdout nothing is being displayed, what would be the correct approach to see my output or to input something from stddin?


Solution

  • To enable interactive input, you have to use the external terminal window. Go to Settings->This Program, switch to the Output section, and enable Full terminal emulation. You have to reload the program. (It will be the top-most entry in File->Recent Executables.)