Open oilcan-productions opened 5 months ago
When I go and step through the mark.tcl script manually by running ./kn10-ks-its ../mchn/DB/nsalv.ini
from the build/klh10
directory.
I get this error on the first question. Which seems to be the same fault during make it is just not bubbled up.
Format pack on unit #0zsh: segmentation fault sudo ./kn10-ks-its ../mchn/DB/nsalv.ini
@eswenson1, are you running KLH10 on a Mac? If so, anything to add here with regards to your success or lack thereof?
I'm not currently. Let me try to build and run.
Update: I did just try to do a make clean EMULATOR=klh10 && make EMULATOR=klh10 download
and while KLH10 built, the download
target resulted in this:
...
ln -s build/klh10/start
mkdir -p out/klh10/stamp
sed -e 's/%IP%/192.168.1.100/' \
-e 's/%GW%/192.168.0.45/' < build/mchn/DB/dskdmp.txt > out/klh10/dskdmp.ini
mkdir -p out/klh10/stamp
touch out/klh10/stamp/pdp10
wget http://hactrn.kostersitz.com/images/klh10.tgz
--2024-02-16 08:22:32-- http://hactrn.kostersitz.com/images/klh10.tgz
Resolving hactrn.kostersitz.com (hactrn.kostersitz.com)... 31.22.4.235
Connecting to hactrn.kostersitz.com (hactrn.kostersitz.com)|31.22.4.235|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 141598464 (135M) [application/x-tar]
Saving to: ‘klh10.tgz’
klh10.tgz 100%[==========================================================>] 135.04M 4.33MB/s in 34s
2024-02-16 08:23:07 (3.99 MB/s) - ‘klh10.tgz’ saved [141598464/141598464]
tar xzf klh10.tgz
klh10/output.tape: truncated gzip input
tar: Error exit delayed from previous errors.
make: *** [download] Error 1
I tried repeatedly downloading klh10.tgz from hactrn.kostersitz.com, and each time, while the download appears to work perfectly fine, the .tgz has errors extracting. Perhaps it was not properly uploaded the last time?
I'll try a full build, which, of course, is needed to test out this ticket. I was just curious to try the download
thing since I haven't ever before.
I'm failing in the same way as previously described:
ENTERING MAIN BUILD SCRIPT
Fri Feb 16 08:29:08 PST 2024
BUILDING DB ITS
ENTERING BUILD SCRIPT: MARK
Fri Feb 16 08:29:08 PST 2024
spawn ./kn10-ks-its ../mchn/DB/nsalv.ini
KLH10 2.0l (MyITS) built Feb 16 2024 08:22:27
Copyright © 2002 Kenneth L. Harrenstien -- All Rights Reserved.
This program comes "AS IS" with ABSOLUTELY NO WARRANTY.
Compiled for apple-darwin23.2.0 on arm with word model USEINT
Emulated config:
CPU: KS10 SYS: ITS Pager: ITS APRID: 4097
Memory: 512 pages of 1024 words (SHARED)
Time interval: INTRP Base: OSGET Quantums: OSVIRT
Interval default: 60Hz
Internal clock: OSINT
Other: CIRC JPC DEBUG PCCACHE CTYINT IMPINT EVHINT
Devices: RH11 RPXX(DP) TM03 DZ11 CH11 LHDH(DPIMP)
[MEM: Allocating 512 pages shared memory, clearing...done]
KLH10# ; Define basic KS10 device config - two RH11s each on its own Unibus
KLH10#
KLH10# devdef rh0 ub1 rh11 addr=776700 br=6 vec=254
KLH10# devdef rh1 ub3 rh11 addr=772440 br=6 vec=224
KLH10#
KLH10# ; Provide one disk, one tape in config ITS expects
KLH10#
KLH10# devdef dsk0 rh0.0 rp type=rp06 format=dbd9 path=../../out/klh10/rp0.dsk iodly=0
[dp_init: shmget failed - 12]
RPXX subproc init failed!
Final init of device "dsk0" failed!
KLH10# devdef mta0 rh1.0 tm02 fmtr=tm03 type=tu45
KLH10# devdef mta1 rh1.1 tm02 fmtr=tm03 type=tu45
KLH10# devmo mta0 ../../out/klh10/minsys.tape
Mount succeeded.
KLH10# devmo mta1 ../../out/klh10/salv.tape
Mount succeeded.
KLH10#
KLH10# ; ITS wants a 60Hz clock, allow it. Need this until defaults OK.
KLH10# set clk_ithzfix=60
clk_ithzfix: 60. => 60.
KLH10#
KLH10# ; Define IMP for PI on ITS.JOSS.COM
KLH10# devdef imp ub3 lhdh addr=767600 br=6 vec=250 ipaddr=199.34.53.51 gwaddr=199.34.53.50
IMP assuming "pcap" interface method since "gwaddr" parameter given
[dp_init: shmget failed - 12]
IMP subproc init failed!
Final init of device "imp" failed!
KLH10#
KLH10# ; Dummy definitions. Only one DZ is still (apparently) needed.
KLH10# devdef dz0 ub3 dz11 addr=760010 br=5 vec=340
KLH10# ;devdef dz1 ub3 dz11 addr=760020 br=5 vec=350
KLH10# ;devdef chaos ub3 ch11 addr=764140 br=5 vec=270
KLH10#
KLH10# ; Define new HOST device hackery
KLH10# ;devdef idler ub3 host addr=777000
KLH10#
KLH10# load @.nsalv-260-u
Using word format "u36"...
Added 2914 syms to DDT, total 2974
Loaded "@.nsalv-260-u":
Format: ITS-SBLK
Data: 9830, Symwds: 2914, Low: 0, High: 0777266, Startaddress: 0774000
KLH10# [EOF on ../mchn/DB/nsalv.ini]
KLH10# go
Starting KN10 at loc 0774000...
MARK$G'
Format pack on unit #0send: spawn id exp7 not open
while executing
"send -- $c"
(procedure "type" line 4)
invoked from within
"type $r"
(procedure "respond" line 3)
invoked from within
"respond "Are you sure you want to format pack on drive" "y""
(procedure "mark_pack" line 5)
invoked from within
"mark_pack "0" "0" "foobar""
(procedure "mark_bootstrap_packs" line 2)
invoked from within
"mark_bootstrap_packs"
(file "/Users/eswenson/ITS/ws/its/build/mark.tcl" line 5)
invoked from within
"source $build/mark.tcl"
(file "../build.tcl" line 167)
invoked from within
"source ../build.tcl"
(file "build/klh10/build.tcl" line 71)
make: *** [out/klh10/rp0.dsk] Error 1
➜ its git:(master) ✗
I manually tried to start KLH10 (in the right directory with the right command-line parameters), and got this:
KLH10# load @.ddt-u
Using word format "u36"...
Added 1610 syms to DDT, total 1670
Loaded "@.ddt-u":
Format: ITS-SBLK
Data: 1947, Symwds: 1617, Low: 0772702, High: 0777266, Startaddress: 0774000
Assembled by ALAN on 1989-05-31 05:00:25 from file "AI:SYSTEM;DDT 68"
KLH10# load dskdmp.216bin
Using word format "u36"...
Added 1272 syms to DDT, total 2942
Loaded "dskdmp.216bin":
Format: ITS-SBLK
Data: 954, Symwds: 1279, Low: 04000, High: 07774, Startaddress: 04000
Assembled by KLH on 1992-07-20 04:70:12 from file "NX:SYSTEM;DSKDMP 216"
KLH10# [EOF on ../../out/klh10/dskdmp.ini]
KLH10# go
Starting KN10 at loc 04000...
It hung at this point. So either there is something wrong with the files loaded into KLH10 (e.g. dskdmp.216bin or @.ddt-u), which I doubt, or the built KLH10 doesn't work any more when built on mac. I'll see if I can find an old klh10 I've built and run to see if it does better.
When I start my full build manually with this ./kn10-ks-its ../mchn/DB/nsalv.ini
it starts up fine but then crashes when I type the 0 at the format pack #
prompt. It looks like yours started at loc 04000 whereas mine starts at 0774000
Is it normal to get this error on startup of kn10-ks-its? I don't recall seeing it before.
KLH10 2.0l (MyITS) built Feb 16 2024 08:22:27
Copyright � 2002 Kenneth L. Harrenstien -- All Rights Reserved.
This program comes "AS IS" with ABSOLUTELY NO WARRANTY.
Compiled for apple-darwin23.2.0 on arm with word model USEINT
Emulated config:
CPU: KS10 SYS: ITS Pager: ITS APRID: 4097
Memory: 512 pages of 1024 words (SHARED)
Time interval: INTRP Base: OSGET Quantums: OSVIRT
Interval default: 60Hz
Internal clock: OSINT
Other: CIRC JPC DEBUG PCCACHE CTYINT IMPINT EVHINT
Devices: RH11 RPXX(DP) TM03 DZ11 CH11 LHDH(DPIMP)
[MEM: Allocating 512 pages [os_mmcreate: shmget failed for 4194304 bytes - Cannot allocate memory]
private memory, clearing...done]
KLH10# quit
I wonder if this is the cause?
I'm getting the same issue as you are:
➜ klh10 git:(master) ✗ ./kn10-ks-its ../mchn/DB/nsalv.ini
KLH10 2.0l (MyITS) built Feb 16 2024 08:22:27
Copyright � 2002 Kenneth L. Harrenstien -- All Rights Reserved.
This program comes "AS IS" with ABSOLUTELY NO WARRANTY.
Compiled for apple-darwin23.2.0 on arm with word model USEINT
Emulated config:
CPU: KS10 SYS: ITS Pager: ITS APRID: 4097
Memory: 512 pages of 1024 words (SHARED)
Time interval: INTRP Base: OSGET Quantums: OSVIRT
Interval default: 60Hz
Internal clock: OSINT
Other: CIRC JPC DEBUG PCCACHE CTYINT IMPINT EVHINT
Devices: RH11 RPXX(DP) TM03 DZ11 CH11 LHDH(DPIMP)
[MEM: Allocating 512 pages [os_mmcreate: shmget failed for 4194304 bytes - Cannot allocate memory]
private memory, clearing...done]
KLH10# ; Define basic KS10 device config - two RH11s each on its own Unibus
KLH10#
KLH10# devdef rh0 ub1 rh11 addr=776700 br=6 vec=254
KLH10# devdef rh1 ub3 rh11 addr=772440 br=6 vec=224
KLH10#
KLH10# ; Provide one disk, one tape in config ITS expects
KLH10#
KLH10# devdef dsk0 rh0.0 rp type=rp06 format=dbd9 path=../../out/klh10/rp0.dsk iodly=0
[dp_init: shmget failed - 12]
RPXX subproc init failed!
Final init of device "dsk0" failed!
KLH10# devdef mta0 rh1.0 tm02 fmtr=tm03 type=tu45
KLH10# devdef mta1 rh1.1 tm02 fmtr=tm03 type=tu45
KLH10# devmo mta0 ../../out/klh10/minsys.tape
Mount succeeded.
KLH10# devmo mta1 ../../out/klh10/salv.tape
Mount succeeded.
KLH10#
KLH10# ; ITS wants a 60Hz clock, allow it. Need this until defaults OK.
KLH10# set clk_ithzfix=60
clk_ithzfix: 60. => 60.
KLH10#
KLH10# ; Define IMP for PI on ITS.JOSS.COM
KLH10# devdef imp ub3 lhdh addr=767600 br=6 vec=250 ipaddr=199.34.53.51 gwaddr=199.34.53.50
IMP assuming "pcap" interface method since "gwaddr" parameter given
[dp_init: shmget failed - 12]
IMP subproc init failed!
Final init of device "imp" failed!
KLH10#
KLH10# ; Dummy definitions. Only one DZ is still (apparently) needed.
KLH10# devdef dz0 ub3 dz11 addr=760010 br=5 vec=340
KLH10# ;devdef dz1 ub3 dz11 addr=760020 br=5 vec=350
KLH10# ;devdef chaos ub3 ch11 addr=764140 br=5 vec=270
KLH10#
KLH10# ; Define new HOST device hackery
KLH10# ;devdef idler ub3 host addr=777000
KLH10#
KLH10# load @.nsalv-260-u
Using word format "u36"...
Added 2914 syms to DDT, total 2974
Loaded "@.nsalv-260-u":
Format: ITS-SBLK
Data: 9830, Symwds: 2914, Low: 0, High: 0777266, Startaddress: 0774000
KLH10# [EOF on ../mchn/DB/nsalv.ini]
KLH10# go
Starting KN10 at loc 0774000...
FOO$J? MARK$G'
Format pack on unit #0[1] 61311 segmentation fault ./kn10-ks-its ../mchn/DB/nsalv.ini
%
➜ klh10 git:(master) ✗
I suspect the inability to allocate memory (first error message on kn10-ks-its startup) is the cause.
I guess that would be a problem.
I am wondering if this has to do with the new memory protection features in MacOS. For example I had to codesign gdb to actually use it to get it to run and start debugging
I dunno. I had to codesign gdb way before this problem started happening.
Found this in the klh10 install.txt
KERNEL CONFIGURATION
====================
Installation on most UNIX platforms is straightforward except
for two special requirements of the KLH10 emulator, which sometimes
require kernel reconfiguration.
[A] Shared memory; MANDATORY if running any device sub-processes.
The so-called SYSV "shm" system calls must be available, and
ideally should allow shared segments of up to 32MB for a KL10,
4MB for a KS10. The configuration examples below assume a KL10
since it doesn't hurt even if a KS10 is all you will ever run.
If this support is lacking, you will get a warning similar to
the following:
[os_mmcreate: shmget failed for 33554432 bytes - Invalid argument]
which is not necessarily fatal, but less efficient.
maybe this is a red herring?
The code for this lives in ./tools/klh10/src/osdsup.c
line 1633 in mine.
From where it calls it in '/Users/mikek/its-klh/tools/klh10/src/klh10.c'
the process tries shared memory first and then moves on the private memory if that fails.
the message seems like a red herring as it is deemed a warning that no shared memory is available.
Maybe I'll update the message text to say WARNING :)
For some reason, I cannot run my old version of kn10-ks-its under gdb. So I'm unable to debug. I get this:
gdb ./kn10-ks-its
GNU gdb (GDB) 14.1
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin22.6.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./kn10-ks-its...
(gdb) run nsalv.ini
Starting program: /Users/eswenson/its/ws/its/build/klh10/kn10-ks-its nsalv.ini
[New Thread 0x2203 of process 90662]
.
mark^[g
I'm hung after the [New Thread...] message from gdb. I never see any messages from kn10-ks-its. The "mark^[g" was a silly/vain attempt to see if it had started without messages and NSALV was waiting for input (it wasn't).
I wonder if shared memory settings need to get updated. This is what I have:
sysctl -a | grep sysv.shm
kern.sysv.shmmax: 4194304
kern.sysv.shmmin: 1
kern.sysv.shmmni: 32
kern.sysv.shmseg: 8
kern.sysv.shmall: 1024
I increased kern.sysv.shmmax to double that amount and I still get a failure. But the value emitted in the error message is still 4194304. I wonder if I have to reboot the system after changing the value? I thought you could simply do sudo sysctl -w kern.sysv.shmmax=xxxxx
to change the value until the next reboot? When I run sysctl kern.sysv.shmmax
to confirm my setting, I get back:
kern.sysv.shmmax: 8388608
So my change appears to take effect. Not sure why kn10-ks-is asking for 4194304. Can you tell from the code what it wants?
It does look like kn10-ks-its is only wanting 4M, so the 4194304 value is what it is asking for. My "shmmax" value is double that, so the shmget call should succeed. Not sure why it isn't. Googling.....
I found that once it crashes in the terminal window I have to start a new terminal session for the emulator to get to the prompt again. Something in that terminal session gets borked after the crash
Can you use gdb to determine what the error code from the shmget failure is? That might provide a clue.
For me, creating a new shell doesn't fix my inability to run kn10-ks-its under gdb. I never get to see any output from kn10-ks-its after gdb reports that a new thread is created.
I may have to rebuild my kn10-ks-its (good idea anyway). I was able to attach to my kn10-ks-its process from gdb after it was started and see this:
➜ ~ gdb -p 92014
GNU gdb (GDB) 14.1
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin22.6.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
Attaching to process 92014
[New Thread 0x2803 of process 92014]
warning: Error calling thread_get_state for GP registers for thread 0x2803
warning: Mach error at "../../gdb/i386-darwin-nat.c:132" in function "fetch_registers": (os/kern) invalid argument (0x4)
Reading symbols from /Users/eswenson/its/ws/its/build/klh10/kn10-ks-its...
warning: unhandled dyld version (17)
0x0000000109697bcd in ?? ()
(gdb)
I'll rebuild and retry.
the memsiz is calculated in klh10.c memsiz = (size_t)PAG_SIZE * PAG_MAXPHYSPGS * sizeof(w10_t);
this is what I get in gdb
Attaching to process 33823
[New Thread 0x1703 of process 33823]
warning: Error calling thread_get_state for GP registers for thread 0x1703
warning: Mach error at "../../gdb/i386-darwin-nat.c:132" in function "fetch_registers": (os/kern) invalid argument (0x4)
Reading symbols from /Users/mikek/its-klh/build/klh10/kn10-ks-its...
warning: unhandled dyld version (17)
0x00007ff80e490e52 in ?? ()
(gdb) cont
Continuing.
[Inferior 1 (process 33823) exited normally]
(gdb)
Need to do a CONTINUE in GDB after attaching so it takes the input on the emulator side.
Yeah, I did. I got:
(gdb) cont
Continuing.
[Inferior 1 (process 7648) exited normally]
(gdb)
and in the gdb session:
MARK$G'
Format pack on unit #0[1] 7648 segmentation fault ./kn10-ks-its ../mchn/DB/nsalv.ini
So no help.
At least we are both seeing the same.
I do not think it has to do with the amount of memory the emulator tries to allocate I changed it to just try 50% of the allocation. No change in behavior.
What is the error code you’re getting from shmget?
The thing is I am not getting any error from shmget.
Are you getting a null pointer back? What is the value of errno?
Yes it is a null pointer. errno=11
Geez. That’s EAGAIN, or Resource Temporarily Unavailable. Not very helpful. Also I don’t see any hits on this errno with shmget.
It is the last error gdb sees after the emulator exits. I have also tried to set a break point at the function but that crashed gdb :S
The KLH10 code should check for a null pointer and “handle” it somehow (possibly exiting gracefully after getting and displaying ERRNO). What does it do now? Try a regular local alloc? Is it doing that and fumbling the handling? Or is it getting an error from malloc (or whatever) too?
it jumps to a regular malloc which seems to succeed as it is not erroring out and the emulator completes loading. That is why I think the shared memory thing is "just a warning"
/* MEM_INIT - Allocate & initialize PDP10 memory.
** Perhaps move this to pag_init?
*/
static void
mem_init(void)
{
size_t memsiz;
char *ptr;
/* Determine amount of phys mem to get */
memsiz = ((size_t)PAG_SIZE * PAG_MAXPHYSPGS * sizeof(w10_t))/2;
/* Always attempt to get shared memory first. If that fails
** (either because OS can't do it, or KLH10 was compiled without
** support), then go for private memory.
*/
fprintf(stdout, "[MEM: Allocating %ld pages ", (long)PAG_MAXPHYSPGS);
if (os_mmcreate(memsiz, &cpu.mm_physegid, &ptr)) {
cpu.mm_shared = TRUE;
fprintf(stdout, "shared memory, clearing...");
} else {
/* Failed - routine already barfed about it, if OS failure. */
cpu.mm_shared = FALSE;
fprintf(stdout, "shared memory unavailable. Will use private memory instead.");
/* Allocate private KN10 memory */
cpu.mm_physegid = 0;
if (!(ptr = malloc(memsiz))) {
syserr(errno, "MEM: cannot malloc KN10 physical memory!\n");
}
fprintf(stdout, "private memory, clearing...");
}
cpu.physmem = (vmptr_t)ptr;
/* To avoid unpleasant surprises to code that expects unused bits
** of w10_t words to be zero, we clear it all to begin with.
*/
memset(ptr, 0, memsiz); /* Clear it all out */
fprintf(stdout, "done]\n");
}
In that case, why are we getting the segmentation fault? Can you step in gdb from after the successful local memory allocation to see where we reference through a bad pointer?
2024-02-16 08:23:07 (3.99 MB/s) - ‘klh10.tgz’ saved [141598464/141598464]
We should put this file in a different spot, downloading like that will break at some point ...
~/its $ tar tvf ./klh10.tgz
drwxr-xr-x 0 runner docker 0 Feb 12 13:51 klh10/
-rw-r--r-- 0 runner docker 177776640 Feb 12 13:56 klh10/rp0.dsk
-rw-r--r-- 0 runner docker 66780 Feb 12 13:50 klh10/ndskdmp.tape
-rw-r--r-- 0 runner docker 113004 Feb 12 13:50 klh10/nnsalv.tape
-rw-r--r-- 0 runner docker 64212 Feb 12 12:04 klh10/dskdmp.tape
-rw-r--r-- 0 runner docker 6873628 Feb 12 12:07 klh10/reboot.tape
-rw-r--r-- 0 runner docker 799724 Feb 12 12:04 klh10/minsys.tape
-rw-r--r-- 0 runner docker 5014306 Feb 12 12:04 klh10/minsrc.tape
drwxr-xr-x 0 runner docker 0 Feb 12 12:03 klh10/check/
-rw-r--r-- 0 runner docker 0 Feb 12 12:03 klh10/check/src.diff
-rw-r--r-- 0 runner docker 0 Feb 12 12:03 klh10/check/bin.diff
-rw-r--r-- 0 runner docker 534 Feb 12 12:03 klh10/check/doc2
-rw-r--r-- 0 runner docker 534 Feb 12 12:03 klh10/check/doc1
-rw-r--r-- 0 runner docker 0 Feb 12 12:03 klh10/check/doc.diff
-rw-r--r-- 0 runner docker 328 Feb 12 12:03 klh10/check/bin2
-rw-r--r-- 0 runner docker 328 Feb 12 12:03 klh10/check/bin1
-rw-r--r-- 0 runner docker 1069 Feb 12 12:03 klh10/check/src2
-rw-r--r-- 0 runner docker 1069 Feb 12 12:03 klh10/check/src1
drwxr-xr-x 0 runner docker 0 Feb 12 12:04 klh10/system/
-rw-r--r-- 0 runner docker 40515 Feb 12 12:04 klh10/system/config.203
-rw-r--r-- 0 runner docker 1095 Feb 12 12:05 klh10/dskdmp.ini
-rw-r--r-- 0 runner docker 88684464 Feb 12 12:05 klh10/sources.tape
-rw-r--r-- 0 runner docker 137158394 Feb 12 13:53 klh10/output.tape
tar: Truncated input file (needed 137158656 bytes, only 0 available)
tar: Error exit delayed from previous errors.
Might be worth trying that other debugger (lldb ...); Apple is known for making life complicated. Can someone write up a short reproducible case (like for dumb people). Then I can take a look.
We should put this file in a different spot, downloading like that will break at some point ...
Why do you say that? Why would a different spot impact whether the contents are corrupt or not?
It's true enough that if you do a second "make download" the new file will be e.g. klh10.tar.gz.1 which is wrong.
Yes. That’s true. But why is the file corrupt?
Might be worth trying that other debugger (lldb ...); Apple is known for making life complicated. Can someone write up a short reproducible case (like for dumb people). Then I can take a look.
Well, to reproduce, get an Intel Mac and make sure it is running Ventura or Sonoma. Pull the ITS GitHub tree and attempt a make EMULATOR=klh10
. It will get a segmentation fault when expect hands the salvager a “0” to format pack 0.
The same failure occurs on an M(1 2 3) Mac, but gdb won’t run on these.
We should put this file in a different spot, downloading like that will break at some point ...
Why do you say that? Why would a different spot impact whether the contents are corrupt or not?
What I mean is that it should be put into the git repo, or some other such place where there is some verification / CRC of the file in question. Randomly downloading it over the network, with no means of looking at when the file was modified, or if there are other versions is suboptimal to say the least.
The same failure occurs on an M(1 2 3) Mac, but gdb won’t run on these.
Yes it will.
How do you attach GDB to the klh10 process? The notes above do not work (e.g., there is no such ini file ..)
Since when will gdb run on M* processors? I did a “brew install gdb” on my M2 Mac and Ingot a message that gdb can only run on x68_64 architecture machines.
You attach gdb to a process by running:
gdb -p <pid-of-process>
What INI are you referring to? I didn’t mention an INI. Just try to build a freshly-pulled GitHub.com/pdp-10/its repo with:
make EMULATOR=klh10
What I mean is that it should be put into the git repo, or some other such place where there is some verification / CRC of the file in question.
I don’t think git
is the answer here. These disk image files are huge and git isn’t really for huge binary files.
We should upload them (during the build) along with a digest of the image. We should download them with a fixed name (no .1) — deleting any filename that matches the filename first — so that we will unarchive the intended file. The download should check the digest before proceeding with the contents of the archive.
(gdb) run nsalv.ini
@eswenson1 that ini file that you mentioned up thread. Attaching to a PID will not work in this case, since the process segfault.
I'm short on time, I can probably figure out what is going on but not enough to setup exactly what you are doing so I need help with that -- i.e. what exactly are you running and how since nothing from up thread has been reproducible.
What I mean is that it should be put into the git repo, or some other such place where there is some verification / CRC of the file in question.
I don’t think
git
is the answer here. These disk image files are huge and git isn’t really for huge binary files.We should upload them (during the build) along with a digest of the image. We should download them with a fixed name (no .1) — deleting any filename that matches the filename first — so that we will unarchive the intended file. The download should check the digest before proceeding with the contents of the archive.
Exact solution is debatable, a separate git repository with these things might be worth it. A digest of some sort too .. but I think depending on this "magical website on the network" to "magically work" isn't the solution.
Or if this is part of some make target, document that -- maybe that is even done. I don't know ... AFAIC right now this is all broken beyond repair.
~/its/build/klh10 $ lldb kn10-ks-its ../mchn/DB/nsalv.ini
[...]
(lldb) run
[...]
Process 5363 launched: '/Users/ams/its/build/klh10/kn10-ks-its' (arm64)
[...]
KLH10# [EOF on ../mchn/DB/nsalv.ini]
KLH10# go
Starting KN10 at loc 0774000...
When running under lldb there seems to be no segfault, hitting C-c we get:
Process 5363 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
frame #0: 0x0000000100023d38 kn10-ks-its`i_popj(op=179, ac=1, e=0) at injrst.c:687:9 [opt]
684 register w10_t pcw, w;
685 register vaddr_t sloc;
686
-> 687 w = ac_get(ac);
^
688
689 #if KLH10_EXTADR
690 /* Determine if stack pointer is local or global */
Target 0: (kn10-ks-its) stopped.
warning: kn10-ks-its was compiled with optimization - stepping may behave oddly; variables may not be available.
Which seems correct. Similarly if just run directly:
~/its/build/klh10 [1] $ ./kn10-ks-its ../mchn/DB/nsalv.ini
[...]
KLH10# go
Starting KN10 at loc 0774000...
So something or someone is not telling the whole truth, probably the expect script doing more stuff -- what exactly is being feed?
(gdb) run nsalv.ini
@eswenson1 that ini file that you mentioned up thread. Attaching to a PID will not work in this case, since the process segfault.
I'm short on time, I can probably figure out what is going on but not enough to setup exactly what you are doing so I need help with that -- i.e. what exactly are you running and how since nothing from up thread has been reproducible.
Sorry. I thought you were referring to how to simply reproduce the issue and connect with gdb after the fact. And yes, you’re right the segfault will make the attach-after-start route not be possible.
So if you pull the tree, attempt a build, let it segfault, and THEN do this:
gdb kn10-is-its
../../build/mchn/DB/nsalv.ini
you should be able to trap the segfault.
Logging an issue to keep track of the work here. The build fails really quickly at the start