如何远程调试Lua? [英] How to debug Lua remotely?

查看:732
本文介绍了如何远程调试Lua?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找远程调试Lua的最佳方法(就像从网页浏览器)。



我看到RemDebug ,但最后的项目更新是在2006年完成的。它与Lua 5.0和5.1配合使用,但Lua 5.2非常接近,我看不到RemDebug可以随时更新。



我可以在我的调试主机上安装一个小型嵌入式Web服务器,并使用类似RemDebug的方式与之进行通信,并通过HTTP执行远程调试



建议不胜感激。

解决方案

基于RemDebug( MobDebug )的调试器,具有新命令,新功能,错误修复以及与IDE的集成。



MobDebug基于客户端(debugee)和服务器(控制器)之间的TCP交互。 RemDebug和大多数其他远程调试器也是如此。您可能能够运行在别的东西(如WebSockets或HTTP)之上,但您仍然需要运行协同程序和调试挂钩来控制被调试的应用程序。



调试过程的架构非常简单:




  • 您有要调试的应用程序

  • 您还有一个控制器的调试器

  • 应用程序加载调试器的客户端组件,打开与控制器的连接

  • 控制器接受来自命令行或IDE的命令(MobDebug提供两者;它与 ZeroBraneStudio 集成,并且还提供了一种可编程的方式来运行它)

  • 当应用程序加载时,调试器会安装一个调试挂钩,它在每一行/ call / return上运行。从这个调试钩子开始调用调试器,然后可以从控制器执行命令(如安装断点,评估表达式等等)。当下一个可执行命令发送(如运行或步骤)时,调试器将返回挂钩,然后返回该应用程序,以允许继续。



可能会模拟现有的套接字接口(因为它仅使用connect / send / receive和select / timeout中止应用程序)并重新使用大部分库。我仍然不知道为什么你想在浏览器中运行这个,因为你可以在任何支持TCP的东西上运行应用程序(我有一个工作原型来调试在桌面上在移动设备上运行的应用程序) / p>

I'm searching for the best way to debug Lua remotely, ( like from a web browser ).

I saw RemDebug, but the last project update was done on 2006. It works with Lua 5.0 and 5.1, but Lua 5.2 is quite close, and I don't see RemDebug to get an update anytime soon.

I could mount a small embedded web-server on my debug host, and use something like RemDebug to communicate with it, and perform remote debugging via HTTP.

Suggestions are appreciated.

解决方案

I have developed a new debugger based on RemDebug (MobDebug) with new commands, new features, bugfixes, and integration with IDEs.

MobDebug is based on TCP interaction between the client (debugee) and the server (controller). This is also the case for RemDebug and most other remote debuggers. You might be able to run on top of something else (like WebSockets or HTTP), but you still need to be able to run coroutines and debug hook to control the application being debugged.

The architecture of the debugging process is quite simple:

  • You have an application you want to debug
  • You also have your debugger with a controller
  • The application loads the client components of the debugger, which opens a connection to the controller
  • The controller accepts commands from a command line or an IDE (MobDebug provides both; it integrates with ZeroBraneStudio and also provides a scriptable way to run it)
  • When the application is loaded, the debugger installs a debug hook, which is run on every line/call/return. From this debug hook a resume call is made to the debugger, which can then execute commands from the controller (like install a breakpoint, evaluate an expression and so on). When the next executable command is send (like run or step), the debugger yields back to the hook, which then returns back to the app allowing it to proceed.

It may be possible to mimic the existing socket interface (as it's only using connect/send/receive and select/timeout to abort the application) and reuse most of the library. I'm still not sure why you'd want to run this in a browser though as you can run the application on anything that supports TCP already (I have a working prototype debugging an application running on a mobile device from my desktop).

这篇关于如何远程调试Lua?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