Running Debugger Outside of E2 Studio


I am working on a project using a RA2L1 micro. My goal is to build an automated testing suite that will be run on the target for overnight test runs. I'm trying to use GDB to flash and run the software but have run into some issues. For reference we're using an E2 emulator. Debugging through E2 Studio works fine, as does the Renesas Flash loader. So I know it's not a power issue or anything like that. E2 studio prints the following command to the console to start e2-server-gdb.exe:

Starting server with the following options:
Raw options : C:\Users\dm\.eclipse\com.renesas.platform_1435879475\DebugComp\\RA\e2-server-gdb -g E2 -t R7FA2A1AB -uConnectionTimeout= 30 -uClockSrc= 0 -uAllowClockSourceInternal= 1 -uInteface= SWD -uIfSpeed= auto -w 0 -z 33 -uIdCodeBytes= FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -uResetCon= 1 -uLowPower= 1 -uSWOclockDiv= 4 -uresetOnReload= 1 -n 0 -uFlashBp= 0 -ueraseRomOnDownload= 0 -ueraseDataRomOnDownload= 0 -uTraceMTB= 0 -uTraceSizeMTB= 1024 -uProgReWriteIRom= 0 -uProgReWriteDFlash= 0 -uOSRestriction= 0 -uTimeMeasurementEnable= 1 -uMemRegion= 0x00000000:0x40000:FLASH:e -uMemRegion= 0x40100000:0x2000:DATA_FLASH:e -l -uCore= SINGLE_CORE|enabled|1|main -uSyncMode= async -uFirstGDB= main --english

This command works from a terminal fine, and it provides the port number. From the E2 console I also found the following commands to supply to arm-none-eabi-gdb.exe:

source .gdbinit
set step-mode off
set loose-breakpoint-match off
set breakpoint always-inserted on
symbol-file C:\\Devel\\RA_Project\\Debug\\RA_Project.elf
inferior 1
set remotetimeout 10
set tcp connect-timeout 30
target extended-remote localhost:<port_number>

As soon as I execute the target command I get an E31 error.

(gdb) target extended-remote localhost:57916
Remote debugging using localhost:57916
Could not read registers; remote failure reply 'E31'

I suspect there's more commands getting run somewhere, but I'm not sure what commands those would be or where E2 is logging them. Any suggestions would be super helpful.