User Tools

Site Tools


blog:pushbx:2023:0723_blog_42_-_nasm_leaks_ldebug_check_sections_various

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

blog:pushbx:2023:0723_blog_42_-_nasm_leaks_ldebug_check_sections_various [2023-07-23 20:46:28 +0200 Jul Sun] (current)
ecm created
Line 1: Line 1:
 +====== Blog 42 - NASM leaks, lDebug check sections, various ======
 +
 +**2023-07-23**
 +
 +This file is blog42.txt!
 +
 +This week several developments on the debugger happened, as well as two bug reports to the Netwide Assembler.
 +
 +
 +===== webecm change =====
 +
 +During use of [[https://pushbx.org/ecm/web/#links|the NASM bug reports link on the website]], I found that the link did not specify an order for the search results in case the user is not logged in. I [[https://hg.pushbx.org/ecm/webecm/rev/148ce7effddd|fixed this]].
 +
 +
 +===== NASM reports =====
 +
 +[[https://bugzilla.nasm.us/show_bug.cgi?id=3392893|The second, less important report]] concerns empty ''%rep'' loops in mmacro expansions. This is unlikely to really affect anything, so it is more of a trash report than usual for me. I marked it as "annoyance" accordingly.
 +
 +[[https://bugzilla.nasm.us/show_bug.cgi?id=3392892|The first report]] I marked as a "blocker". It is a major memory leak that easily blows up the memory requirements of the assembler when using many ''%rep'' loops. There are probably more leaks than this one, but this one had a significant impact on memory use.
 +
 +For instance, assembling the debugger normally (no DPMI support, not debuggable) takes less than 50 MiB with this bug fixed, as opposed to more than 500 MiB before the fix. Assembling the conditionally debuggable, DPMI, imm asm, symbolic debugger with the ''_CHECKSECTION'' build option enabled takes some 100 MiB with the bugfix and gets killed by the kernel at about 2.5 GiB memory use without it.
 +
 +===== lDebug changes =====
 +
 +  * [[https://hg.pushbx.org/ecm/ldebug/rev/18bdc36d2a8d|Documented RH mode and RH command]] somewhat.
 +  * [[https://hg.pushbx.org/ecm/ldebug/rev/c0aedc69d7f6|Add IOK variable]].
 +  * [[https://hg.pushbx.org/ecm/ldebug/rev/8fd818f7a313|Changed both IOI and IOK variables]] to always read from a terminal, not RC/Y/RE script.
 +  * [[https://hg.pushbx.org/ecm/ldebug/rev/dfb00345dbad|Trying to enable RH mode from a boot Y script file]] will fail in a more graceful way than infinitely looping.
 +  * Introduce /A switch to [[https://hg.pushbx.org/ecm/ldebug/rev/f0a5a0f8add1|increase auxiliary buffer size]] in application mode.
 +  * [[https://hg.pushbx.org/ecm/ldebug/rev/32e3222e5fdd|Add variable RHCOUNT]] and [[https://hg.pushbx.org/ecm/ldebug/rev/2ccfa4c28073|fix RH command]] behaviour when [[https://hg.pushbx.org/ecm/ldebug/rev/fa8b9a7e04c6|inexistent step counts]] are specified.
 +  * [[https://hg.pushbx.org/ecm/ldebug/rev/68d7adf75626|Add variable DAUXBUFLEN]].
 +  * [[https://hg.pushbx.org/ecm/ldebug/rev/54fffa9cc31c|Add H AS SIZE command]] to show decimal number in KiB (or MiB or GiB).
 +  * Add option to run main assembler command [[https://hg.pushbx.org/ecm/ldebug/rev/0fff8307b22e|with GNU time to display]] memory use and wall time taken.
 +  * Add ''::scripts::'' [[https://hg.pushbx.org/ecm/ldebug/rev/0782edacc661|prefix for Y command]] in application/device mode, init from ''%LDEBUGSCRIPTS%'' variable or executable location.
 +  * [[https://hg.pushbx.org/ecm/ldebug/rev/4824b6408e90|Try scripts path]] if a Y command doesn't find its script file.
 +
 +
 +==== Check sections options ====
 +
 +[[https://hg.pushbx.org/ecm/ldebug/rev/7d94a90c607b|The big change]] is the macros for the ''_CHECKSECTION'' build options. These macros can check for cross-section near direct branches on every ''call'', ''jmp'', [[https://hg.pushbx.org/ecm/ldebug/rev/08035ae15c50|or jcc]]. This expands each such instruction [[https://hg.pushbx.org/ecm/ldebug/file/4824b6408e90/source/debug.mac#l1501|to dozens of preprocessor directives]], including three ''%rep'' loops.
 +
 +The performance of these macros is bad. The assembly time may take as much as five times as long as it does without these options. The memory use of the assembler, even with the bugfix described above, may as much as triple.
 +
 +The options are only useful when building with dual code segments enabled.
 +
 +This feature already helped uncover some incorrect branches, [[https://hg.pushbx.org/ecm/ldebug/rev/ea208738a152#l1.1|including one I was completely unaware of]]. Success!
 +
 +{{tag>nasm ldebug}}
 +
 +
 +~~DISCUSSION~~
  
blog/pushbx/2023/0723_blog_42_-_nasm_leaks_ldebug_check_sections_various.txt ยท Last modified: 2023-07-23 20:46:28 +0200 Jul Sun by ecm