[hatari-devel] Debugger command history broken on v2.6.0 on Windows

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi,

unfortunately, I found a regression in Hatari 2.6.0 on Windows, regarding the built-in debugger. Thanks to libreadline, the debugger has command-line editing features, such as built history that can be accessed with cursor up / down. This worked perfectly with Hatari 2.5.0.

However, in 2.6.0, it stops working, but only after(!) you display memory contents with the "m" command. After that, pressing the cursor keys will only print weird character combinations instead of accessing the command-line history.

It took me a while to understand what happens. Since 2.6.0, printing memory contents invokes Str_AtariToHost [1], which calls Str_AtariToLocal [2], which calls initCharacterMappings, which calls setlocale [4].

Apparently, libreadline does not appreciate setlocale being called right under its nose. If I patch out the setlocale call, the command-line editing starts working again. However, I suppose the setlocale call is there for a reason. Still, as it is now, the usability of the debugger is quite impacted, and this should be somehow fixed.

There is one slightly weird workaround. If I launch Hatari with the option "--gemdos-conv on", Str_AtariToHost is called early during startup by Str_Filename_Atari2Host [5]. I presume this makes the setlocale call happen before libreadline even is initialized. In any case, "--gemdos-conv on" makes the debugger command-line editing work again.

Regards
Christian

[1] https://github.com/hatari/hatari/blob/a4f405374cc8922ac200181066735bc50010fbf6/src/debug/debugcpu.c#L535 [2] https://github.com/hatari/hatari/blob/a4f405374cc8922ac200181066735bc50010fbf6/src/str.c#L560 [3] https://github.com/hatari/hatari/blob/a4f405374cc8922ac200181066735bc50010fbf6/src/str.c#L476 [4] https://github.com/hatari/hatari/blob/a4f405374cc8922ac200181066735bc50010fbf6/src/str.c#L364 [5] https://github.com/hatari/hatari/blob/a4f405374cc8922ac200181066735bc50010fbf6/src/str.c#L554
--
Christian Zietz  -  CHZ-Soft  -  czietz@xxxxxxx
WWW: https://www.chzsoft.de/
New GnuPG-Key-ID: 0x8708B34C827B159E




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/