blog:pushbx:2025:1230_late_december_work_on_ldebug_and_extensions_for_ldebug
Late December work on lDebug and Extensions for lDebug
Non-regulation blog post.
- Doc formatting update in eld-patchqry section.
- In news-r10 mention the new patch query flag which forces single-sector operation.
- doc: Update cmdhelp-instsect.
- doc: Document need for calling yy_reset_buf for certain ELD operations.
- doc: Update currently used NASM version from 2023-10-11.
- Clarify ivSetup protocol comments, particularly to list bx as INP and CHG.
- Update attribution year to 2025 in isvariab.mac
- Update attribution year to 2025 in debug.mac
- Update two more attribution years in macro files.
- Update some macro comments in debug.mac macro file.
- Bugfix, in IF command's THEN handling, move the command to beginning of the line_in buffer. This is apparently expected by some Extensions for lDebug so this is the first changeset to make sure this is always true.
As the changeset message states:
Example that loops infinitely prior to this change:
if,exists,ext,extlib.eld,then,ext,extlib.eld,ldmem,mem(With
extname.eldinstalled!)
- Add and use a new errfix.eld function, this is used by the IF command to get errfix to move down its array entries to match the THEN command being put first.
- Fix IF command running THEN part in ifext.asm
- Add support for next and last data links for Extensions for lDebug, specifically in the ELD linker (eldlink.asm). A "next" link must be optional, and skips the default zero-init of the relocation if not in use. After a "next" link, a subsequent "next" link or a "last" link must follow. If a "next" link is found and used, the linker skips subsequent links up to and including a following "last" link.
- Make use of next and last data links in ldmem.asm for checking the code segment, either
code_segorcode_movable_seg. (This is the only use outside of test ELDs for next and last links yet. However, the linker optimises away the support for them at build time if not needed.) - Validate that a sequence of next and last links refers to the same relocation and section. This isn't technically required, but acts as a validity check to avoid surprises. And it's all build time checks, no additional size in the linker's run time code. If need be, there could be an option to be added later that relaxes these checks.
-
- Test J checks for the same label used for two data links, one optional and the next required, both not found. This exposes a bug when the same label is used like this. If DEBUGOPTLINK is on, the required diagnostic isn't displayed because the linker's build match function exits early.
- Test K checks next and last data links. If _ELD_BUG is enabled, it places a next and last data link in such a way that they don't refer to the same relocation.
- Add another invalid data link to test J. Its diagnostic also won't appear.
- Another new test ELD. Test L checks what happens when two optional data links to the same name are both not found. With DEBUGOPTLINK enabled, loading this ELD fails where it should succeed.
- Yet another test ELD. Test M checks that multiple required data links to the same invalid name work as expected (1 diagnostic per name, and abort loading).
- More test ELD. Test N checks multiple not found optional links are loaded and displayed as expected.
- Update duplicate link names handling in the ELD linker. This makes it so not found optional links are marked with the OR mask 80h in their name length byte rather than setting it to zero. This allows to reset the length later for another check, either optional or required. If an optional check fails again after encountering the masked length, it does not emit another copy of the diagnostic.
- Early in build match function, reset the ?optionalmissing flag. In the next changeset, add a comment explaining this addition.
- doc: Update manual with notes on duplicate data links where at least one of the duplicates is optional, and list "PM required" optionality for data links as well. Fix the quoting of that "PM required".
- doc: Mention next and last data links, without much explanation yet.
- Check at build time that a single data link doesn't occur after a next data link.
- doc: Add sections eldoptional and eldother, describing the required/PM required/optional and single/next/last keywords as well as the other data links.
- doc: List that other data links fall back to regular data links if not building with ELDOTHER enabled.
- Add a new test ELD. Test O uses the same invalid link thrice: once optional, then required, then optional again.
- Add another test ELD. Test P uses the same invalid link twice: First required, then optional. This reveals that the diagnostic emitted for a required link missing will shadow the diagnostic for a subsequent optional link referring to the same name. This is considered acceptable.
- doc: Document that required then optional link will not emit two diagnostics, as revealed by test P.
- Support next and last code links in extcall users. This was a little tricky because extcall doesn't just mark a relocation, it actively emits bytes to implement its call site. This was solved by adding
%if %%next != 400hso that single and last extcall code links will emit the code bytes, but next links won't. This ends up doing what we want. - Another additional test ELD. Test R uses several next and last code links.
- Use a different AMIS signature for the lDOS pre-boot loader. The inject.eld and ELD linker support for other linking needed updates to be able to detect the loader as well. (All other uses only want to detect the debugger, not the loader.)
- Optimise inject.asm, do the plex check with an INP:si, copied from like ELD linker does it for other linking detection.
- Undo patches to ELD linker plex check if no other link support is needed. In that case plex check can hardcode the "ecm" "lDebug" signature to check, and needn't accept the signature as a parameter.
- Optimise ELD linker if no optional data links are in use.
- In ldmem.eld accept ELDUSE noun, to display used and total amount of ELD spaces.
- Disable extlib.eld HELP DESCRIBEX command by default, it is only for debugging.
- Disable extlib.eld zeroing offsets at the end by default, only useful for debugging.
- If disabled, drop all calls to zerooffsets rather than only making the function body a no-op.
- Move extlib.asm namebuffer to initialised data and pre-init to 8 blanks. Because this is used only once, we can drop the code to blank-pad the buffer.
- Extract function comparenamebuffer. I initially misread
lea si, [di + eldiIdentifier]as referring to asi + displacementaddress. - Change specificerror entry so it takes a pointer, pointing to the low byte of the Return Code followed by the error message. Saves some code.
- Embed namebuffer into the not found message. Reduces code needed to display the error. The name buffer is no longer word-aligned but this is only a minor problem.
- Move a data link out of the way. It is only used to verify the debugger is compatible.
- Use extcall for InDOS rather than extcallcall. This was actually a pessimisation at one point, due to the differing alignment.
- Fix in linker: Branch correctly when link not found in first pass. This got mixed up with another
@@use. - In extlib.asm enable a jump. This prepares for moving a lot of code.
- Add new macros that allow placing multiple extcallcall dump sites.
- Free up 880 trailing bytes in the ELD code section of extlib.asm before trying to load the embedded ELD. This uses the re-ordered code to discard parts not needed to load an already identified library entry.
- Optimise extlib.asm some more. This brings it down to about 3840 bytes in the code section (what has to be loaded, including transient part and the linker). Initially I messed up the check for a library entry name ending in
.eldor.xld, checking that the first letter is equal to both E and X rather than either of them.
You could leave a comment if you were logged in.
blog/pushbx/2025/1230_late_december_work_on_ldebug_and_extensions_for_ldebug.txt · Last modified: by ecm
