Pyparsing ParseException error on debug build

I am using PlatformIO VSCode Extension on Windows 10 to build my project. I am currently trying to debug my project due to an unexpected null pointer dereference/memory corruption using GDBStub. However I keep getting a ParseException error with the message “Expected end of text (at char 0)”.

Here is the traceback:

Compiling .pio\build\client\bootloader\esp_hw_support\port\esp32\rtc_pm.c.o
Traceback (most recent call last):
  File "%USER%\.platformio\packages\framework-espidf\tools\ldgen\entity.py", line 163, in _get_infos_from_file
    results = parser.parseString(info.content, parseAll=True)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "%USER%\.platformio\penv\.espidf-4.4.7\Lib\site-packages\pyparsing.py", line 1814, in parseString
    raise exc
  File "%USER%\.platformio\penv\.espidf-4.4.7\Lib\site-packages\pyparsing.py", line 1808, in parseString
    se._parse( instring, loc )
  File "%USER%\.platformio\penv\.espidf-4.4.7\Lib\site-packages\pyparsing.py", line 1548, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "%USER%\.platformio\penv\.espidf-4.4.7\Lib\site-packages\pyparsing.py", line 3722, in parseImpl
    loc, exprtokens = e._parse( instring, loc, doActions )
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "%USER%\.platformio\penv\.espidf-4.4.7\Lib\site-packages\pyparsing.py", line 1552, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "%USER%\.platformio\penv\.espidf-4.4.7\Lib\site-packages\pyparsing.py", line 3502, in parseImpl
    raise ParseException(instring, loc, self.errmsg, self)
pyparsing.ParseException: Expected end of text (at char 163098), (line:2551, col:50)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "%USER%\.platformio\packages\framework-espidf\tools\ldgen\ldgen.py", line 178, in <module>
    main()
  File "%USER%\.platformio\packages\framework-espidf\tools\ldgen\ldgen.py", line 154, in main
    mapping_rules = generation_model.generate(sections_infos)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "%USER%\.platformio\packages\framework-espidf\tools\ldgen\generation.py", line 520, in generate
    root_node.insert(entity, sections, target, flags, entities)
  File "%USER%\.platformio\packages\framework-espidf\tools\ldgen\generation.py", line 251, in insert
    self.child_placement(entity, sections, target, flags, sections_db)
  File "%USER%\.platformio\packages\framework-espidf\tools\ldgen\generation.py", line 243, in child_placement
    child.insert(entity, sections, target, flags, sections_db)
  File "%USER%\.platformio\packages\framework-espidf\tools\ldgen\generation.py", line 251, in insert
    self.child_placement(entity, sections, target, flags, sections_db)
  File "%USER%\.platformio\packages\framework-espidf\tools\ldgen\generation.py", line 243, in child_placement
    child.insert(entity, sections, target, flags, sections_db)
  File "%USER%\.platformio\packages\framework-espidf\tools\ldgen\generation.py", line 251, in insert
    self.child_placement(entity, sections, target, flags, sections_db)
  File "%USER%\.platformio\packages\framework-espidf\tools\ldgen\generation.py", line 304, in child_placement
    found_sections = sections_db.get_sections(self.parent.name, self.name)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "%USER%\.platformio\packages\framework-espidf\tools\ldgen\entity.py", line 206, in get_sections
    obj = self._match_obj(archive, obj)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "%USER%\.platformio\packages\framework-espidf\tools\ldgen\entity.py", line 194, in _match_obj
    objs = self.get_objects(archive)
           ^^^^^^^^^^^^^^^^^^^Compiling .pio\build\client\bootloader\esp_hw_support\port\esp32\rtc_sleep.c.o
^^^^^^
  File "%USER%\.platformio\packages\framework-espidf\tools\ldgen\entity.py", line 187, in get_objects
    self._process_archive(archive)
  File "%USER%\.platformio\packages\framework-espidf\tools\ldgen\entity.py", line 175, in _process_archive
    parsed = self._get_infos_from_file(stored)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "%USER%\.platformio\packages\framework-espidf\tools\ldgen\entity.py", line 165, in _get_infos_from_file
    raise ParseException('Unable to parse section info file ' + info.filename + '. ' + p.msg)
