This bug report was generated by Codex on Perry Metzger's codebase.
Summary
In scp.c, SCP expression evaluation can parse the wrong string after
_sim_get_env_special() returns a value.
The failure occurs when:
- the expression element is not a register name
- _sim_get_env_special() finds a numeric value
- the returned pointer is not the local string buffer passed by
the caller, but some other backing storage, such as a host
environment string
In that case, sim_eval_expression() incorrectly parses string instead of
the pointer returned by _sim_get_env_special().
User-visible effect
A numeric expression that refers to a host environment variable can evaluate
incorrectly.
Example:
SIMH_TEST_EXPR_VALUE=41
expression: SIMH_TEST_EXPR_VALUE + 1
expected: 42
actual: 1
The + 1 still works, but the left-hand variable is parsed from the wrong
buffer, so it contributes 0.
Symptom
After one regex match with more capture groups, a later regex match with
fewer groups could leave stale _EXPECT_MATCH_GROUP_n values behind from
the earlier match.
Example:
1) A first match exports:
- _EXPECT_MATCH_GROUP_0=ab42
- _EXPECT_MATCH_GROUP_1=4
- _EXPECT_MATCH_GROUP_2=2
2) A later match with only one subgroup exports:
- _EXPECT_MATCH_GROUP_0=cd7
- _EXPECT_MATCH_GROUP_1=7
3) _EXPECT_MATCH_GROUP_2 incorrectly remained "2" instead of
being cleared or blanked.
Cause
sim_exp_check() tracked the prior regex state in a static
sim_exp_match_sub_count, but it updated that count incorrectly after a
successful match.
It stored the wrong bound for later cleanup, so the loop that blanked
stale _EXPECT_MATCH_GROUP_n entries did not run far enough.
- Enhance file name extension matching logic to allow for file names
that are enclosed in quotes ('' or "").
- Normalize exported environment variables that describe the Git
Commit Id.
- Minor update to help for the ZAPTYPE command.
- Some versions of Omni OS no longer include sys/filio.h in sys/ioctl.h
- Add more robust support for locating OS tools in scp.c
- SHOW VERSION output displays SunOS host system specific info
Fix#1238
SIMH SHOW VERSION output displays as much potentially useful information
about both the currently running simulator and the host platform it is running
on. On Windows host systems, some of this information has been gathered
from the output of the WMIC command which is deprecated and is already
being removed from new and future systems.
This change leverages WMIC when it is available, and attempts to gather the
interesting information from elsewhere when it is not.
As reported in #1227
This problem was a latent bug introduced when summarized array register
output was added back in 2013 or 2018.
This fixes the problem reported in https://github.com/open-simh/simh/issues/499
Avoid the potential by properly leveraging the range that the
recursive mutex which already properly serializes separate activities
to the debug log file.
- Add HELP language for SET CONSOLE DBGSIGNAL|NODBGSIGNAL.
- Remove obsolete sim_os_poll_kbd_ready platform specific routines
which were only used with the never functional asynchronous TMXR
code which has been otherwise removed everywhere else.
- Cleanup DBGSIGNAL related code comments
-
Removed previously added DEPOSIT ALL 0 in precalibrate routine.
That DEPOSIT was added to explicitly restore memory to 0's at simulator
startup, but the several second cost of executing that slowed down
startup of any simulator which had precalibration support. Anyone who
explicitly cares to have zeroed memory on startup should include such a
command in their own simulator configuration.
Allow: n execute n instructions/cycles per second
nK execute n thousand instructions/cycles per second
nM execute n million instructions/cycles per second
n% occupy x percent of the host CPU capacity
n/t sleep for t milliseconds after executing x
instructions/cycles
n{K|M}/t sleep for t milliseconds after executing x
thousand or million instructions/cycles
1 - Summarize repeated memory contents so that the memory range with a
given value only emits 2 lines of output
2 - Allow ^C (SIGINT) to potentially abort long running EXAMINE output
- Make sure that asynchronous mode can't be changed if devices using
sim_ether are already attached.
- Add missing DEV_ETHER type flag for the only sim_ether using device
that didn't already have it.