Skip to content

Installation and setup (Cpp)

Lewis McClelland edited this page Oct 25, 2026 · 18 revisions

This chapter discusses how to add v5gdb to a C++ project using PROS.

Caution

By default, PROS uses the .bss section as the stack. This will corrupt v5gdb's memory. Until they fix this, you must edit the PROS linker script to set a dedicated stack.

Append the following code to the v5.ld file in your PROS project before using v5gdb:

SECTIONS {
    .stack (NOLOAD) : {
       . = ALIGN(16);
       __stack_start = .;
       . = ORIGIN(HEAP);
       __stack = .;
       __stack_end = .;
    } > RAM
} INSERT AFTER .bss;

Installing v5gdb

Start by adding the v5gdb support library to your PROS project by running these commands:

pros c add-depot v5gdb https://raw.githubusercontent.com/vexide/v5gdb/depot/preview.json
pros c apply v5gdb

You will also need to install the v5gdb command on your computer using one of the commands below. This is a support program that helps GDB running on your computer connect to your VEX V5 brain.

Shell script (macOS/Linux)

curl --proto '=https' --tlsv1.2 -LsSf https://github.com/vexide/v5gdb/releases/download/v0.1.0-beta.1/v5gdb-cli-installer.sh | sh

PowerShell script (Windows)

powershell -ExecutionPolicy Bypass -c "irm https://github.com/vexide/v5gdb/releases/download/v0.1.0-beta.1/v5gdb-cli-installer.ps1 | iex"

Other

  • Cargo: cargo install v5gdb-cli@0.1.0-beta.1
  • Cargo Binstall: cargo binstall v5gdb-cli@0.1.0-beta.1
  • View the Releases page for detailed install instructions and manual downloads.

Project setup

To enable debugging support, add the following line to your initialize function, preferably near the beginning.

#include "v5gdb/v5gdb.h"

void initialize() {
    v5gdb::install();
    // ...rest...
}

Debugger setup

Upload your program, then start it:

pros mu

At this point, you can now view the debug console by running the v5gdb command in the PROS Integrated Terminal.

$ v5gdb
GNU gdb (GDB) 16.3
Copyright (C) 2024 Free Software Foundation, Inc.
Reading symbols from ./bin/hot.package.elf...
add symbol table from file "./bin/cold.package.elf"
Reading symbols from ./bin/cold.package.elf...
Remote debugging using :35537
initialize () at src/main.cpp:19
19              printf("Hello world\n");
(gdb)

You may now use GDB to debug your program: for instance, type "continue" to resume execution, or press Ctrl-C to pause the program.

Tip

You cannot run v5gdb at the same time as commands like pros, cargo v5, or vexcom.

Clone this wiki locally