LuaPanda icon indicating copy to clipboard operation
LuaPanda copied to clipboard

协程coroutine.wrap()创建,断点断不住

Open Zheng-Hongyi opened this issue 2 years ago • 4 comments

看了一下源码,只处理了coroutine.create(),没有处理coroutine.wrap(),这个如何更好的处理?

Zheng-Hongyi avatar Jun 28 '22 13:06 Zheng-Hongyi

Debug下钩子需要传thread,coroutine.wrap()方式创建的协程如何去拿thread?

Zheng-Hongyi avatar Jun 28 '22 13:06 Zheng-Hongyi

我最近查了一下,这里确实没还有想到好的处理办法,有空的时候我再研究下

stuartwang avatar Jul 23 '22 04:07 stuartwang

遇到了一样的问题,现在有解决方案了吗?

Dadio44 avatar Nov 02 '23 07:11 Dadio44

Xlua 的协程就是因为这个问题无法用 luaPanda 断点,试着用 coroutine.resume 替换 coroutine.wrap 解决了 源代码 `local move_end = {}

local generator_mt = { __index = { MoveNext = function(self) self.Current = self.co() if self.Current == move_end then self.Current = nil return false else return true end end; Reset = function(self) self.co = coroutine.wrap(self.w_func) end } } 改成local generator_mt = { __index = { MoveNext = function(self) return coroutine.resume(self.co) end; Reset = function(self) self.co = coroutine.create(self.w_func) end } }`

Dadio44 avatar Nov 02 '23 07:11 Dadio44