Repository navigation
Fixes: Debugger and disassembler - #326
Open
ElminsterAU wants to merge 1 commit into
Open
ElminsterAU wants to merge 1 commit into
ElminsterAU wants to merge 1 commit into
Conversation
These fixes come from NexusDB, which ships Pascal Script as its script engine. Each was found and fixed there; most were measured against what Delphi itself does with the same code, and most have a regression test in NexusDB's own suite, which runs on Delphi 7 through 13 Florence (Win32 and Win64) and on Free Pascal 3.2.2 (i386) and 3.3.1 (x86_64). NexusDB builds the engine with PS_USECLASSICINVOKE and PS_USESSUPPORT; the fixes are given here in Pascal Script's own unit names and configuration. uPSDebugger.pas: - The line hook sees the current routine's variables - No source line after a line hook stopped the script - StepOver of a native call that runs a script routine - The debug record looked up again after a line hook that ran a script routine - GetCurrentPosition translates the current instruction - GetCallStack ends at a stack base without a return address and names the main block - No routine's debug record is current without debug information - The debug record is the current routine's whenever it is read - The debug executor looked up the current instruction's source position by scanning the routine's whole position table before every instruction, so with debug information -- every TPSScript's default -- a script ran slower the more statements its routine held; the table is in code order, so the lookup is now a binary search - The debug executor -- every TPSScript's -- took Pause for the debugger's wait at the next line, which needs an idle call; with none, as in a TPSScript that is no TPSScriptDebugger, a host's Pause was ignored and the script ran on. Without an idle call it is now the executor's own pause - The debug executor's wait at a line -- where StepInto or StepOver arrive, or a Pause whose idle call the host then took away -- needs an idle call; with none it ran on and left the debugger paused for good. Without one it is now the executor's own pause, as an earlier fix made Pause uPSDisassembly.pas: - Delphi XE3 - XE5 for Win64 leak the exception object of an except handler left by a jump; each such handler is left after its end
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Debugger and disassembler: 12 changes, each described in the commit messages.
This is one of a series of pull requests carrying the fixes NexusDB made to Pascal Script, split by area so that each can be reviewed on its own. The fixes are listed one per line in each commit's message.
Applies to master on its own.
Tested. With the whole series applied, every unit of
Sourcecompiles, and a script run throughTPSScript(strings, Int64, reals, calls into host functions, exceptions, a class from the Classes library,for/Break) gives the expected results, on Delphi 7, 2005, 2006, 2007, 2009, 2010, XE, XE2 - XE8 and 10 Seattle - 13 Florence (Win32, and Win64 from XE2), and on Free Pascal 3.2.2 (i386) and 3.3.1 (x86_64), with and withoutPS_USESSUPPORT; compilers before XE4 need the last pull request of the series. Master as it stands does not compile on XE4, XE5 Win64, 10 Seattle, 10.1 Berlin, 10.3 Rio Win64, Free Pascal 3.2.2 or 3.3.1, nor on anything before XE4.Beyond that smoke test, the fixes were developed and are covered in NexusDB, whose suite runs about 6,400 checks on 37 Delphi compiler / platform combinations and on Free Pascal. NexusDB defines
PS_USECLASSICINVOKE, so there every Delphi calls native routines throughx86.inc/x64.inc; theInvokeCall.incpath (the default from Delphi 10 Seattle) is exercised here by the smoke test only.