You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/Debugging-Scripts.md
+40Lines changed: 40 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,3 +12,43 @@ Since Premake's update to 5.3, the only debugger that seems to be able to debug
12
12
* There's also a Project tab. Right-click the root folder and select **Project Directory > Choose...** to select the root of the premake repository. Open the lua file you want to debug (you can start with _premake_init.lua) and set a breakpoint.
13
13
* Run premake with your desired command line and append `--scripts=path_to_premake --debugger` path_to_premake is the root of the repository where src lives. This isn't necessary if you run premake in the same directory as the src folder. If all goes well premake should think for a moment and the debugger should flash indicating that it has broken execution.
14
14
* An example command line would be `C:/my_project_folder/premake5.exe vs2015 --scripts=C:/premake_repo/ --debugger`
15
+
16
+
## Visual Studio Code
17
+
18
+
*[Download Visual Studio Code](https://code.visualstudio.com/) and install it
* Add the following text to the top of the premake5.lua file in your project.
21
+
```lua
22
+
ifos.getenv("LOCAL_LUA_DEBUGGER_VSCODE") =="1" then
23
+
require("lldebugger").start()
24
+
end
25
+
```
26
+
* Create `launch.json` according to the [debugger settings](https://code.visualstudio.com/docs/editor/debugging#_launch-configurations) and modify it as follows.
27
+
```json
28
+
{
29
+
"version": "0.2.0",
30
+
"configurations": [
31
+
{
32
+
"name": "premake_debug",
33
+
"type": "lua-local",
34
+
"request": "launch",
35
+
"cwd": "${workspaceFolder}",
36
+
"program": {
37
+
// path to premake5.exe
38
+
// If you want to debug including premake5.exe internals, use debug build premake5.exe
39
+
"command": "C:/my_project_folder/premake5.exe",
40
+
},
41
+
"args": [
42
+
"vs2022",
43
+
"--verbose",
44
+
// path to root script file
45
+
"--file=${workspaceFolder}/premake5.lua"
46
+
],
47
+
},
48
+
]
49
+
}
50
+
```
51
+
* Open the lua file you want to debug and [set a breakpoint](https://code.visualstudio.com/docs/editor/debugging#_breakpoints).
0 commit comments