Skip to content

feat(cfc): emit diagram locations in debug info - #1910

Merged
volsa merged 3 commits into
vosa/PRG-4757-2from
vosa/PRG-4757-3
Sep 14, 2026
Merged

volsa merged 3 commits into
vosa/PRG-4757-2from
vosa/PRG-4757-3

Conversation

@volsa

@volsa volsa commented Sep 8, 2026

Copy link
Copy Markdown
Member

Problem: When debugging a CFC POU, the IDE has to map a stop or a breakpoint to one of its two editors: the text area with the declaration, addressed by line, or the node graph, addressed by execution order. The debug info attributes both to the same source file <file>.cfc, so main.cfc:1 may mean declaration line 1 or execution order 0 and the IDE cannot tell which.

Solution: Attribute node graph statements to their own source file <file>.cfc.<diagram> in the debug info, at line execution order plus one since DWARF reserves line 0, while the declaration stays in <file>.cfc. The file name alone now tells the IDE which editor a location belongs to, mirroring the diagnostics format of the previous PR.

Refs: PRG-4757

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Build Artifacts

🐧 Linux

Artifact Link Size
plc-x86_64 Download 43.5 MB
plc-aarch64 Download 43.4 MB
stdlib Download 32.4 MB
deb-x86_64 Download 38.4 MB
schema Download 0.0 MB
deb-aarch64 Download 30.8 MB

From workflow run

🪟 Windows

Artifact Link Size
plc.exe Download 38.4 MB
stdlib.dll Download 0.1 MB
stdlib.lib Download 4.0 MB

From workflow run

@volsa volsa changed the title feat(cfc): scope diagram statements to their own debug file feat(cfc): emit diagram locations in debug info Sep 8, 2026
Illustrated:
```
+-------- myAdd ---------+
a1 ------o-| IN1 myAdd |-o------> b1 (2)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not have a return pin name, same as PR 2. Maybe we need to tackle this in a follow up PR?

@volsa
volsa marked this pull request as ready for review September 8, 2026 18:52
@github-actions

Copy link
Copy Markdown

2 findings in 10m 39s for $0.42 between b916366 (vosa/PRG-4757-2) and 5eb0956 (vosa/PRG-4757-3):

  • P2 src/codegen/debug.rs:578: member_file treats every member location as a real source file. Compiler-generated members such as an inherited __<base> field use SourceLocation::internal(), so derived-POU debug types now reference a separate <internal> DIFile instead of the containing POU's file; inspecting inherited state is attributed to a non-source file.
  • P2 src/codegen/debug.rs:1319: For a CFC PROGRAM/FB, the implementation index records the first diagram statement's block location, so this now creates the implicit struct/self parameter in the virtual <source>.<diagram> file at an execution-order line. The parameter is consequently shown as belonging to the diagram rather than the POU declaration when inspecting self.

@ghaith ghaith left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK for me, since the clanker has comments i'll wait for your signal to approve

volsa and others added 3 commits September 14, 2026 11:28
Problem: the debug line of a diagram statement lands in the same DWARF file as the declaration, so line 1 is ambiguous between declaration line 1 and execution order 0.

Solution: emit a second debug file <file>.cfc.<diagram> and scope diagram statements to it through a lexical block, with the execution order plus one as the line, since DWARF reserves line 0.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Problem: the checks read as a chain of anonymous metadata numbers.

Solution: order them from source file to instruction, name each group, and open with the diagram under test.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

0 findings in 6m 59s for $0.25 between 8a5364e (vosa/PRG-4757-2) and dd6c2ed (vosa/PRG-4757-3)

@volsa
volsa added this pull request to the merge queue Sep 14, 2026
An error occurred while trying to automatically change base from vosa/PRG-4757-2 to vosa/PRG-4757-1 September 14, 2026 13:40
Merged via the queue into master with commit e147785 Sep 14, 2026
23 checks passed
@volsa
volsa deleted the vosa/PRG-4757-3 branch September 14, 2026 13:48
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

Successfully merging this pull request may close these issues.

2 participants