# 1. Connect to the running OpenOCD server
target remote :3333

# 2. Configure GDB for Espressif-specific environments
set remote hardware-watchpoint-limit 2
set remote hardware-breakpoint-limit 2
set mem inaccessible-by-default off

# 3. Handle FreeRTOS multi-threading without crashing GDB
handle SIGTRAP noprint nostop pass

# 4. Define a custom macro to safely reset the ESP32-S3
define reset
    monitor reset halt
    flushregs
end

# 5. Execute a fresh reset and set initial breakpoint
reset
thbreak setup
continue
