8000 在UE4Editor-ELuaMonitor.dll!FELuaTraceInfoTree::OnHookCal调用时崩溃 · Issue #9 · inkiu0/ELuaProfiler · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

在UE4Editor-ELuaMonitor.dll!FELuaTraceInfoTree::OnHookCal调用时崩溃 #9

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

Open
RJie opened this issue Jan 31, 2024 · 5 comments
Open

Comments

@RJie
Copy link
RJie commented Jan 31, 2024

GetChild时候CurNode为Null。
堆栈如下:
[内联框架] UE4Editor-ELuaMonitor.dll!TSharedPtr<...>::operator->() 行 890 C++
UE4Editor-ELuaMonitor.dll!FELuaTraceInfoTree::GetChild(const void * p, FString ID) 行 81 C++
UE4Editor-ELuaMonitor.dll!FELuaTraceInfoTree::OnHookCall(lua_State * L, const void * p, FString ID, bool IsStatistics) 行 49 C++
image

@RJie
Copy link
Author
RJie commented Dec 26, 2024

问题原因可能是,为了优化获得lua函数名的效率,做了一个map来保存function ptr和函数名字FString的对应关系。但是这个lua function ptr的值是不可靠的,对于一些匿名函数来说,每次Call它的时候,function ptr的值不一样

@inkiu0
Copy link
Owner
inkiu0 commented Dec 26, 2024

嗯,最近会改一下,把ID(包含行号范围,非沙盒模式还包括函数名)作为索引,其实也就是某种意义上的函数签名了。这样归类会更准确

@inkiu0
Copy link
Owner
inkiu0 commented Dec 26, 2024

map里的函数名到时候改成FText,这样有重复的函数名,但是内存是一份,多了些TMap Entry的开销应该可以接受,改动比较小

@RJie
Copy link
Author
RJie commented Dec 27, 2024

还有两个点想跟你交流下,第一个是协程的处理,如果在协程内部,yield并不是在协程函数的第0层深度调用,而是在某个封装较深的函数内调用了yield。这就导致了增加了很多OnHookCall,但是对应的OnHookReturn需要很久协程唤醒时才能接收到,感觉会导致维护的CallTree结构错乱。第二个是代码中有pcall和xpcall的存在,被pcall保护的函数在触发很多OnHookCall后,由于代码报错被捕捉,直接转跳至pcall结束,导致对应的OnHookReturn全部消失,也会导致维护的CallTree结构错乱。

@RJie
Copy link
Author
RJie commented Dec 31, 2024

嗯,最近会改一下,把ID(包含行号范围,非沙盒模式还包括函数名)作为索引,其实也就是某种意义上的函数签名了。这样归类会更准确

能否直接使用Proto来当这个Key?C函数直接用函数指针。另外在保存函数名字的时候,不用lua_getinfo,直接用Proto里记录的信息,少一次字符串的拷贝。

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
0