Skip to content

Commit 69e74a5

Browse files
committed
Add support for disassembly and support debug debugger
- Add support for disassembly - Support debug debugger - Support auto download luamake - Update luajit build script
1 parent 1df17ad commit 69e74a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+976
-88
lines changed

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ NamespaceIndentation: All
1515
PackConstructorInitializers: Never
1616
QualifierAlignment: Left
1717
SpaceBeforeCpp11BracedList: true
18+
SortIncludes: false

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
/build/
66
/extension/package.json
77
.DS_Store
8-
.idea/
8+
.idea/
9+
luamake/

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
url = https://github.com/actboy168/bee.lua.git
44
[submodule "3rd/lua/luajit"]
55
path = 3rd/lua/luajit
6-
url = https://github.com/fesily/luajit2
6+
url = https://github.com/fesily/luajit
77
[submodule "3rd/json.lua"]
88
path = 3rd/json.lua
99
url = https://github.com/actboy168/json.lua

.luarc.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,9 @@
3737
"trailing-space": "Warning"
3838
}
3939
},
40-
"workspace.checkThirdParty": false
40+
"workspace.checkThirdParty": false,
41+
"type.inferParamType": true,
42+
"workspace.library": [
43+
"${addons}/bee/module/library"
44+
]
4145
}

.vscode/settings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
{
22
"C_Cpp.autoAddFileAssociations": false,
3+
"terminal.integrated.env.linux": {
4+
"PATH": "${workspaceFolder}/luamake;${env:PATH}"
5+
},
6+
"terminal.integrated.env.windows": {
7+
"PATH": "${workspaceFolder}/luamake;${env:PATH}"
8+
},
9+
"terminal.integrated.env.osx": {
10+
"PATH": "${workspaceFolder}/luamake;${env:PATH}"
11+
}
312
}

3rd/lua/luajit

Makefile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
.PHONY: all download_deps build_luamake init_luamake install
3+
4+
all: download_deps build_luamake
5+
luamake/luamake build --release
6+
7+
build_luamake: init_luamake
8+
@echo "Building luamake..."
9+
git submodule update --init --recursive
10+
cd luamake && compile/build.sh
11+
12+
download_deps: build_luamake
13+
luamake/luamake lua compile/download_deps.lua
14+
15+
init_luamake:
16+
@if [ -d "luamake" ]; then \
17+
if [ -d "luamake/.git" ]; then \
18+
echo "Updating luamake repository..."; \
19+
(cd luamake && git pull && git submodule update --remote); \
20+
else \
21+
echo "Error: 'luamake' exists but is not a Git repository."; \
22+
fi; \
23+
else \
24+
echo "Cloning luamake repository..."; \
25+
git clone --recurse-submodules https://github.com/actboy168/luamake.git; \
26+
fi
27+
28+
install: all
29+
@echo "Installing Lua Debugger..."
30+
luamake/luamake lua compile/install.lua

compile/install.lua

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
local fs = require 'bee.filesystem'
2+
local home = assert(os.getenv("HOME") or os.getenv("HOMEPATH"), "HOME environment variable is not set")
3+
4+
local vscode_dir = {
5+
".vscode",
6+
".vscode-server",
7+
}
8+
9+
local sourceDir = ...
10+
11+
for i, v in ipairs(vscode_dir) do
12+
local vscode_dir = fs.path(home) / v / "extensions"
13+
if not fs.exists(vscode_dir) or not fs.is_directory(vscode_dir) then
14+
goto continue
15+
end
16+
local extensions_json = vscode_dir / "extensions.json"
17+
if not fs.exists(extensions_json) or not fs.is_regular_file(extensions_json) then
18+
goto continue
19+
end
20+
local fp = io.open(extensions_json:string(), "r")
21+
local content = fp:read("*a")
22+
fp:close()
23+
if not content:find("lua-debug", 1, true) then
24+
goto continue
25+
end
26+
for dir in fs.pairs(vscode_dir) do
27+
if dir:string():find("lua-debug", 1, true) then
28+
local fn = assert(loadfile('compile/copy.lua'))
29+
fn(sourceDir or 'publish', dir:string())
30+
os.exit(0)
31+
end
32+
end
33+
::continue::
34+
end
35+
os.exit(1)

compile/luajit/defined.lua

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
local lm = require "luamake"
2+
local fs = require 'bee.filesystem'
23

34
local arch = lm.runtime_platform:sub(lm.runtime_platform:find("-") + 1)
45
if arch == "ia32" then
@@ -9,12 +10,34 @@ local luaver = "luajit"
910
local LUAJIT_ENABLE_LUA52COMPAT = "LUAJIT_ENABLE_LUA52COMPAT"
1011
local LUAJIT_NUMMODE = "LUAJIT_NUMMODE=2"
1112
local luajitDir = '3rd/lua/' .. luaver .. "/src"
13+
local is_old_version_luajit = fs.exists(fs.path(luajitDir) / 'lj_init.c')
1214

1315
local _M = {
1416
arch = arch,
1517
LUAJIT_ENABLE_LUA52COMPAT = LUAJIT_ENABLE_LUA52COMPAT,
1618
LUAJIT_NUMMODE = LUAJIT_NUMMODE,
17-
luajitDir = luajitDir
19+
luajitDir = luajitDir,
20+
is_old_version_luajit = is_old_version_luajit
1821
}
1922

23+
if not is_old_version_luajit then
24+
local sp = require 'bee.subprocess'
25+
local sys = require 'bee.sys'
26+
sp.spawn({
27+
sys.exe_path(),
28+
"lua",
29+
'compile/luajit/relver.lua',
30+
luajitDir.."/..",
31+
luajitDir.."/luajit_relver.txt"
32+
}):wait()
33+
sp.spawn({
34+
sys.exe_path(),
35+
"lua",
36+
luajitDir.."/host/genversion.lua",
37+
luajitDir.."/luajit_rolling.h",
38+
luajitDir.."/luajit_relver.txt",
39+
luajitDir.."/luajit.h"
40+
}):wait()
41+
end
42+
2043
return _M

0 commit comments

Comments
 (0)