On Mon Apr 15 13:16:51 2019, PEVANS wrote:
Show quoted text> I suspect this might be a stack-refcount issue, where the iteration-
> list temporaries get stomped on by other code.
By adding some more debug printing into the suspend/resume logic around CXt_LOOP_LIST, we can observe that when this suspends, we have our values on the stack as expected:
F:AA: suspend LOOP_LIST basesp=0 ix=1 SP=16
item=0x55dfc6f62638:SV{type=PV,refcnt=2,PVX=""}
item=0x55dfc6f6a7d8:SV{type=PV,refcnt=1,PVX="�"}
item=0x55dfc6bf0b88:SV{type=PV,refcnt=1,PVX="3"}
item=0x55dfc6f6af40:SV{type=PV,refcnt=1,PVX="�"}
item=0x55dfc6f62620:SV{type=PV,refcnt=1,PVX="2"}
item=0x55dfc6f6aac0:SV{type=PV,refcnt=1,PVX="�"}
item=0x55dfc6f6a940:SV{type=PV,refcnt=1,PVX="�"}
item=0x55dfc6bf06c0:SV{type=PV,refcnt=1,PVX="�"}
item=0x55dfc6f92260:SV{type=PV,refcnt=1,PVX="n"}
item=0x55dfc6d6b8a0:SV{type=PV,refcnt=1,PVX="�"}
item=0x55dfc6f6abf8:SV{type=PV,refcnt=1,PVX="/"}
item=0x55dfc6f62518:SV{type=PV,refcnt=1,PVX="�"}
item=0x55dfc6f92140:SV{type=PV,refcnt=1,PVX="+"}
item=0x55dfc6d6b9d8:SV{type=PV,refcnt=1,PVX="�"}
item=0x55dfc6f920f8:SV{type=PV,refcnt=1,PVX="-"}
item=0x55dfc6ee8db8:SV{type=PV,refcnt=1,PVX="�"}
F:AA suspend STACK len=16
item=0x55dfc6f62638:SV{type=PV,refcnt=2,PVX=""}
item=0x55dfc6f6a7d8:SV{type=PV,refcnt=1,PVX="�"}
item=0x55dfc6bf0b88:SV{type=PV,refcnt=1,PVX="3"}
item=0x55dfc6f6af40:SV{type=PV,refcnt=1,PVX="�"}
item=0x55dfc6f62620:SV{type=PV,refcnt=1,PVX="2"}
item=0x55dfc6f6aac0:SV{type=PV,refcnt=1,PVX="�"}
item=0x55dfc6f6a940:SV{type=PV,refcnt=1,PVX="�"}
item=0x55dfc6bf06c0:SV{type=PV,refcnt=1,PVX="�"}
item=0x55dfc6f92260:SV{type=PV,refcnt=1,PVX="n"}
item=0x55dfc6d6b8a0:SV{type=PV,refcnt=1,PVX="�"}
item=0x55dfc6f6abf8:SV{type=PV,refcnt=1,PVX="/"}
item=0x55dfc6f62518:SV{type=PV,refcnt=1,PVX="�"}
item=0x55dfc6f92140:SV{type=PV,refcnt=1,PVX="+"}
item=0x55dfc6d6b9d8:SV{type=PV,refcnt=1,PVX="�"}
item=0x55dfc6f920f8:SV{type=PV,refcnt=1,PVX="-"}
item=0x55dfc6ee8db8:SV{type=PV,refcnt=1,PVX="�"}
F:AA suspend MORTALS len=2
item=0x55dfc6f62698:SV{type=IV,refcnt=1,IV=2}
item=0x55dfc6f6af70:SV{type=RV,refcnt=1,ROK}
But yet, when we resume again later while we put them same SV addresses back in place, they don't appear to contain the right values any more:
F:AA: resume LOOP_LIST basesp=0 ix=1 SP=16
item=0x55dfc6f62638:SV{type=PV,refcnt=1,PVX=""}
item=0x55dfc6f6a7d8:SV{type=(255),refcnt=0}
item=0x55dfc6bf0b88:SV{type=(255),refcnt=0}
item=0x55dfc6f6af40:SV{type=(255),refcnt=0}
item=0x55dfc6f62620:SV{type=(255),refcnt=0}
item=0x55dfc6f6aac0:SV{type=(255),refcnt=0}
item=0x55dfc6f6a940:SV{type=(255),refcnt=0}
item=0x55dfc6bf06c0:SV{type=(255),refcnt=0}
item=0x55dfc6f92260:SV{type=(255),refcnt=0}
item=0x55dfc6d6b8a0:SV{type=(255),refcnt=0}
item=0x55dfc6f6abf8:SV{type=(255),refcnt=0}
item=0x55dfc6f62518:SV{type=(255),refcnt=0}
item=0x55dfc6f92140:SV{type=(255),refcnt=0}
item=0x55dfc6d6b9d8:SV{type=(255),refcnt=0}
item=0x55dfc6f920f8:SV{type=(255),refcnt=0}
item=0x55dfc6ee8db8:SV{type=(255),refcnt=0}
Use of freed value in iteration at /home/leo/src/perl/Device-AVR-UPDI/blib/lib/Device/AVR/UPDI.pm line 209, <$fh> line 155.
Something has cleared them out inbetween time.
--
Paul Evans