Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBM 1130: GUI resource file, RegSanityCheck fix #365

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bscottm
Copy link
Contributor

@bscottm bscottm commented Mar 14, 2024

  • Add the missing ibm1130.rc GUI resource file to the Windows build so that the GUI renders correctly.

  • Add "TEST_ARGS" argument to CMake's add_simulator function so that the IBM 1130 simulator can pass to "-g" on the command line to disable the GUI when running RegisterSanityCheck, i.e.:

    ibm1130 RegisterSanityCheck -g

    This fixes an edge case Heisenbug encountered during Github CI/CD tests where ibm1130 appears to hang indefinitely on the Windows runners.

    The cause is the GUI's Pump() thread function being prematurely terminated before all GUI resources are acquired: RegisterSanityCheck completes and starts terminating the simulator, which prejudiciously terminates the Pump() thread. The Pump() thread, in the meantime, can be terminated in the middle of resource acquisition due to thread scheduling latency. The net result is an infinite loop in the MS C runtime trying to exit the process with unstable internal state. (Separate patch: synchronization across main and Pump() threads to ensure resource acquisition completes.)

    This issue never shows up (cannot show up) on non-Windows platforms or the SIMH makefile.

  • cmake/generator.py, cmake/simgen: Add a "test_args" keyword argument to the BasicSimulator constructor that holds the tests argument parameter emitted as the "TEST_ARGS" argument to a simulator's add_simulator(). Ensure that the IBM 1130 emits 'TEST_ARG "-g"' in its add_simulator().

  • scp.c: reset_all_p() adds 'P' to the existing switches, versus saving sim_switches and ONLY setting the 'P' power-up reset switch. Net effect is that the IBM 1130 simulator actually sees the 'G' flag that inhibits the GUI during the console device reset.

  • Ibm1130/ibm1130_cr.c

    • Fix printf() warnings (format should be long, not int)
    • Signed/unsigned mismatch, size_t for array indexing
    • Comment out the unused trim() function.
  • Ibm1130/ibm1130_cpu.c, ibm1130_gui.c: Remove undefined static functions.

@bscottm
Copy link
Contributor Author

bscottm commented Mar 14, 2024

@pkoning2: First of three IBM 1130 PRs. This isn't an urgent PR, but it does solve the occasional Windows builder test failures. Hat tip to Brian Knittel for the -g flag suggestion.

#2 patch set: Defensive code that ensures the GUI grabs all of its resource before entering the message loop, permits the Pump() thread to exit the message loop cleanly (the Pump() thread only gets prejudiciously terminated after a timeout.)

#3 patch set: Add the IBM 1130 utilities to the CMake build.

@pkoning2
Copy link
Member

Does the generator.py change depend on the changes in the earlier PR #358 ?

@bscottm
Copy link
Contributor Author

bscottm commented Mar 15, 2024

Does the generator.py change depend on the changes in the earlier PR #358 ?

I don't think so, but I'll check it out. If so, I'll revise PR #358 accordingly.

- Add the missing ibm1130.rc GUI resource file to the Windows build so
  that the GUI renders correctly.

- Set the add_simulator TEST_ARGS  to "-g" to fix an edge case Heisenbug
  encountered during Github CI/CD tests where ibm1130 appears to hang
  indefinitely on the Windows runners.

  The cause is the GUI's Pump() thread function being prematurely
  terminated before all GUI resources are acquired. The net result is an
  infinite loop in the MS C runtime trying to exit the process with
  unstable internal state. (Separate patch: synchronization across main
  and Pump() threads to ensure resource acquisition completes.)

  This issue never shows (cannot show) up on non-Windows platforms or
  the SIMH makefile.

- Ibm1130/ibm1130_cr.c

  - Fix printf() warnings (format should be long, not int)
  - Signed/unsigned mismatch, size_t for array indexing
  - Comment out the unused trim() function.

- Ibm1130/ibm1130_cpu.c, ibm1130_gui.c: Remove undefined static functions.
@bscottm
Copy link
Contributor Author

bscottm commented Mar 16, 2024

@pkoning2: Revised the two PRs to make them more independent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants