YosysHQ / nextpnr

nextpnr portable FPGA place and route tool
ISC License
1.24k stars 237 forks source link

nextpnr-gowin GUI crash when opening JSON file in the GUI (debug test included) #1255

Open BellssGit opened 6 months ago

BellssGit commented 6 months ago

OS: X86, Fedora39 Version: Latest Git Test File: Blinky example Launch args: "--gui --device GW1NR-LV9QN88PC6/I5"

As described in the title, when I tried to open the JSON file using GUI, The software crashed. shows "signal SIGSEGV (Address boundary error)"

So I built a Debug version and traceback using GDB, turns out it got a seg fault at "pyinterpreter.cc" line 134

    PyRun_SimpleString("import sys\n"
                       "import redirector\n"
                       "import tempfile\n"
                       "sys.path.insert(0, \".\")\n" // add current path
                       "sys.stdout = redirector.redirector()\n"
                       "sys.stdin = tempfile.TemporaryFile(mode='r')\n"
                       "sys.stderr = sys.stdout\n"
                       "import rlcompleter\n"
                       "sys.completer = rlcompleter.Completer()\n");

This part of the code was executed when the program launched.

Then opening a JSON file in GUI will make it run again and cause the crash.

I don't know if this is the right way to fix it, but I added a flag to make it only run once. Now I can open JSON file in GUi without any problem.

If someone can check and fix this bug, much appreciated!