stella icon indicating copy to clipboard operation
stella copied to clipboard

Debugger crashing

Open thrust26 opened this issue 2 years ago • 1 comments

During development of a 4K ROM, the debugger suddenly started crashing right at the start. Something in the ROM code causes this. This is no new bug, all Stella versions (tested down to 4.7.2) crash. DiStella runs endlessly.

thrust26 avatar Sep 30 '22 15:09 thrust26

Not reproducible anymore. But the bug was real (myAddressQueue grew endlessly). Also the disassembly partially failed. Something in Distella is buggy.

thrust26 avatar Oct 01 '22 17:10 thrust26

Meanwhile I found out, that the myAddressQueue virtually explodes in size. No clue why, though.

Attached is an example ROM. The_Core.zip

The freeze seems to happen more frequently if you call it via command line, e.g. stella.exe rom.bin

thrust26 avatar Jan 16 '23 21:01 thrust26

Found the problem: I had an old .cfg file with a matching name stored in Stella's cfg folder. After removing it, everything is fine. test.zip

It seems that the provided address ranges are not at opcode boundaries (e.g. adding a NOP to the source code changes the freezing) and therefore cause an endless loop. But IMO even an invalid .cfg file should not freeze Stella. Nevertheless, I reduced the priority.

thrust26 avatar Jan 17 '23 09:01 thrust26

So this cfg file fails only with the ROM posted in the previous comment?

sa666666 avatar Jan 17 '23 12:01 sa666666

Not only with this file. I had the problems long before (I use to call all my assembled files test.bin).

If the ROM has the same name as the config file, then Stella loads the directives. And if these directives conflict (in a certain way) with the ROM's code, then DiStella loops endlessly.

Maybe by removing the directives step by step, I can identify what exactly causes this.

thrust26 avatar Jan 17 '23 12:01 thrust26

Minimized the directives in test.cfg into:

ORG f000
ROW f4b9 f4b9
ROW f787 f787

Debugger still freezes.

thrust26 avatar Jan 17 '23 15:01 thrust26

Disassembled addresses not marked as CODE will be pushed to the address queue and marked as CODE. However, if the address has a directive, then the directive has priority over the code marking. Then the address would be pushed over and over to the address queue. To avoid this, there is a check at the beginning of DiStella::disasmFromAddress. This check was lacking ROW and that caused an endless loop if the ROW directive pointed to a jump/branch address.

thrust26 avatar Jan 17 '23 15:01 thrust26

Fix breaks finding 'tentative code'.

thrust26 avatar Jan 17 '23 22:01 thrust26