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

imlac crashes during :imprint on ITS #216

Closed
bilegeek opened this issue Apr 13, 2023 · 7 comments
Closed

imlac crashes during :imprint on ITS #216

bilegeek opened this issue Apr 13, 2023 · 7 comments
Assignees

Comments

@bilegeek
Copy link

bilegeek commented Apr 13, 2023

  • Context

I recently started using https://github.com/PDP-10/its. After building the KA10 AI machine, logging in and trying out some pics, I discovered that the Imlac emulator crashes drawing some pics.

This is a bit long-winded, since reproducing the error requires building the ITS simulator and navigating the OS, so I've just listed some step-by-step stuff. I'm also running Linux. Please excuse how convoluted it is.

The ITS repo actually clones this repo and builds the imlac emulator as part of making the entire simulator, but I decided to manually clone and build it from here.

  • Building ITS: (instructions in project, but condensed version is...)

make sure dependencies are installed (git, c compiler, make, expect, curses, autoconf, sdl2, sdl2-image, sdl2-net, gtk3)

git clone https://github.com/PDP-10/its/
cd its
make EMULATOR=pdp10-ka

Takes awhile to build. Like 3-4 hours in my case. Mainly because the simulator is ALSO building ITS from source. So it's slow.

Once it finishes,
./start
(Wait until it shows DSKDMP)
its (press enter, then escape-G, wait a bit, then ctrl-Z)

  • Normally we would type "./start simh_imlac", but the Imlac crashes without any way to restart. So I decided to manually clone this repo and compile the emulator, copy the binary into the appropriate spot, and go from there. I'm using branch
    7be9f2f of this repo.

git clone https://github.com/open-simh/simh/
cd simh
make imlac

  • Replace the Imlac binary already in your its/tools/sim-h/BIN/

  • From a second terminal, in the "its" directory, run ./tools/sim-h/BIN/./imlac ./build/pdp10-ka/imlac.simh

  • It'll bring up the emulator. Within the emulator:

(press ctrl-Z; should say "Happy hacking!")
:login turist
:cwd -pics-
(ctrl-F to list directory, ctrl-L to clear screen)
:imprint 10 pic

  • Replace "10 pic" with "3d pic", "trek pic" or other files.

  • In my case, "10 pic", "zeplin pic", and some others work fine, so I'll just show the errors:

:imprint 3d pic

  • Imlac crashes with the prompt "HALT instruction, PC: 00001 (JMP @351)"

:imprint trek pic

  • Imlac crashes with the prompt "HALT instruction, PC: 00013 (HLT )"

When the imlac crashes and you restart it with ./tools/sim-h/BIN/./imlac ./build/pdp10-ka/imlac.simh, you'll already be logged in.

When you're done,
:logout on the Imlac
then :lock, 5down, y, and ctrl-C on the ITS emulator console terminal.

  • the output of "sim> SHOW VERSION" while running the simulator which is having the issue

sim> SHOW VERSION
Imlac simulator Open SIMH V4.1-0 Current
Simulator Framework Capabilities:
32b data
32b addresses
no Ethernet
Idle/Throttling support is available
Virtual Hard Disk (VHD) support
RAW disk and CD/DVD ROM support
Asynchronous I/O support (Lock free asynchronous event queue)
Asynchronous Clock support
FrontPanel API Version 12
Host Platform:
Compiler: GCC 10.2.1 20210110
Simulator Compiled as C arch: x64 (Release Build) on Apr 12 2023 at 23:20:24
Build Tool: simh-makefile
Memory Access: Little Endian
Memory Pointer Size: 64 bits
Large File (>2GB) support
SDL Video support: SDL Version 2.0.14, PNG Version 1.6.37, zlib: 1.2.11
PCRE RegEx (Version 8.39 2016-06-14) support for EXPECT commands
OS clock resolution: 1ms
Time taken by msleep(1): 1ms
OS: Linux reliable 5.10.0-21-amd64 #1 SMP Debian 5.10.162-1 (2023-01-21) x86_64 GNU/Linux
Processor Name: AMD FX(tm)-8350 Eight-Core Processor
tar tool: tar (GNU tar) 1.34
curl tool: curl 7.74.0 (x86_64-pc-linux-gnu) libcurl/7.74.0 OpenSSL/1.1.1n zlib/1.2.11 brotli/1.0.9 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.3.0) libssh2/1.9.0 nghttp2/1.43.0 librtmp/2.3
git commit id: 7be9f2f
git commit time: 2023-04-09T10:36:40-0700

  • how you built the simulator or that you're using prebuilt binaries

Make output:

lib paths are: /lib/ /lib/i386-linux-gnu/ /lib/i386-linux-gnu/i686/sse2/ /lib/i386-linux-gnu/sse2/ /lib/x86_64-linux-gnu/ /lib32/ /libx32/ /usr/lib/x86_64-linux-gnu/libfakeroot/ /usr/lib/
include paths are: /usr/lib/gcc/x86_64-linux-gnu/10/include /usr/local/include /usr/include/x86_64-linux-gnu /usr/include
using libm: /lib/x86_64-linux-gnu/libm.so
using librt: /lib/x86_64-linux-gnu/librt.so
using libpthread: /lib/x86_64-linux-gnu/libpthread.so /usr/include/pthread.h
using libpcre: /lib/x86_64-linux-gnu/libpcre.so /usr/include/pcre.h
using semaphore: /usr/include/semaphore.h
using libdl: /lib/x86_64-linux-gnu/libdl.so /usr/include/dlfcn.h
using libpng: /lib/x86_64-linux-gnu/libpng.so /usr/include/png.h
using zlib: /lib/x86_64-linux-gnu/libz.so /usr/include/zlib.h
using mman: /usr/include/x86_64-linux-gnu/sys/mman.h
using libSDL2: /usr/include/SDL2/SDL.h
*** No SDL ttf support available. BESM-6 video panel disabled.


