Fixed LLDB.Debugger instance creation in ScriptInterpreterMono::InitializeMono.

This commit is contained in:
Joao Matos 2016-06-13 16:13:04 +01:00
Родитель 0d28498476
Коммит 3fd9d1c23c
1 изменённых файлов: 7 добавлений и 14 удалений

Просмотреть файл

@ -72,31 +72,24 @@ void ScriptInterpreterMono::InitializeMono()
"error: could not find LLDB.Debugger class in assembly.\n");
}
//lldbDebuggerInstance = mono_object_new(monoDomain, lldbDebuggerClass);
//mono_runtime_object_init(lldbDebuggerInstance);
// Find the C++# generated __CreateInstance method.
auto method = std::string(mono_class_get_namespace(lldbDebuggerClass)) + "."
+ std::string(mono_class_get_name(lldbDebuggerClass)) + ":"
+ std::string("__CreateInstance") + "(intptr,bool)";
MonoMethodDesc* desc = mono_method_desc_new(method.c_str(), true);
const char method[] = "LLDB.Debugger:__CreateInstance(intptr,bool)";
MonoMethodDesc* desc = mono_method_desc_new(method, /*include_namespace=*/true);
MonoMethod* lldbDebuggerCreateInstanceMethod =
mono_method_desc_search_in_class(desc, lldbDebuggerClass);
mono_method_desc_free(desc);
void* args[2];
// Setup the parameters to pass.
// static Debugger __CreateInstance(global::System.IntPtr native, bool skipVTables = false)
Debugger &debugger = GetCommandInterpreter().GetDebugger();
args[0] = &debugger;
args[1] = 0;
bool skipVTables = false;
void *args[] = { &debugger, &skipVTables };
// Create an instance of LLDB.Debugger with the SBDebugger instance from LLDB.
MonoObject *result;
mono_runtime_invoke(lldbDebuggerCreateInstanceMethod, &result, args, nullptr);
lldbDebuggerInstance = result;
}
void ScriptInterpreterMono::ShutdownMono()