Skip to content

uPSDebugger: add HasCodeAtRow for exact breakpoint-line testing#319

Open
TetzkatLipHoka wants to merge 1 commit into
remobjects:masterfrom
TetzkatLipHoka:feature/debugger-hascoderow
Open

uPSDebugger: add HasCodeAtRow for exact breakpoint-line testing#319
TetzkatLipHoka wants to merge 1 commit into
remobjects:masterfrom
TetzkatLipHoka:feature/debugger-hascoderow

Conversation

@TetzkatLipHoka

Copy link
Copy Markdown

Adds TPSCustomDebugExec.HasCodeAtRow(Row, Fn) - a public, read-only query
answering "can a breakpoint sit on this source line?" by scanning the debug
position tables that are already built during LoadDebugData.

Why

An IDE/editor integrating the debugger has to decide, per source line, whether
to offer a breakpoint (gutter glyph, F5 toggle). The information is exact in
the position table - every opcode records its source row - but there was no
public accessor: callers had to walk the private FDebugDataForProcs tables
themselves, or fall back to a text heuristic that cannot distinguish a
declaration body, a comment or a continuation line from real executable code.

What

{ True when any opcode of any procedure maps to source row Row.
  Fn filters by module name ('' = any file). }
function HasCodeAtRow(Row: Cardinal; const Fn: tbtstring = ''): Boolean;

A small scan of the loaded tables; returns False when no debug data is loaded.
No new state, no behavior change to existing methods.

Verified

DCC32/DCC64: against a compiled script the table correctly reports executable
lines True and declaration / begin / blank lines False (exactly what a gutter
needs). Trivial portable Pascal - no Exit(value)/generics.

🤖 Generated with Claude Code

…-line testing

An IDE integrating the debugger needs to know whether a given source line can
carry a breakpoint, i.e. whether any bytecode maps to that line. The debug
position table already holds this information (per procedure, a list of
FileName/Position/Row/Col records), but there was no public way to query it
by row - callers had to either walk the private tables or fall back to a
text heuristic that cannot tell a declaration body or comment from real code.

HasCodeAtRow(Row, Fn) returns True when any procedure has a position entry
for that source row (Fn '' matches any module). It is a small read-only scan
of the already-loaded position tables; it returns False when no debug data
is loaded.

Verified DCC32/DCC64: against a compiled script the table correctly reports
executable lines True and declaration / begin / blank lines False.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.

1 participant