@@ -48,6 +48,15 @@ local function dump_traceback(msg)
4848 io.stderr :write (debug.traceback (msg , 2 ), " \n " )
4949end
5050
51+ local function wrap_traceback (f )
52+ return function (...)
53+ local ret = {xpcall (f , dump_traceback , ... )}
54+ local success = table.remove (ret , 1 )
55+ if not success then return C .UBASE_ERR_UNKNOWN end
56+ return unpack (ret )
57+ end
58+ end
59+
5160local props = { }
5261
5362local function props_key (ptr )
@@ -208,7 +217,8 @@ uprobe = setmetatable({ }, {
208217 return ret
209218 end
210219 end
211- return uprobe_alloc (uprobe_throw , ffi .cast (" struct uprobe *" , nil ))
220+ local uprobe_throw_tb = wrap_traceback (uprobe_throw )
221+ return uprobe_alloc (uprobe_throw_tb , ffi .cast (" struct uprobe *" , nil ))
212222 end ,
213223 __index = function (_ , key )
214224 local sym = fmt (" uprobe_%s_alloc" , key )
@@ -631,15 +641,6 @@ local function upipe_helper_alloc(cb)
631641 return pipe :use ()
632642 end
633643
634- local function wrap_traceback (f )
635- return function (...)
636- local ret = {xpcall (f , dump_traceback , ... )}
637- local success = table.remove (ret , 1 )
638- if not success then return C .UBASE_ERR_UNKNOWN end
639- return unpack (ret )
640- end
641- end
642-
643644 if cb .input_output then
644645 mgr .upipe_input = function (pipe , ref , pump_p )
645646 if not C .upipe_helper_check_input (pipe ) then
0 commit comments