The coredump occurs within this loop of the 'prin_route' function,
for the same route, only when debug mode is enabled, as can be
proved by the output ending with '{' :
$ L_RT.l -pr
0.0.0.0/0 wlp59s0 192.168.43.1 UP,GW
600 { prefsrc:192.168.43.70 protocol:dhcp
scope:global type:unicast }
0.0.0.0/32 * 0.0.0.0 UP,HO
0 { protocol:boot scope:global type:blackhole
}
..
192.168.42.1/32 ppp0 0.0.0.0 UP,HO
0 { prefsrc:192.168.42.10 protocol:kernel
scope:link type:unicast }
192.168.42.1/32 ppp0 0.0.0.0 UP,HO
50 { Segmentation fault (core dumped)
So the code MUST be in this loop when the coredump occurs :
(for r (idx ratr)
(when (and (bool r) (lst? r))
(let
( k (car r) v (cdr r) )
(case k
('( "dst" "gateway" "dev" "metric" "mtu" ))
(T
(out 1 (prin (pack k ":" v "^I")))
)
)
)
)
)
Why, only when the trailing '+' "Enable Debug Mode" is in '(argv)' ,
should the behaviour of 'idx' change so drastically ?
I can send you hundreds of such coredumps - they are not very helpful
unless you can combine using GDB with use of a live picolisp to inspect
the stack . That is what I'd like to get working .
I suspect the CFA stack frame info being generated and possibly data layouts
when not in debug mode may be different to when in debug mode ?
Here's more details of the one that just happened :
(gdb) where
#0 0x0000000000444921 in consTree ()
#1 0x0000000000422428 in _for ()
#2 0x00000000004212f7 in _prog ()
#3 0x000000000042324d in _let ()
#4 0x000000000042324d in _let ()
#5 0x0000000000432469 in evExpr ()
#6 0x000000000041fd02 in _eval ()
#7 0x00000000004211d8 in _bool ()
#8 0x0000000000421218 in _not ()
#9 0x00000000004214ac in _if ()
#10 0x00000000004212f7 in _prog ()
#11 0x000000000042324d in _let ()
#12 0x000000000043e505 in loop1 ()
#13 0x0000000000422573 in _for ()
#14 0x000000000042324d in _let ()
#15 0x000000000042324d in _let ()
#16 0x00000000004238c7 in _catch ()
#17 0x000000000042324d in _let ()
#18 0x0000000000434476 in repl ()
#19 0x00000000004495b8 in main ()
(gdb) info reg
rax 0x45b6b8 4568760
rbx 0x7f38d2f23780 139882033985408
rcx 0x7f38d2f247c0 139882033989568
rdx 0x7f38d2f23780 139882033985408
rsi 0x3 3
rdi 0x7f38d2f247c0 139882033989568
rbp 0x7ffc913afc80 0x7ffc913afc80
rsp 0x7ffc913afc40 0x7ffc913afc40
r8 0x45b5e8 4568552
r9 0x45b5e8 4568552
r10 0x45b6b8 4568760
r11 0x202 514
r12 0x7ffc913afc40 140722745048128
r13 0x45b6b8 4568760
r14 0x7ffc913afc50 140722745048144
r15 0x45b5e8 4568552
rip 0x444921 0x444921 <consTree+129>
eflags 0x10212 [ AF IF RF ]
cs 0x33 51
ss 0x2b 43
ds 0x0 0
es 0x0 0
fs 0x0 0
gs 0x0 0
(gdb) disass
Dump of assembler code for function consTree:
0x00000000004448a0 <+0>: push %rbp
0x00000000004448a1 <+1>: mov %rsp,%rbp
0x00000000004448a4 <+4>: push %r15
0x00000000004448a6 <+6>: push %r14
0x00000000004448a8 <+8>: push %r12
0x00000000004448aa <+10>: push %rbx
0x00000000004448ab <+11>: mov %rsi,%rax
0x00000000004448ae <+14>: mov %rdi,%rbx
0x00000000004448b1 <+17>: test $0xf,%bl
0x00000000004448b4 <+20>: jne 0x4449c4 <consTree+292>
0x00000000004448ba <+26>: mov %rsp,%rcx
0x00000000004448bd <+29>: lea -0x10(%rcx),%r14
0x00000000004448c1 <+33>: mov %r14,%rsp
0x00000000004448c4 <+36>: mov $0x45b5e8,%r15
0x00000000004448cb <+43>: mov (%r15),%rdx
0x00000000004448ce <+46>: mov %rdx,-0x8(%rcx)
0x00000000004448d2 <+50>: mov %rsp,%rcx
0x00000000004448d5 <+53>: lea -0x10(%rcx),%r12
0x00000000004448d9 <+57>: mov %r12,%rsp
0x00000000004448dc <+60>: movq $0xa,-0x10(%rcx)
0x00000000004448e4 <+68>: mov %r14,-0x8(%rcx)
0x00000000004448e8 <+72>: mov %r12,(%r15)
0x00000000004448eb <+75>: mov $0xa,%ecx
0x00000000004448f0 <+80>: mov 0x8(%rbx),%rsi
0x00000000004448f4 <+84>: mov 0x8(%rsi),%rdx
0x00000000004448f8 <+88>: test $0xf,%dl
0x00000000004448fb <+91>: jne 0x44492e <consTree+142>
0x00000000004448fd <+93>: add $0x8,%rsi
0x0000000000444901 <+97>: cs nopw 0x0(%rax,%rax,1)
0x000000000044490b <+107>: nopl 0x0(%rax,%rax,1)
0x0000000000444910 <+112>: mov %rcx,(%rsi)
0x0000000000444913 <+115>: mov %rbx,(%r12)
0x0000000000444917 <+119>: mov %rbx,%rcx
0x000000000044491a <+122>: mov %rdx,%rbx
0x000000000044491d <+125>: mov 0x8(%rdx),%rsi
=> 0x0000000000444921 <+129>: mov 0x8(%rsi),%rdx
0x0000000000444925 <+133>: add $0x8,%rsi
0x0000000000444929 <+137>: test $0xf,%dl
0x000000000044492c <+140>: je 0x444910 <consTree+112>
So '0x8(%rsi)' is invalid when not in debug mode, but valid when in
debug mode. Why ?
On 02/08/2023, Jason Vas Dias <[email protected]> wrote:
> Good day Alex -
> RE:
>>Can you debug this a little more? E.g. look at the output of (traceAll) and
>> see
>> *where* exactly it happens.
>
> That's the whole problem - doesn't 'traceAll' depend on Debug Mode
> being enabled by trailing '+' ?
> And the coredump does NOT occur in debug mode, nor in normal
> usage where there are not 2 routes that share the same Key / destination