diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2f413b8b..2e3b8092 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,8 +81,7 @@ jobs: run: | git clone https://github.com/pallene-lang/pallene-tracer cd pallene-tracer - sudo make install - luarocks --local make + sudo make install LUA_DIR=/usr/local - name: Build run: luarocks --local make diff --git a/pallene-dev-1.rockspec b/pallene-dev-1.rockspec index 5cacff15..9dc2e1e8 100644 --- a/pallene-dev-1.rockspec +++ b/pallene-dev-1.rockspec @@ -15,7 +15,6 @@ dependencies = { "lua == 5.4", "lpeg >= 1.0", "argparse >= 0.7.0", - "pallene-tracer >= 0.5.0a" } external_dependencies = { PTRACER = { diff --git a/spec/traceback/anon_lua/main.lua b/spec/traceback/anon_lua/main.lua index 2dbc9f40..606fad96 100644 --- a/spec/traceback/anon_lua/main.lua +++ b/spec/traceback/anon_lua/main.lua @@ -5,11 +5,6 @@ local anon = require "spec.traceback.anon_lua.anon_lua" -local function wrapper() - anon.call_anon_lua_fn(function() - error "Error from an anonymous Lua fn!" - end) -end - --- luacheck: globals pallene_tracer_debug_traceback -xpcall(wrapper, pallene_tracer_debug_traceback) +anon.call_anon_lua_fn(function() + error "Error from an anonymous Lua fn!" +end) diff --git a/spec/traceback/depth_recursion/main.lua b/spec/traceback/depth_recursion/main.lua index a081fb5a..7e1d8fb5 100644 --- a/spec/traceback/depth_recursion/main.lua +++ b/spec/traceback/depth_recursion/main.lua @@ -14,12 +14,4 @@ function lua_fn(depth) pallene.pallene_fn(lua_fn, depth - 1) end --- Should be local. --- Making it global so that it is visible in the traceback. --- luacheck: globals wrapper -function wrapper() - lua_fn(10) -end - --- luacheck: globals pallene_tracer_debug_traceback -xpcall(wrapper, pallene_tracer_debug_traceback) +lua_fn(10) diff --git a/spec/traceback/module_lua/main.lua b/spec/traceback/module_lua/main.lua index c1c0ea47..3bb8be24 100644 --- a/spec/traceback/module_lua/main.lua +++ b/spec/traceback/module_lua/main.lua @@ -25,12 +25,4 @@ function lua_3(sum) error "Any normal error from Lua!" end --- Should be local. --- Making it global so that it is visible in the traceback. --- luacheck: globals wrapper -function wrapper() - another_module.call_lua_callback(lua_1) -end - --- luacheck: globals pallene_tracer_debug_traceback -xpcall(wrapper, pallene_tracer_debug_traceback) +another_module.call_lua_callback(lua_1) diff --git a/spec/traceback/module_pallene/main.lua b/spec/traceback/module_pallene/main.lua index fc111b2c..7c5def34 100644 --- a/spec/traceback/module_pallene/main.lua +++ b/spec/traceback/module_pallene/main.lua @@ -16,12 +16,4 @@ function lua_1() pallene_alt.alternate_everyday_fn(lua_2) end --- Should be local. --- Making it global so that it is visible in the traceback. --- luacheck: globals wrapper -function wrapper() - pallene.normal_everyday_fn(lua_1) -end - --- luacheck: globals pallene_tracer_debug_traceback -xpcall(wrapper, pallene_tracer_debug_traceback) +pallene.normal_everyday_fn(lua_1) diff --git a/spec/traceback/rect/main.lua b/spec/traceback/rect/main.lua index dde05702..8dc7ae28 100644 --- a/spec/traceback/rect/main.lua +++ b/spec/traceback/rect/main.lua @@ -5,12 +5,4 @@ local rect = require "spec.traceback.rect.rect" --- Should be local. --- Making it global so that it is visible in the traceback. --- luacheck: globals wrapper -function wrapper() - print(rect.area { width = "Huh, gotcha!", height = 16.0 }) -end - --- luacheck: globals pallene_tracer_debug_traceback -xpcall(wrapper, pallene_tracer_debug_traceback) +print(rect.area { width = "Huh, gotcha!", height = 16.0 }) diff --git a/spec/traceback/stack_overflow/main.lua b/spec/traceback/stack_overflow/main.lua index bde220fd..a122fec6 100644 --- a/spec/traceback/stack_overflow/main.lua +++ b/spec/traceback/stack_overflow/main.lua @@ -10,10 +10,4 @@ function please_dont_overflow() so.no_overflow(please_dont_overflow) end --- luacheck: globals wrapper -function wrapper() - please_dont_overflow() -end - --- luacheck: globals pallene_tracer_debug_traceback -xpcall(wrapper, pallene_tracer_debug_traceback) +please_dont_overflow() diff --git a/spec/traceback_spec.lua b/spec/traceback_spec.lua index 726cffeb..f0ce4366 100644 --- a/spec/traceback_spec.lua +++ b/spec/traceback_spec.lua @@ -19,21 +19,18 @@ local function assert_test(test, expected_traceback) end local luafile = util.shell_quote("spec/traceback/"..test.."/main.lua") - local ok, err, _, err_content = util.outputs_of_execute("lua "..luafile) - assert(ok, err) + local ok, _, output_content, err_content = util.outputs_of_execute("pt-run "..luafile) + assert(not ok, output_content) assert.are.same(expected_traceback, err_content) end it("Rectangle", function() assert_test("rect", [[ -Runtime error: spec/traceback/rect/main.lua:12: file spec/traceback/rect/rect.pln: line 10: wrong type for downcasted value, expected float but found string +Runtime error: spec/traceback/rect/main.lua:8: file spec/traceback/rect/rect.pln: line 10: wrong type for downcasted value, expected float but found string Stack traceback: spec/traceback/rect/rect.pln:10: in function 'universal_calc_area' spec/traceback/rect/rect.pln:13: in function 'area' - spec/traceback/rect/main.lua:12: in function 'wrapper' - C: in function 'xpcall' - spec/traceback/rect/main.lua:16: in
- C: in function '' + spec/traceback/rect/main.lua:8: in
]]) end) @@ -48,10 +45,7 @@ Stack traceback: spec/traceback/module_lua/module_lua.pln:8: in function 'pallene_1' spec/traceback/module_lua/main.lua:12: in function 'callback' ./spec/traceback/module_lua/another_module.lua:7: in function 'call_lua_callback' - spec/traceback/module_lua/main.lua:32: in function 'wrapper' - C: in function 'xpcall' - spec/traceback/module_lua/main.lua:36: in
- C: in function '' + spec/traceback/module_lua/main.lua:28: in
]]) end) @@ -64,10 +58,7 @@ Stack traceback: spec/traceback/module_pallene/module_pallene_alt.pln:8: in function 'alternate_everyday_fn' spec/traceback/module_pallene/main.lua:16: in function 'lua_1' spec/traceback/module_pallene/module_pallene.pln:8: in function 'normal_everyday_fn' - spec/traceback/module_pallene/main.lua:23: in function 'wrapper' - C: in function 'xpcall' - spec/traceback/module_pallene/main.lua:27: in
- C: in function '' + spec/traceback/module_pallene/main.lua:19: in
]]) end) @@ -87,10 +78,7 @@ Stack traceback: spec/traceback/depth_recursion/main.lua:14: in function 'lua_fn' spec/traceback/depth_recursion/depth_recursion.pln:8: in function 'pallene_fn' spec/traceback/depth_recursion/main.lua:14: in function 'lua_fn' - spec/traceback/depth_recursion/main.lua:21: in function 'wrapper' - C: in function 'xpcall' - spec/traceback/depth_recursion/main.lua:25: in
- C: in function '' + spec/traceback/depth_recursion/main.lua:17: in
]]) end) @@ -109,31 +97,28 @@ Stack traceback: spec/traceback/stack_overflow/stack_overflow.pln:8: in function 'no_overflow' spec/traceback/stack_overflow/main.lua:10: in function 'please_dont_overflow' - ... (Skipped 379 frames) ... + ... (Skipped 380 frames) ... + spec/traceback/stack_overflow/main.lua:10: in function 'please_dont_overflow' + spec/traceback/stack_overflow/stack_overflow.pln:8: in function 'no_overflow' + spec/traceback/stack_overflow/main.lua:10: in function 'please_dont_overflow' spec/traceback/stack_overflow/stack_overflow.pln:8: in function 'no_overflow' spec/traceback/stack_overflow/main.lua:10: in function 'please_dont_overflow' spec/traceback/stack_overflow/stack_overflow.pln:8: in function 'no_overflow' spec/traceback/stack_overflow/main.lua:10: in function 'please_dont_overflow' spec/traceback/stack_overflow/stack_overflow.pln:8: in function 'no_overflow' spec/traceback/stack_overflow/main.lua:10: in function 'please_dont_overflow' - spec/traceback/stack_overflow/main.lua:15: in function 'wrapper' - C: in function 'xpcall' - spec/traceback/stack_overflow/main.lua:19: in
- C: in function '' + spec/traceback/stack_overflow/main.lua:13: in
]]) end) it("Anonymous lua functions", function() assert_test("anon_lua", [[ -Runtime error: spec/traceback/anon_lua/main.lua:10: Error from an anonymous Lua fn! +Runtime error: spec/traceback/anon_lua/main.lua:9: Error from an anonymous Lua fn! Stack traceback: C: in function 'error' - spec/traceback/anon_lua/main.lua:10: in function '' - spec/traceback/anon_lua/anon_lua.pln:8: in function 'call_anon_lua_fn' spec/traceback/anon_lua/main.lua:9: in function '' - C: in function 'xpcall' - spec/traceback/anon_lua/main.lua:15: in
- C: in function '' + spec/traceback/anon_lua/anon_lua.pln:8: in function 'call_anon_lua_fn' + spec/traceback/anon_lua/main.lua:8: in
]]) end) diff --git a/src/pallene/c_compiler.lua b/src/pallene/c_compiler.lua index 6fad4c7d..ca204b66 100644 --- a/src/pallene/c_compiler.lua +++ b/src/pallene/c_compiler.lua @@ -18,7 +18,6 @@ local c_compiler = {} local CC = os.getenv("CC") or "cc" local CFLAGS = os.getenv("CFLAGS") or "-O2" -local PTLIBDIR = os.getenv("PTLIBDIR") or "/usr/local/lib" local function get_uname() local ok, err, uname = util.outputs_of_execute("uname -s") @@ -62,8 +61,6 @@ function c_compiler.compile_o_to_so(in_filename, out_filename) CFLAGS_SHARED, "-o", util.shell_quote(out_filename), util.shell_quote(in_filename), - "-lptracer", - "-Wl,-rpath="..PTLIBDIR, }) end diff --git a/src/pallene/pallenelib.lua b/src/pallene/pallenelib.lua index 6cb03050..47be4517 100644 --- a/src/pallene/pallenelib.lua +++ b/src/pallene/pallenelib.lua @@ -48,6 +48,7 @@ return [==[ /* Pallene Tracer for function call tracebacks. */ /* Look at `https://github.com/pallene-lang/pallene-tracer` for more info. */ +#define PT_IMPLEMENTATION #include #define PALLENE_UNREACHABLE __builtin_unreachable()