This shows you the differences between two versions of the page.
— |
blog:pushbx:2022:0826_recent_segmentation_in_ldebug_and_not_yet_merged_nasm_patches [2022-08-26 01:06:20 +0200 Aug Fri] (current) ecm created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Recent segmentation in lDebug and not yet merged NASM patches ====== | ||
+ | |||
+ | The lDebug debugger is a demanding application. | ||
+ | It's driven NASM bug reports for a while now. | ||
+ | There are [[https:// | ||
+ | in the NASM bugzilla, most of which cropped up during lDebug development. | ||
+ | As [[blog: | ||
+ | |||
+ | |||
+ | ===== Segmentation ===== | ||
+ | |||
+ | The debugger now requires three main segments to address | ||
+ | parts of itself if a build utilising its full capabilities is assembled. | ||
+ | These are: | ||
+ | |||
+ | The process/ | ||
+ | most data and messages, all assembler tables, | ||
+ | all code entrypoints into the debugger, | ||
+ | as well as the debugger' | ||
+ | |||
+ | The code section, which holds most of the code. | ||
+ | It is the only section currently patched using | ||
+ | the 386+ respectively non-386 patch tables | ||
+ | in the initialisation code. | ||
+ | (The data entry section contains a few patch sites | ||
+ | but these are handled one by one without tables.) | ||
+ | |||
+ | The second code section. | ||
+ | This is only included if the '' | ||
+ | It can hold all the symbolic code included from | ||
+ | the '' | ||
+ | optionally even most code assembled from the | ||
+ | '' | ||
+ | (With the exception of the XMS detection | ||
+ | and calling code, which use '' | ||
+ | have a number of 386 patches so they go into the first code section.) | ||
+ | |||
+ | Additionally, | ||
+ | as their own segments. Finally, the init section is used only | ||
+ | for initial set-up. | ||
+ | |||
+ | |||
+ | ===== Current segment use ===== | ||
+ | |||
+ | Building the most recent lDebug revision with a command like this: '' | ||
+ | |||
+ | Results in the following size messages: | ||
+ | |||
+ | < | ||
+ | expr.asm: | ||
+ | init.asm: | ||
+ | init.asm: | ||
+ | init.asm: | ||
+ | init.asm: | ||
+ | debug.asm: | ||
+ | debug.asm: | ||
+ | debug.asm: | ||
+ | debug.asm: | ||
+ | debug.asm: | ||
+ | |||
+ | (The auxiliary buffer and history buffer take up about 8 KiB each.) | ||
+ | |||
+ | This sums to 145 KiB used by the resident debugger. | ||
+ | |||
+ | |||
+ | ===== NASM bugs ===== | ||
+ | |||
+ | My most recent patch to NASM addresses a problem that | ||
+ | cropped up during lDebugX symbolic development. | ||
+ | It appeared to be caused by the sheer size of the sources moreso | ||
+ | than specifically the new dual code segments split. | ||
+ | I found that recent revisions of the assembler | ||
+ | would be killed by the system' | ||
+ | This was due to exceeding 3.3 GiB of memory use, | ||
+ | of the 6 GiB of memory allocated to our server. | ||
+ | This would also be too close for comfort to the 4 GiB address space limit | ||
+ | on 32-bit x86 hosts, although our server runs in amd64 long mode. | ||
+ | |||
+ | One cause of this was a change in how the preprocessor | ||
+ | allocates tokens. Instead of storing a pointer to a separate allocation | ||
+ | for each token' | ||
+ | (on amd64 hosts) and text of up to 47 bytes is stored inline in the token' | ||
+ | With thousands of tokens, most of which store text much shorter | ||
+ | than 47 bytes, the memory use has risen a lot. | ||
+ | |||
+ | [[https:// | ||
+ | Although this does not restore the '' | ||
+ | it does drop it to below 2.5 GiB which suffices to build lDebugX symbolic | ||
+ | on our server. | ||
+ | |||
+ | The next two bugs are minor problems | ||
+ | [[https:// | ||
+ | as well as | ||
+ | [[https:// | ||
+ | |||
+ | The [[https:// | ||
+ | [[https:// | ||
+ | I found that it didn't work in the recent NASM revisions. I checked the preprocessor sources to determine if the feature was removed intentionally, | ||
+ | |||
+ | The fifth bug I [[https:// | ||
+ | [[https:// | ||
+ | in 2022 February. I'm still waiting on it being merged. | ||
+ | |||
+ | Even older, now fixed, bugs include | ||
+ | [[https:// | ||
+ | in preprocessor '' | ||
+ | [[https:// | ||
+ | |||
+ | |||
+ | I hope that all these bugfixes will be merged into NASM soon. | ||
+ | |||
+ | |||
+ | {{tag> | ||
+ | |||
+ | |||
+ | ~~DISCUSSION~~ | ||