Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stepping through code kills the debug session #958

Closed
basprins opened this issue Nov 17, 2023 · 3 comments
Closed

Stepping through code kills the debug session #958

basprins opened this issue Nov 17, 2023 · 3 comments

Comments

@basprins
Copy link

basprins commented Nov 17, 2023

Often when I am stepping through code the debug session dies. It takes a couple of seconds before the debugger responds after hitting F10 (so i already know "it happened again").

The only thing I can see in the debug console is:

[Switching to Thread 538996992]

Thread 12 hit Breakpoint 1, startup_task (parameter=0x0 ) at /home/dev/app/source/iobox-app/main.cpp:354
354 if (pulse_configuration.exists())
warning: Error removing breakpoint -7
[New Remote target]
Cannot remove breakpoints because program is no longer writable.
Further execution is probably impossible.

My way of working to workaround this problem, is stepping as less as possible. Launching the application and let it break on another breakpoint almost never shows this problem. It is horrible when stepping over / stepping into.

That doesn't make much sense to me. Maybe it does to you?

  • ubuntu 23.04
  • cortex 1.12.1 (running in docker container)
  • arm toolchain 12.2
  • JLink plus (JLinkExe 7.92c)
  • .axf is 10BM
  • .bin file extracted from .axf is around 500KB)
  • free rtos enabled

Full launch config for completeness

"configurations": [
{
"name": "app-debug",
"type": "cortex-debug",
"request": "launch",
"cwd": "${workspaceRoot}",
"executable": "${workspaceRoot}/build-app/app.axf",
"device": "MIMXRT1021xxx5A",
"serverpath": "/usr/bin/JLinkGDBServerCLExe",
"servertype": "jlink",
"preLaunchTask": "app - build - debug",
"interface": "swd",
"runToEntryPoint": "main",
"rtos": "FreeRTOS",
// "showDevDebugOutput": "raw"
},
{
"name": "app-release",
"type": "cortex-debug",
"request": "launch",
"cwd": "${workspaceRoot}",
"executable": "${workspaceRoot}/build-app/app.axf",
"device": "MIMXRT1021xxx5A",
"serverpath": "/usr/bin/JLinkGDBServerCLExe",
"servertype": "jlink",
"preLaunchTask": "app - build - release",
"interface": "swd",
"runToEntryPoint": "main",
"rtos": "FreeRTOS",
// "showDevDebugOutput": "raw"
},
{
"name": "hwtest",
"type": "cortex-debug",
"request": "launch",
"cwd": "${workspaceRoot}",
"executable": "${workspaceRoot}/build-hwtest/hwtest.axf",
"device": "MIMXRT1024xxx5A",
"serverpath": "/usr/bin/JLinkGDBServerCLExe",
"servertype": "jlink",
"preLaunchTask": "hwtest - build",
"interface": "swd",
"runToEntryPoint": "main",
"rtos": "FreeRTOS",
},
{
"name": "demo",
"type": "cortex-debug",
"request": "launch",
"cwd": "${workspaceRoot}",
"executable": "${workspaceRoot}/build-demo/demo.axf",
"device": "MIMXRT1024xxx5A",
"serverpath": "/usr/bin/JLinkGDBServerCLExe",
"servertype": "jlink",
"preLaunchTask": "demo - build",
"interface": "swd",
"runToEntryPoint": "main",
"rtos": "FreeRTOS",
},
{
"name": "attach app",
"type": "cortex-debug",
"request": "attach",
"cwd": "${workspaceRoot}",
"executable": "${workspaceRoot}/build-app/app.axf",
"device": "MIMXRT1021xxx5A",
"serverpath": "/usr/bin/JLinkGDBServerCLExe",
"postAttachCommands": [
"add-symbol-file ${workspaceRoot}/app/build-app/app.axf",
],
"servertype": "jlink",
"preLaunchTask": "app - build",
"postStartSessionCommands": [],
"interface": "swd",
// "showDevDebugOutput": "both",
// "showDevDebugTimestamps": true,
},
{
"name": "relocated app",
"type": "cortex-debug",
"request": "launch",
"cwd": "${workspaceRoot}",
"executable": "${workspaceRoot}/build-app/app.axf",
"serverpath": "/usr/bin/JLinkGDBServerCLExe",
"preLaunchCommands": [
"add-symbol-file ${workspaceRoot}/build-app/app.axf 0x601127D1",
],
"postLaunchCommands": [
],
"servertype": "jlink",
"device": "MIMXRT1021xxx5A",
"preLaunchTask": "app - build - release",
"serverArgs": ["-nogui"],
"postStartSessionCommands": [],
"interface": "swd",
//"runToEntryPoint": "main",
"showDevDebugOutput": "raw",
"showDevDebugTimestamps": true,
},
{
"name": "attach relocated app",
"type": "cortex-debug",
"request": "attach",
"cwd": "${workspaceRoot}",
"executable": "${workspaceRoot}/build-app/app.axf",
"serverpath": "/usr/bin/JLinkGDBServerCLExe",
"preAttachCommands": [
"add-symbol-file ${workspaceRoot}/app/build-app/app.axf 0x600d1f60",
],
"postAttachCommands": [
],
"servertype": "jlink",
"preLaunchTask": "app - build",
"postStartSessionCommands": [],
"interface": "swd",
// "showDevDebugOutput": "both",
// "showDevDebugTimestamps": true,
},
{
"name": "unit tests",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceRoot}/unit_tests/build/unittests",
"args" :["--gtest_color=yes"],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
],
"preLaunchTask": "unittests - build"
}
]

@basprins
Copy link
Author

Same here, removing the RTOS option from config makes a huge difference. No GDB weirdness since... fingers crossed for me...

@haneefdm
Copy link
Collaborator

"rtos": "FreeRTOS",

We don't do anything with the RTOS. We simply pass it to JLink. You can see that in the Debug Console. All your RTOS magic is between GDB and JLinkGDBServerCLExe. We have nothing to do with it.

For JLink, you have to actually pass the path to the DLL/so. I think the path can be relative to JLink install dir. We attempt to convert a simple name to the name of a DLL/so but best way is for you to supply that yourself.

image

You did not attach the contents of the Terminal where JLinkServer output exists. JLink may have crashed. You can probably see what is going on over there. YOu also did not provide the contents of Debug Console.

Please contact SEGGER if you are having issues if the JLink command line looks okay

@haneefdm
Copy link
Collaborator

I am closing this as it is not a problem with this extension. Since no relevant information from the Debug Console or from the TERMINAL(gdb-server) is provided, nothing here is actionable.

Please use triple back-quotes for things that look like code/XML/JSON or things that are not a conversation (logs, output, etc.). It is part of markdown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants