Skip to main content
Explorer
August 4, 2025
Solved

stlink-server munmap_chunk failure

  • August 4, 2025
  • 1 reply
  • 385 views

I am trying to use VScode to debug code on a STM32U5 nucleo board connected to another machine.

To do that, I start VScode on my machine and use the "connect to Host" command, open the project on the distant machine and try to launch debug. Both machine run Ubuntu 22.04.

Does it work for anyone ?

At that point I get this:

[2025-08-04T10:02:54.896Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session connected. You can switch to "DEBUG CONSOLE" to see GDB interactions.
/usr/bin/stlink-server -p 50000 -cp /opt/pqs/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32CubeProgrammer --swd --serial-number 002400233532510831333430 --halt -m 0
/usr/bin/stlink-server: invalid option -- 'c'
/usr/bin/stlink-server: unrecognized option '--swd'
/usr/bin/stlink-server: unrecognized option '--serial-number'
/usr/bin/stlink-server: unrecognized option '--halt'
/usr/bin/stlink-server: invalid option -- 'm'
Info : default port : /opt/pqs/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32CubeProgrammer
Error: getaddrinfo failed. Error = 0
munmap_chunk(): invalid pointer
[2025-08-04T10:02:56.093Z] SERVER CONSOLE DEBUG: onBackendConnect: gdb-server session closed
GDB server session ended. This terminal will be reused, waiting for next session to start...

 

stlink-server version is the latest one:

$ stlink-server --version
stlink-server v2.1.1 (2023-06-02-08:34) 

 

Is it a known issue ? Is there a workaround ?

    This topic has been closed for replies.
    Best answer by LaurentL

    Hello,

    STLink server is used to connect several STLink. So, don't use this software.

    You need to use STLink gdb server.

     

    On the host, you can use Attach debug mode on VScode 3.5.1 for stlink gdb server.

     

    Rgds,

    Laurent

    1 reply

    LaurentLAnswer
    ST Employee
    August 5, 2025

    Hello,

    STLink server is used to connect several STLink. So, don't use this software.

    You need to use STLink gdb server.

     

    On the host, you can use Attach debug mode on VScode 3.5.1 for stlink gdb server.

     

    Rgds,

    Laurent