---
title: Thru VM Debugging Support
description: Debugging support for the Thru VM via GDB remote server protocol
source_url:
  html: https://thru.org/docs/spec/runtime/debugging/
  md: https://thru.org/docs/spec/runtime/debugging.md
---

# Thru VM Debugging Support

## Overview

The Thru VM supports debugging via the GDB remote server protocol. Clients such as GDB and LLDB which support RISC-V can connect to a running VM instance, and can inspect and alter execution.

## Remote Server Protocol

The GDB remote server protocol specifies how clients, such as GDB, interact with a running remote, which in this case is the Thru VM. When the VM is run in debug mode, it accepts a connection over TCP, by default on port 9001. Using `target remote localhost:9001`, GDB can connect to the VM and start debugging. Several important commands are supported, including:

- `g`/`G`: Read and write registers
- `m`/`M`: Read and write memory
- `z`/`Z`: Set and clear breakpoints and watchpoints
