How to debug Lua code using Visual Studio - lua

I have a win32 application and this is linked with Lua files. Both Lua and C++ files have bi-directional communication and can invoke function within each other.
I wanted to debug Lua code from Visual Studio IDE likewise what we do for C++ code. I have installed "BabeLua For 2012 V3.2.2.0" extension, but not able to debug...
I simply created a break point in Lua file and attached the code to my Win32 application, but it says that "No symbols have been loaded".
Please help me to understand where does the symbol files resides for Lua, or is there any other intuitive way to debug Lua scripts..
Any help will be greatly appreciated...

is there any other intuitive way to debug LUA scripts.
You may try ZeroBrane Studio IDE, which supports debugging of Lua scripts included in other applications. See the remote debugging section in the documentation for details and examples.

Related

How to create a program that runs my LUA code?

So, hi!
I am very new to Coding outside of a Game-Creation Program that automatically creates executable files for me, and from Create Your Frisk and other projects, I know a decent chunk of the basics in LUA. but how do I make a program out of it?
Like, How do I make an executable?(I'm using visual studio to code)
You need a Lua interpreter that runs your Lua code.
Either you use a standalone Lua interpreter, a little executable that can only run Lua scripts, or you embedd a Lua interpreter into your own application.
See http://www.lua.org/start.html

How to install Lua GUI in ZBS IDE

I am completely new to programming in Lua outside a sandbox.
I have found a library called Lua GUI that I'd like to use (https://github.com/williamwilling/luagui/). I have still not understood how to quite install the library, and how I even go about using it.
That's part 1 of my question; How can I install Lua GUI(or an library for that matter), and then how do I go about actually using it? By that I mean, is it as simple as writing a program that starts with "require "gui"" and then running it, or is there more to it?
Part 2 of my question is then how do I go about installing it as a package for ZeroBrane Studio IDE, I have no idea at all what the readme file is instructing me to do so I would be grateful if someone could clarify.
If you copy the contents of the src folder in the luagui project to your project directory you should be able to call:
local gui = require("gui")
in your main Lua file and use it that way.

Lua debug on an embedded ARM based platform

I am new to Lua. I have an ARM Cortex based product with an OS providing TCP stack, SD card for file storage, and lots of custom hardware. I have embedded Lua (from the standard source distribution) into the product and added an API to give Lua access to my hardware. Also have Telnet and FTP services running. Works great.
Now I would like to add the ability to debug scripts with ZeroBrane. Looks like I need to add MobDebug, and connect it to my OS thru LuaSockets. Assuming this is a valid approach, can anybody point to a tutorial or documentation that would help?
Thanks
Assuming you have access to luasocket on that platform, you can follow the instructions on remote debugging with MobDebug and ZeroBrane Studio. It should be a matter of adding require('mobdebug').start('IP-of-computer-running-ZeroBraneStudio') and making project files available in ZeroBrane Studio.
ZeroBrane Studio also does mapping between different file systems to allow debugging of scripts running on one platform from the IDE running on a (possibly) different platform. You only need to make sure you have the same project structure. For example, you may have /usr/me/myprojects/projectA/fileB.lua and start debugging of projectA/fileB.lua in /usr/me/myprojects/; then on the IDE side you may have D:\Users\Me\myprojects\projectA\fileB.lua opened in the IDE and it will attempt to map /usr/me/myprojects/ to D:\Users\Me\myprojects\. If you run into issues, you can use IRC or the maillist to get further help.

Having trouble building Z3 in Visual Studio

Hello I downloaded Z3 from http://z3.codeplex.com/ and then opened the Z3 solution in Visual Studio 2012. (While I'm not totally new to VS I haven't used it in over 10 years). There are 9 projects in this solution but I am having a hard time telling which I ought to be using. I can guess at some of them, but others aren't very clear. Eg. what is the difference between Microsoft.Z3 and Microsoft.Z3V3 ? Can anyone briefly explain what the different projects are and which ones to build?
Anyway just for kicks I tried building the top level solution but got the following errors
Error 1 error RC1015: cannot open include file 'afxres.h'. C:\Projects\z3-src-4.1.2\z3\dll\dll.rc 10 1 dll
Error 2 (same as Error 1 except in shell.rc)
Error 3 error LNK1104: cannot open file 'C:\Projects\z3-src-4.1.2\z3\Debug\z3_dbg.lib' C:\Projects\z3-src-4.1.2\z3\test_capi\LINK test_capi
Trying to build just the MS.Z3 project still gives me Error 1.
My eventual goal is to invoke Z3 from say an F# program. Can someone provide some guidance for how to do this?
Any help would be appreciated.
EDIT
This answer reflects the directory structure used in Z3 version <= 4.1.1. In version 4.3, the code base has been reorganized/simplified.
END EDIT
Which version of Visual Studio are you using? I'm asking because I want to reproduce the behavior you described.
The easiest way to build Z3 is described here.
You should use the Visual Studio Command Prompt, and execute msbuild. It seems you tried that, and got errors. Here is a short description of each project folder:
lib: the Z3 source code is here. This is the important folder. For visual studio users, it generated a static library.
dll: project for wrapping the static library as a Windows DLL. This is irrelevant for users in other platforms.
shell: uses the static library from lib to build z3.exe.
test: a bunch of unit tests. It produces test.exe.
Microsoft.Z3: .Net API. It is the official .Net API (C#, Visual Basic, F#, etc) for Z3. This is the API you should use with F#.
Microsoft.Z3V3: It is the old .NET API. It was the API available in Z3 3.x. We maintain it because some users still use it.
test_capi: Application that tests the Z3 C API.
maxsat: Small application that implements two maxsat algorithms on top of the Z3 API.

SharePoint Console Output

I made a class library, and put it in GAC.
It has one C# code file, and I put a Console.WriteLine() statement in.
When I run the Feature, where would I see the output from this statement?
Use
System.Diagnostics.Trace.WriteLine()
or
System.Diagnostics.Debug.WriteLine()
(Will only output text if assembly
compiled in debug mode)
to output some text. You would then see it in a program like DebugView.
But the best way to debug the program (if you ask this question regarding to debugging) i recommend attachking to SharePoint with Visual Studio debugger. Some debugging tips here.

Resources