Atollic ST-Link GDB server --attach ends session when GDB client connects

Discuss how to use the features of Atollic TrueSTUDIO, including the editor, assembler, C/C++ compiler, linker, debugger, static code analysis and team collaboration tools.

Moderators: Markus Girdland, Mattias Norlander

chriskeeser
Posts: 6
Joined: Mon Feb 11, 2019 2:35 am

Atollic ST-Link GDB server --attach ends session when GDB client connects

Postby chriskeeser » Mon Feb 11, 2019 3:19 am

Background and relevant information:

- Atollic TrueStudio 9.2.0
- Windows 10 64 bit (1803)
- NUCLEO-F722ZE (https://www.st.com/en/evaluation-tools/ ... 722ze.html)
- Using the NUCLEO boards built-in ST-Link V2 debug hardware over USB
- I am attempting to start the Atollic ST-Link GDB server from the command line, and attach to a running target (I do not want to reset the device or halt the core on attach)
- I have used both git bash and Msys2 and executed $ make server to execute the following command to start the GDB server (the makefile and config.txt files are provided below). I am using make simply to execute the commands, no other reason.
- The Atollic ST-Link GDB server starts and connects to the device successfully (see console output and logs below)
- When $ make debug is executed, and the command (gdb) target remote localhost:61234 is executed, the server accepts the connection, then immediately closes the connection with no error (see console output and logs below)

Other Information

- If I comment out --attach in the config file, and repeat the steps, I am able to connect to the GDB server with the GDB client, execute the (gdb) target remote localhost:61234 and successfully debug the device.
- the winpty call for the gdb client fixes issues with using arrow keys in the gdb console (https://github.com/mintty/mintty/issues/630)

Any insight into what the issue might be would be greatly appreciated.

makefile

Code: Select all

GDB_SERVER_PATH = /C/Program\ Files\ \(x86\)/Atollic/TrueSTUDIO\ for\ STM32\ 9.2.0/Servers/ST-LINK_gdbserver
GDB_SERVER = ST-LINK_gdbserver.exe

GDB_CLIENT_PATH = /C/Program\ Files\ \(x86\)/Atollic/TrueSTUDIO\ for\ STM32\ 9.2.0/ARMTools/bin/
GDB_CLIENT = arm-atollic-eabi-gdb.exe

server:
   # try to run the GDB server
   $(GDB_SERVER_PATH)/$(GDB_SERVER) -c config.txt

debug:
   winpty $(GDB_CLIENT_PATH)/$(GDB_CLIENT)


config.txt

Code: Select all

# persistent mode
# --persistent

#  -f <Log-File>      : Name of log file.
--log-file debug.log

#  -l <Log-Level>     : Logging level between 0 & 31
--log-level 31

#  -p <Port-Number>   : TCP-Listen Port-Number.
--port-number 61234

#  -v                 : Enables verbose mode
--verbose

#  -r <delay-sec>     : Maximum Delay in status refresh
--refresh-delay 15

# -d                  : Enables SWD mode
--swd

# enable SWO mode
--swo-port 61235

# set the CPU clock speed in Hz
--cpu-clock 16000000

# divide the CPU clock by this amount for the SWO speed
--swo-clock-div 16

# attach to a running target
--attach

# STM cube programmer path
--stm32cubeprogrammer-path C:\Program Files (x86)\Atollic\TrueSTUDIO for STM32 9.2.0\Servers\STM32CubeProgrammer\bin


Atollic ST-Link GDB Server Console Output

Code: Select all

$ make server
# try to run the GDB server
/C/Program\ Files\ \(x86\)/Atollic/TrueSTUDIO\ for\ STM32\ 9.2.0/Servers/ST-LINK_gdbserver/ST-LINK_gdbserver.exe -c config.txt


STMicroelectronics ST-LINK GDB server. Version 5.1.0
Copyright (c) 2018, STMicroelectronics. All rights reserved.

Starting server with the following options:
        Persistent Mode            : Disabled
        LogFile Name               : debug.log
        Logging Level              : 31
        Listen Port Number         : 61234
        Status Refresh Delay       : 15s
        Verbose Mode               : Enabled
        SWD Debug                  : Enabled

Hardware watchpoint supported by the target
SWD frequency = 4000 kHz
ST-LINK Firmware version : V2J31S21
Device ID: 0x452
PC: 0x1000000
ST-LINK device status: RUN_MODE
ST-LINK detects target voltage = 3.26 V
ST-LINK device status: RUN_MODE
ST-LINK device initialization OK
Waiting for debugger connection...
Waiting for connection on port 61234...
Waiting for connection on port 61235...
Accepted connection on port 61234...
Debugger connected
Debugger connection lost.
Shutting down...

Stopping port 61235
Received stop for port 61235, not accepting new connections.
make: *** [makefile:9: server] Error 127


Atollic ST-Link GDB Server Debug Log

Code: Select all

[0.000] initConfigParams():  Configuration flags start
[0.000] initConfigParams():  config-file                    "config.txt"
[0.000] initConfigParams():  persistent                     false
[0.000] initConfigParams():  log-file                       "debug.log"
[0.001] initConfigParams():  log-level                      31
[0.001] initConfigParams():  port-number                    61234
[0.001] initConfigParams():  verbose                        true
[0.001] initConfigParams():  refresh-delay                  15
[0.001] initConfigParams():  verify                         false
[0.001] initConfigParams():  swd                            true
[0.001] initConfigParams():  swo-port                       61235
[0.001] initConfigParams():  cpu-clock                      16000000
[0.001] initConfigParams():  swo-clock-div                  16
[0.001] initConfigParams():  initialize-reset               false
[0.001] initConfigParams():  debuggers                      false
[0.001] initConfigParams():  serial-number                  ""
[0.001] initConfigParams():  apid                           0
[0.001] initConfigParams():  attach                         true
[0.001] initConfigParams():  shared                         false
[0.001] initConfigParams():  erase-all                      false
[0.001] initConfigParams():  memory-map                     ""
[0.001] initConfigParams():  ext-memory-loaders             false
[0.001] initConfigParams():  extload                        ""
[0.001] initConfigParams():  stm32cubeprogrammer-path       "C:\Program Files (x86)\Atollic\TrueSTUDIO for STM32 9.2.0\Servers\STM32CubeProgrammer\bin"
[0.001] initConfigParams():  temp-path                      ""
[0.001] initConfigParams():  preserve-temps                 false
[0.001] initConfigParams():  licenses                       false
[0.001] initConfigParams():  ignore-rest                    false
[0.001] initConfigParams():  version                        false
[0.001] initConfigParams():  help                           false
[0.001] initConfigParams():  Configuration flags end
[0.001] init():  STMicroelectronics ST-LINK GDB server. Version 5.1.0
Copyright (c) 2018, STMicroelectronics. All rights reserved.
[0.024] reset_hw_wtchpt_module():  Hardware watchpoint supported by the target
[0.029] Device_Initialise():  SWD frequency = 4000 kHz
[0.029] Device_Initialise():  ST-LINK Firmware version : V2J31S21
[0.029] Device_Initialise():  Device ID: 0x452
[0.029] Device_Initialise():  PC: 0x1000000
[0.030] Device_GetStatus():  ST-LINK device status: RUN_MODE
[0.030] Device_Initialise():  ST-LINK detects target voltage = 3.26 V
[0.032] Device_Initialise():  ST-LINK device status: RUN_MODE
[0.032] initServerContext():  ST-LINK device initialization OK
[0.036] WaitConnection():  Waiting for connection on port 61234...
[0.036] WaitConnection():  Waiting for connection on port 61235...
[2.893] WaitConnection():  Accepted connection on port 61234...
[2.896] stop():  Stopping port 61235
[2.968] WaitConnection():  Received stop for port 61235, not accepting new connections.


Atollic GDB Client Console

Code: Select all

$ make debug
winpty /C/Program\ Files\ \(x86\)/Atollic/TrueSTUDIO\ for\ STM32\ 9.2.0/ARMTools/bin//arm-atollic-eabi-gdb.exe
GNU gdb (GNU Tools for ARM Embedded Processors (Build 17.03)) 7.10.1.20160923-cv
s
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-w64-mingw32 --target=arm-atollic-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) target remote localhost:61234
Remote debugging using :61234
Remote communication error.  Target disconnected.: No error.
(gdb)

Return to “Atollic TrueSTUDIO tool discussions”

Who is online

Users browsing this forum: PlasticPelican and 1 guest