*** Info *** Install the development components of libSDL2-ttf
*** Info *** packaged for your Linux operating system distribution:
*** Info *** $ sudo apt-get install libsdl2-ttf-dev


*** imlac Simulator being built with:
*** - compiler optimizations and no debugging support. GCC Version: 10.2.1.
*** - video capabilities provided by libSDL2 (Simple Directmedia Layer).
*** - Per simulator tests will be run.


*** git commit id is 7be9f2f.
*** git commit time is 2023-04-09T10:36:40-0700.


gcc -std=gnu99 -U__STRICT_ANSI__ -O2 -finline-functions -fgcse-after-reload -fpredictive-commoning -fipa-cp-clone -fno-unsafe-loop-optimizations -fno-strict-overflow -DSIM_GIT_COMMIT_ID=7be9f2f3e86ebd05daff7697c0758f71dc8c27d3 -DSIM_GIT_COMMIT_TIME=2023-04-09T10:36:40-0700 -DSIM_COMPILER="GCC Version: 10.2.1" -DSIM_BUILD_TOOL=simh-makefile -I . -Werror -D_GNU_SOURCE -DUSE_READER_THREAD -DSIM_ASYNCH_IO -DHAVE_PCRE_H -DHAVE_SEMAPHORE -DHAVE_SYS_IOCTL -DHAVE_LINUX_CDROM -DSIM_HAVE_DLOPEN=so -DHAVE_UTIME -DHAVE_LIBPNG -DHAVE_ZLIB -DHAVE_GLOB -DHAVE_SHM_OPEN ./imlac/imlac_sys.c ./imlac/imlac_cpu.c ./imlac/imlac_dp.c ./imlac/imlac_crt.c ./imlac/imlac_kbd.c ./imlac/imlac_tty.c ./imlac/imlac_pt.c ./imlac/imlac_bel.c ./display/display.c ./display/sim_ws.c ./scp.c ./sim_console.c ./sim_fio.c ./sim_timer.c ./sim_sock.c ./sim_tmxr.c ./sim_ether.c ./sim_tape.c ./sim_disk.c ./sim_serial.c ./sim_video.c ./sim_imd.c ./sim_card.c -I ./imlac -DUSE_DISPLAY -DHAVE_LIBSDL -DUSE_SIM_VIDEO sdl2-config --cflags sdl2-config --libs -o BIN/imlac -lm -lrt -lpthread -lpcre -ldl -lpng -lz
BIN/imlac RegisterSanityCheck </dev/null
Running internal register sanity checks on Imlac simulator.
*** Good Registers in Imlac simulator.

  • the simulator configuration file (or commands) which were used when the problem occurred.

  • the expected behavior and the actual behavior

  • you may also need to provide specific pointers to data files that may be necessary to demonstrate the problem

@larsbrinkhoff
Copy link
Contributor

Please assign this to me.

@larsbrinkhoff
Copy link
Contributor

At a first glance, this seems to be a bug in the Imlac software, not the emulator. The crash happens when an interrupt is handled. The interrupt handler is at location 1 in memory. The code there has been clobbered due to a buffer wrapping around the top of memory to low memory. Maybe the input file (I used 3D PIC) is too large to fit in the buffer used to hold the display list, and the program doesn't check the upper bound.

@bilegeek
Copy link
Author

bilegeek commented Apr 29, 2023

Some observations:

I've just tested every file in -pics- sorted by filesize (aside from "pics xfile" and "-read- -this-", as they're just regular text), and it seems more complicated than that. For instance, "numbur pic" crashes, but the larger file "girl pic" doesn't.

List of the files that crashed on me: numbur pic, a plot, pyram pic, world pic, 3d pic, mit1 pic, trek pic, kana pic, phx pic

The ellips, dragon and chain pics all work, and they're sandwiched between 3d and mit1. Wumpus doesn't crash, but does glitch out after a brief second of drawing correctly.

Every crash, same error: "HALT instruction, PC: 00013 (HLT )" (odd, 3d pic gave me the location 1 error last time)

"[pic] 42" is interesting: it locks - but doesn't seem to crash - the imlac after drawing a cube, but when I restart the imlac and Ctrl-F, it draws a spiral torus.

Every other file aside from those listed as crashy seem to work fine.

@larsbrinkhoff
Copy link
Contributor

Thanks for checking! I'm not sure my initial impression is the right one; I'll have to check further. I think making some test cases that probe the boundaries will be enlightening.

@larsbrinkhoff
Copy link
Contributor

I just tested @jdersch's sImlac, and viewing 3D PIC behaves the same - crashing in the same place, as far as I can see. So I'm leaning towards believing the emulator works as intended, and the problem is in the SSV software. But I would still like to do some tests to see the exact cause, so let's keep this open for now.

@larsbrinkhoff
Copy link
Contributor

larsbrinkhoff commented Apr 29, 2023

More information. I truncated the 3D PIC file to the first 5000 characters. The truncated file prints fine. but the display says CBUF=25. Pressing space reduces the CBUF number. When it reaches 0, the crash happens.

Moreover, from what I can read in the code, it's trying to free upp buffer space by scrolling ten lines. The problem in this case is that there is just one super long file. This case is not anticipated, so it fails.

@larsbrinkhoff
Copy link
Contributor

So far there is no evidence of any bug in the emulator, so I think this issue can be closed.

@bilegeek bilegeek closed this as completed May 3, 2023
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

No branches or pull requests

2 participants