[SOLVED] Semihosting error when printing via gdb

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Semihosting error when printing via gdb

    Running on macOS Monterey 12.6.2 on Intel.

    I’ve been using JLink_V642, but since installing V784b (x86_64) semihosting no longer works as it did before.

    I’ve been running with ioclient set to 2, and now gdb (GNU gdb 12.1) doesn’t recognise whatever command gdbserver sends to it; however, after setting ioclient to 1, telnet (nc) output to port 2333 works fine.

    gdbserver starts off with

    Source Code

    1. SEGGER J-Link GDB Server V7.84b Command Line Version
    2. JLinkARM.dll V7.84b (DLL compiled Jan 11 2023 16:37:12)
    3. Command line: -port 4242 -device stm32f405rg -endian little -if swd -ir -vd -localhostonly -halt
    4. -----GDB Server start settings-----
    5. GDBInit file: none
    6. GDB Server Listening port: 4242
    7. SWO raw output listening port: 2332
    8. Terminal I/O port: 2333
    9. Accept remote connection: localhost only
    10. Generate logfile: off
    11. Verify download: on
    12. Init regs on start: on
    13. Silent mode: off
    14. Single run mode: off
    15. Target connection timeout: 0 ms
    16. ------J-Link related settings------
    17. J-Link Host interface: USB
    18. J-Link script: none
    19. J-Link settings file: none
    20. ------Target related settings------
    21. Target device: stm32f405rg
    22. Target device parameters: none
    23. Target interface: SWD
    24. Target interface speed: 4000kHz
    25. Target endian: little
    26. Connecting to J-Link...
    27. J-Link is connected.
    28. Firmware: J-Link V9 compiled May 7 2021 16:26:12
    29. Hardware: V9.30
    30. S/N: 269302973
    31. OEM: SEGGER-EDU
    32. Feature(s): FlashBP, GDB
    33. Checking target voltage...
    34. Target voltage: 3.00 V
    35. Listening on TCP/IP port 4242
    Display All


    and when I run the program which attempts semihosting I see this at the gdbserver:

    Source Code

    1. Starting target CPU...
    2. ...Target halted for semihosting operation @ 0x08030752
    3. ERROR: Semihosting SYS_WRITE0 operation: String length exceeds GDB Server buffer size (4096).
    4. Reading common registers: R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, SP, LR, PC, XPSR
    5. Removing breakpoint @ address 0x0802E4B2, Size = 2
    6. Read 4 bytes @ address 0x08030752 (Data = 0x4603BEAB)
    7. Reading 64 bytes @ address 0x20010CC0
    and in gdb:

    Source Code

    1. (gdb) c
    2. Continuing.
    3. Program received signal SIGTRAP, Trace/breakpoint trap.
    4. 0x08030752 in semihosting.generic_sh_call (r1=536939704, r0=4) at /Users/simon/Developer/adacore/Ada_Drivers_Library/arch/ARM/cortex_m/src/semihosting.adb:84
    5. 84 Asm ("mov r0, %1" & ASCII.LF & ASCII.HT &
  • Hi,

    In yesterday's version (V7.84e) we have fixed a problem with semihosting in GDB Server that could lead to all kinds of misbehavior.
    The most common one was that characters were repeated during output.
    To make sure that you are not running into the same one, can you please give V7.84e a try?

    segger.com/downloads/jlink/#J-…twareAndDocumentationPack
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Thanks for trying. So it may be related to the fixed issued but it seems not to be the root cause in your case…

    We will try it out here and provide some feedback.
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.