@@ -51,8 +51,9 @@ function _M.gdb_inject(pid, entry, injectdll, gdb_path)
5151
5252 local launcher = {
5353 " -ex" ,
54- -- 6 = RTDL_NOW|RTDL_LOCAL
55- (' print (void*)dlopen("%s", 6)' ):format (injectdll ),
54+ -- 6 = RTDL_NOW|RTDL_LOCAL macos
55+ -- 2 = RTDL_NOW linux
56+ (' print (void*)dlopen("%s", %d)' ):format (injectdll , platform_os == macos and 6 or 2 ),
5657 " -ex" ,
5758 (' call ((void(*)())&%s)()' ):format (entry ),
5859 " -ex" ,
@@ -93,8 +94,9 @@ function _M.lldb_inject(pid, entry, injectdll, lldb_path)
9394
9495 local launcher = {
9596 " -o" ,
96- -- 6 = RTDL_NOW|RTDL_LOCAL
97- (' expression (void*)dlopen("%s", 6)' ):format (injectdll ),
97+ -- 6 = RTDL_NOW|RTDL_LOCAL macos
98+ -- 2 = RTDL_NOW linux
99+ (' expression (void*)dlopen("%s", %d)' ):format (injectdll , platform_os == macos and 6 or 2 ),
98100 " -o" ,
99101 (' expression ((void(*)())&%s)()' ):format (entry ),
100102 " -o" ,
@@ -153,9 +155,6 @@ function _M.windows_inject(process, entry)
153155end
154156
155157function _M .inject (process , entry , args )
156- if platform_os ~= windows and platform_os ~= macos then
157- return false , " unsupported inject"
158- end
159158 if platform_os ~= windows and type (process ) == " userdata" then
160159 process = process :get_id ()
161160 end
0 commit comments