• Sasha Levin's avatar
    kvm tools: Allow remapping guest TTY into host PTS · 1add4b76
    Sasha Levin authored
    This patch adds the '-tty' option to 'kvm run' which allows the user to
    remap a guest TTY into a PTS on the host.
            'kvm run --tty [id]'
    The tty will be mapped to a pts and will be printed on the screen:
            '  Info: Assigned terminal 1 to pty /dev/pts/X'
    At this point, it is possible to communicate with the guest using that pty.
    This is useful for debugging guest kernel using KGDB:
    1. Run the guest:
            'kvm run -k [vmlinuz] -p "kgdboc=ttyS1 kgdbwait" --tty 1'
    And see which PTY got assigned to ttyS1.
    2. Run GDB on the host:
            'gdb [vmlinuz]'
    3. Connect to the guest (from within GDB):
            'target remote /dev/pty/X'
    4. Start debugging! (enter 'continue' to continue boot).
    Cc: David Evensky <evensky@dancer.ca.sandia.gov>
    Signed-off-by: default avatarSasha Levin <levinsasha928@gmail.com>