apache / daffodil-vscode

Apache Daffodilâ„¢ Extension for Visual Studio Code
https://daffodil.apache.org/
Apache License 2.0
10 stars 20 forks source link

DataEditor character highlight doesn't advance when the continue (F5) option is selected. #995

Closed rthomas320 closed 2 months ago

rthomas320 commented 3 months ago

The character highlight in the dataEditor view moves appropriately when stepover (F10) is selected, but it doesn't move to the appropriate character when continue (F5) is selected. If stepover is selected after continue, the character highlight will jump to the appropriate character. But if continue is selected again the character highlight won't move again until stepover is selected. This behavior occurs in both the Windows 10 environment and the Rocky 9 environment.

lrbarber commented 3 months ago

Are you saying that the location pointer doesn't update to the correct location when you hit a breakpoint?

arosien commented 2 months ago

Are you saying that the location pointer doesn't update to the correct location when you hit a breakpoint?

That's what it sounds like to me. I can try to reproduce and also check what events the editor is responding to.

stricklandrbls commented 2 months ago

@arosien The editor is listening to all debug custom events within the debug session: https://github.com/apache/daffodil-vscode/blob/bc86057b2638970bf9b38360fb6d66220ab53038/src/dataEditor/dataEditorClient.ts#L169-L176

Only messages with the bytePos1b within the daffodil.data event types are being forwarded to the data editor.

Both @shanedell and I have seem variable results when debugging the extension and trying to set breakpoints and invoking the Continue option. Depending on where the breakpoint is set I will either get a daffodil.data event fired off with a bytePos1b value of the byte position from whenever Continue is pressed. Or I will get no daffodil.data event fired at all, which is also reflected in the VSCode terminal where the Scala logs are printed.

arosien commented 2 months ago

Both @shanedell and I have seem variable results when debugging the extension and trying to set breakpoints and invoking the Continue option. Depending on where the breakpoint is set I will either get a daffodil.data event fired off with a bytePos1b value of the byte position from whenever Continue is pressed. Or I will get no daffodil.data event fired at all, which is also reflected in the VSCode terminal where the Scala logs are printed.

A long time ago I was smart and wrote a TODO for a possible race condition about this, yay!

https://github.com/apache/daffodil-vscode/blob/bc86057b2638970bf9b38360fb6d66220ab53038/debugger/src/main/scala/org.apache.daffodil.debugger.dap/Parse.scala#L1393

scholarsmate commented 2 months ago

@arosien, is it something that you can fix?

arosien commented 2 months ago

@arosien, is it something that you can fix?

It's a good guess that it's the noted race condition, which I can fix. I'm just having some trouble getting my local launch.json to work...

arosien commented 2 months ago

Ok, local env is good now. It's not the noted race condition however; the position event is explicitly only emitted while stepping, which is not the correct behavior. Working on a fix.