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

Debugging the int-clock device is incompatible with the -t debug flag #1107

Open
sethm opened this issue Jan 3, 2022 · 3 comments
Open

Debugging the int-clock device is incompatible with the -t debug flag #1107

sethm opened this issue Jan 3, 2022 · 3 comments

Comments

@sethm
Copy link
Contributor

sethm commented Jan 3, 2022

  • Context

Attempting to debug the int-clock device if the -t debug flag is used causes a stack overflow and a crash in all SIMH simulators.

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

MicroVAX 3900 simulator V4.0-0 Current
    Simulator Framework Capabilities:
        64b data
        64b addresses
        Threaded Ethernet Packet transports:PCAP:TAP:VDE:NAT:UDP
        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 9.3.0
        Simulator Compiled as C arch: x64 (Release Build) on Jan  3 2022 at 06:21:22
        Build Tool: simh-makefile
        Memory Access: Little Endian
        Memory Pointer Size: 64 bits
        Large File (>2GB) support
        SDL Video support: SDL Version 2.0.10, 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
        Ethernet packet info: libpcap version 1.9.1 (with TPACKET_V3)
        OS: Linux motherbrain 5.4.0-91-generic #102-Ubuntu SMP Fri Nov 5 16:31:28 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
        tar tool: tar (GNU tar) 1.30
        curl tool: curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
        git commit id: 0c7bf366
        git commit time: 2021-12-27T15:09:20-0800
  • how you built the simulator or that you're using prebuilt binaries

The simulator was built from current simh master branch at HEAD.

$ make vax
lib paths are: /lib/ /lib/i386-linux-gnu/ /lib/x86_64-linux-gnu/ /lib32/ /usr/lib/x86_64-linux-gnu/libfakeroot/ /usr/local/lib/ /usr/local/lib/x86_64-linux-gnu/ /usr/lib/
include paths are:  /usr/lib/gcc/x86_64-linux-gnu/9/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
using libpcap: /usr/include/pcap.h
using libvdeplug: /lib/libvdeplug.so /usr/include/libvdeplug.h
***
*** vax Simulator being built with:
*** - compiler optimizations and no debugging support. GCC Version: 9.3.0.
*** - dynamic networking support using Linux provided libpcap components.
*** - Local LAN packet transports: PCAP VDE TAP NAT(SLiRP)
*** - video capabilities provided by libSDL2 (Simple Directmedia Layer).
*** - Per simulator tests will be run.
***
*** git commit id is 0c7bf366aed46b14f749ccf3b1b0b7e54bb0bc47.
*** git commit time is 2021-12-27T15:09:20-0800.
***
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=0c7bf366aed46b14f749ccf3b1b0b7e54bb0bc47 -DSIM_GIT_COMMIT_TIME=2021-12-27T15:09:20-0800  -DSIM_COMPILER="GCC Version: 9.3.0" -DSIM_BUILD_TOOL=simh-makefile -I . -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  ./VAX/vax_cpu.c ./VAX/vax_cpu1.c ./VAX/vax_fpa.c ./VAX/vax_io.c ./VAX/vax_cis.c ./VAX/vax_octa.c  ./VAX/vax_cmode.c ./VAX/vax_mmu.c ./VAX/vax_stddev.c ./VAX/vax_sysdev.c ./VAX/vax_sys.c  ./VAX/vax_syscm.c ./VAX/vax_syslist.c ./VAX/vax_vc.c ./VAX/vax_lk.c ./VAX/vax_vs.c ./VAX/vax_2681.c ./PDP11/pdp11_rl.c ./PDP11/pdp11_rq.c ./PDP11/pdp11_ts.c ./PDP11/pdp11_dz.c ./PDP11/pdp11_lp.c ./PDP11/pdp11_tq.c ./PDP11/pdp11_xq.c ./PDP11/pdp11_vh.c ./PDP11/pdp11_cr.c ./PDP11/pdp11_td.c ./PDP11/pdp11_io_lib.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 -DVM_VAX -DUSE_INT64 -DUSE_ADDR64 -DUSE_SIM_VIDEO -I ./VAX -I ./PDP11 -DHAVE_PCAP_NETWORK -I/usr/include/ -DBPF_CONST_STRING -DUSE_SHARED -DHAVE_VDE_NETWORK -DHAVE_TAP_NETWORK -Islirp -Islirp_glue -Islirp_glue/qemu -DHAVE_SLIRP_NETWORK -DUSE_SIMH_SLIRP_DEBUG slirp/*.c slirp_glue/*.c -DHAVE_LIBSDL -DUSE_SIM_VIDEO `/usr/bin/sdl2-config --cflags` `/usr/bin/sdl2-config --libs` -o BIN/vax -lm -lrt -lpthread -lpcre -ldl -lpng -lz -lvdeplug -Wl,-R,/lib/ -L/lib/ 
cp BIN/vax BIN/microvax3900
BIN/vax RegisterSanityCheck /home/seth/Projects/simh/VAX/tests/vax-diag_test.ini </dev/null 
 Running internal register sanity checks on MicroVAX 3900 simulator.
*** Good Registers in MicroVAX 3900 simulator.

MicroVAX 3900 simulator V4.0-0 Current        git commit id: 0c7bf366
Running Hardware Core Test (EHKAA)

*** PASSED - MicroVAX 3900 Hardware Core Instruction test EHKAA
  • the simulator configuration file (or commands) which were used when the problem occurred.

Reproduction is simple. In any simulator (not just vax):

sim> set int-clock debug
sim> set debug -t debug.log
Debug output to "debug.log"
   Debug messages display time of day as hh:mm:ss.msec
sim> show int-clock
Segmentation fault (core dumped)

The problem appears to be a recursive call to sim_rtcn_get_time inside sim_debug_prefix().

@markpizz
Copy link
Member

markpizz commented Jan 8, 2022

This is indeed a problem.

I'm guessing that you only ran into it due to trying to research the problem you described in #1108 which is now fixed. Otherwise it isn't affecting you, right?

@sethm
Copy link
Contributor Author

sethm commented Jan 8, 2022

I'm guessing that you only ran into it due to trying to research the problem you described in #1108 which is now fixed. Otherwise it isn't affecting you, right?

That's correct. I don't think this is a very serious issue at all, I just wanted to make sure it was known about in case it's an easy fix.

@markpizz
Copy link
Member

markpizz commented Jan 8, 2022

The change that introduced sim_rtcn_get_time was only partially implemented. It was inspired by reports that folks trying to record precise simulator session logs for consistency validation were complaining that behavior was not 100% consistent from one run to the next. These differences were due to timing issues that happened differently depending on variations in host system loading. I was thinking about implementing an "uncalibrated" mode for cases like this so that clock ticks would always take precisely the same number of instruction execution and polling for input would always happen at precisely identical instruction counts. This mode would: not keep simulated wall clock time aligned with real wall clock time and would not work consistently if any network activity was part of things and would not work consistently if manual user input (via TMXR sessions) was part of what was going on. Those constraints are probably OK for automated validation script execution.

Since things are working now, I'd like to get this uncalibrated mode implemented completely along with fixing the problem you've reported here.

markpizz added a commit that referenced this issue Jul 19, 2022
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