intel / vscode-tcf-debug

Visual Studio Code Target Communication Framework (TCF) Debugger Extension
MIT License
9 stars 2 forks source link

Extension with TRACE32 debugger #3

Closed wwbenayed closed 12 months ago

wwbenayed commented 1 year ago

I tried to connect the extension to a running TRACE32 debugger (with TCF enabled) This is the log I get:


13:09:41 TCF debug session initialized
13:09:41 Launch request [object Object]
13:09:41 Connected!
13:09:41 ➡️ Sending ELocatorHello["Locator"]
13:09:41 ⬅️ Received Locator Hello ["ZeroCopy","T32_OsAwareness","DPrintf","Profiler","Streams","LineNumbers","MemoryMap","Memory","Breakpoints","Expressions","WR_SymbolsList","Symbols","StackTrace","Disassembly","PathMap","Registers","RunControl","Locator"]
13:09:41 ➡️ Sending CContextQuery/0ContextQueryquery"*"
13:09:46 ⬅️ Received Locator peerHeartBeat "TCP:127.0.0.1:1534"
13:09:46 ⬅️ Received Locator peerHeartBeat "TCP:192.168.56.1:1534"
13:09:46 ⬅️ Received Locator peerHeartBeat "TCP:192.168.78.1:1534"
13:09:46 ⬅️ Received Locator peerHeartBeat "TCP:192.168.10.1:1534"
13:09:46 ⬅️ Received Locator peerHeartBeat "TCP:172.24.144.1:1534"
13:09:46 ⬅️ Received Locator peerHeartBeat "TCP:172.23.0.1:1534"
13:09:46 ⬅️ Received Locator peerHeartBeat "TCP:10.99.64.24:1534"
13:09:46 ⬅️ Received Locator peerHeartBeat "TCP:192.168.187.30:1534"
13:09:51 Command timeout ContextQuery/0

Increasing Timeout is not helpful.

iebold commented 1 year ago

Very interesting. The extensions runs a ContextQuery as part of the initial handshake. It seems your TCF agent does not have a ContextQuery service at all!

We can fallback to RunControl. Will include a fix for this in the next release.

In the mean time you can probably comment that part in handshake.

iebold commented 1 year ago

PS: Also note your debugger is most likely not compliant. It should either return an error response or disconnect once it got a command for an unsupported TCF service.

wwbenayed commented 1 year ago

I removed the ContextQuery from the handshake. Now, seams it try to set a breakpoint but with empty parameters. So, an error is returned:

15:38:51 TCF debug session initialized
15:38:51 Launch request [object Object]
15:38:51 Connected!
15:38:51 ➡️ Sending ELocator Hello ["Locator"] 
15:38:51 ⬅️ Received Locator Hello ["ZeroCopy","T32_OsAwareness","DPrintf","Profiler","Streams","LineNumbers","MemoryMap","Memory","Breakpoints","Expressions","WR_SymbolsList","Symbols","StackTrace","Disassembly","PathMap","Registers","RunControl","Locator"]
15:38:51 ➡️ Sending CBreakpoints/0 Breakpoints set[] 
15:39:10 Bad packed: first zero at index 74 {"Code":30,"Time":1699627150782,"Format":"Exception in message handler"}
iebold commented 1 year ago

Heh, I guess you could either fix the debugger (https://download.eclipse.org/tools/tcf/tcf-docs/TCF%20Service%20-%20Breakpoints.html#CmdSet expressly allows empty arrays) or set some breakpoint in VSCode so the list isn't empty.

iebold commented 12 months ago

Fixed in the latest update. The handshake does fallback to RunControl.

wwbenayed commented 11 months ago

In TCF, Breakpoints must, at least, have an ID. So, an empty list is not accepted. I tried to set a breakpoint in VSCode, but I still get an empty list.

iebold commented 11 months ago

According to the TCF spec https://download.eclipse.org/tools/tcf/tcf-docs/TCF%20Service%20-%20Breakpoints.html#CmdSet , an empty array and even null is a valid argument.

If you have your breakpoint set in VSCode it should be sent with set.