I have noticed that disconnect behaves differently on Win/Linux/Mac. On Windows after a disconnect(when request=attach) target gets halted regardless of the previous target state. On the other hand, on Linux/Mac detach resumes the target.
This is reproducible on PSoC6 devices.
I did some analysis and here are my observations:
-
It is not reproducible with OpenOCD(Cypress version), probably because 'Detach' is implemented there. If we are talking about JLink GDB server - it does not support detach command.
-
When JLink GDB shuts down "correctly" (exited, but not killed), it resumes the target. Based on the logs (attached) it looks like on Linux/Mac it shuts down "correctly", while on Windows it is just killed. The following message in JLink log indicate GDB was exited properly: "Restoring target state and closing J-Link connection..."
-
If I am launching "Cortex-Debug" debugging on Windows, I see that detach hangs at this line of code preventing GDB server from shutting down "correctly":
|
await this.sendCommand('target-detach'); |
-
The issue is not something new, I have tried even very old Cortex-Debug versions.
Attached logs GDB traces and JLInk GDB server logs.
jlink_attach_detach_gdb_traces_ubuntu.txt
jlink_attach_detach_gdb_traces_win.txt
jlink_attach_detach_ubuntu.txt
jlink_attach_detach_win.txt
I am using:
VSCode-1.60.0
Cortex-Debug-v0.4.4
JLink_V754
So, the question: is it possible to unify behavior across OSes (I believe the proper one is to resume target upon detach)?
I have noticed that disconnect behaves differently on Win/Linux/Mac. On Windows after a disconnect(when request=attach) target gets halted regardless of the previous target state. On the other hand, on Linux/Mac detach resumes the target.
This is reproducible on PSoC6 devices.
I did some analysis and here are my observations:
It is not reproducible with OpenOCD(Cypress version), probably because 'Detach' is implemented there. If we are talking about JLink GDB server - it does not support detach command.
When JLink GDB shuts down "correctly" (exited, but not killed), it resumes the target. Based on the logs (attached) it looks like on Linux/Mac it shuts down "correctly", while on Windows it is just killed. The following message in JLink log indicate GDB was exited properly: "Restoring target state and closing J-Link connection..."
If I am launching "Cortex-Debug" debugging on Windows, I see that detach hangs at this line of code preventing GDB server from shutting down "correctly":
cortex-debug/src/backend/mi2/mi2.ts
Line 263 in e50947c
The issue is not something new, I have tried even very old Cortex-Debug versions.
Attached logs GDB traces and JLInk GDB server logs.
jlink_attach_detach_gdb_traces_ubuntu.txt
jlink_attach_detach_gdb_traces_win.txt
jlink_attach_detach_ubuntu.txt
jlink_attach_detach_win.txt
I am using:
VSCode-1.60.0
Cortex-Debug-v0.4.4
JLink_V754
So, the question: is it possible to unify behavior across OSes (I believe the proper one is to resume target upon detach)?