I don’t see necessary code in your project to initialize avr-stub or even include the library.
Please reproduce the minimal setup at How to debug on Arduino mega 2560 - #2 by maxgerhardt first. (with board being left at your target megaatmega2560 of course, and as documented in https://docs.platformio.org/en/latest/plus/debug-tools/avr-stub.html#debugging-tool-avr-stub).