pyparsing.ParseException: Unable to parse section info file %PROJECT%/.pio/build/client/esp-idf/esp_event/libesp_event.a. Expected end of text (at char 0), (line:1, col:1)
*** [.pio\build\client\sections.ld] Error 1 ***

Here are my packages:

Resolving server dependencies...
Platform espressif32 @ 6.9.0 (required: espressif32)
├── framework-arduinoespressif32 @ 3.20017.241212+sha.dcc1105b (required: platformio/framework-arduinoespressif32 @ ~3.20017.0)
├── framework-espidf @ 3.40407.240606 (required: platformio/framework-espidf @ ~3.40407.0)
├── tool-cmake @ 3.16.4 (required: platformio/tool-cmake @ ~3.16.0)
├── tool-esptoolpy @ 1.40501.0 (required: platformio/tool-esptoolpy @ ~1.40501.0)
├── tool-idf @ 1.0.1 (required: platformio/tool-idf @ ~1.0.1)
├── tool-mconf @ 1.4060000.20190628 (required: platformio/tool-mconf @ ~1.4060000.0)
├── tool-ninja @ 1.9.0 (required: platformio/tool-ninja @ ^1.7.0)
├── toolchain-esp32ulp @ 1.23800.240113 (required: platformio/toolchain-esp32ulp @ ~1.23800.0)
└── toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5 (required: espressif/toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5)

Resolving client dependencies...
Platform espressif32 @ 6.9.0 (required: espressif32)
├── framework-arduinoespressif32 @ 3.20017.241212+sha.dcc1105b (required: platformio/framework-arduinoespressif32 @ ~3.20017.0)
├── framework-espidf @ 3.40407.240606 (required: platformio/framework-espidf @ ~3.40407.0)
├── tool-cmake @ 3.16.4 (required: platformio/tool-cmake @ ~3.16.0)
├── tool-esptoolpy @ 1.40501.0 (required: platformio/tool-esptoolpy @ ~1.40501.0)
├── tool-idf @ 1.0.1 (required: platformio/tool-idf @ ~1.0.1)
├── tool-mconf @ 1.4060000.20190628 (required: platformio/tool-mconf @ ~1.4060000.0)
├── tool-ninja @ 1.9.0 (required: platformio/tool-ninja @ ^1.7.0)
├── toolchain-esp32ulp @ 1.23800.240113 (required: platformio/toolchain-esp32ulp @ ~1.23800.0)
└── toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5 (required: espressif/toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5)

platform.ini:

platform = espressif32`
board = esp32doit-devkit-v1
monitor_raw = yes
monitor_speed = 115200
framework = arduino, espidf

build_flags = 
    -DCORE_DEBUG_LEVEL=3
    -DCONFIG_ESP_SYSTEM_PANIC_HALT=y
    -DCONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID=y
    -DCONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME=y

debug_build_flags =
    -Os 
    -g 
    -ggdb3
    -DCONFIG_ESP_COREDUMP_DECODE_INFO=y

[env:server]
debug_extra_cmds =
    break main
    break recv_callback
    break send_callback
    break notify_client

board_build.cmake_extra_args = 
    -DCURRENT_ENV=SERVER

[env:client]
debug_extra_cmds =
    break listen_table
    break listen_goal
    break send_packet
    break recv_callback
    break send_callback

board_build.cmake_extra_args = 
    -DCURRENT_ENV=CLIENT

I tried reinstalling the PlatformIO core by deleting the .platformio folder and the .pio folder and reinstalling the PlatformIO extension, and also reinstalling all the PlatformIO packages using pio pkg uninstall and reinstalling but nothing worked. Building the project normally works fine albeit with some warnings. Any help would be appreciated.