How to use mono method in yandex-tank

Best Python code snippet using yandex-tank

mono_configure.py

Source:mono_configure.py Github

copy

Full Screen

1import os2import os.path3import subprocess4from SCons.Script import Dir, Environment5if os.name == "nt":6 from . import mono_reg_utils as monoreg7android_arch_dirs = {8 "armv7": "armeabi-v7a",9 "arm64v8": "arm64-v8a",10 "x86": "x86",11 "x86_64": "x86_64",12}13def get_android_out_dir(env):14 return os.path.join(15 Dir("#platform/android/java/lib/libs").abspath,16 "release" if env["target"] == "release" else "debug",17 android_arch_dirs[env["android_arch"]],18 )19def find_name_in_dir_files(directory, names, prefixes=[""], extensions=[""]):20 for extension in extensions:21 if extension and not extension.startswith("."):22 extension = "." + extension23 for prefix in prefixes:24 for curname in names:25 if os.path.isfile(os.path.join(directory, prefix + curname + extension)):26 return curname27 return ""28def find_file_in_dir(directory, names, prefixes=[""], extensions=[""]):29 for extension in extensions:30 if extension and not extension.startswith("."):31 extension = "." + extension32 for prefix in prefixes:33 for curname in names:34 filename = prefix + curname + extension35 if os.path.isfile(os.path.join(directory, filename)):36 return filename37 return ""38def copy_file(src_dir, dst_dir, src_name, dst_name=""):39 from shutil import copy40 src_path = os.path.join(Dir(src_dir).abspath, src_name)41 dst_dir = Dir(dst_dir).abspath42 if not os.path.isdir(dst_dir):43 os.makedirs(dst_dir)44 if dst_name:45 copy(src_path, os.path.join(dst_dir, dst_name))46 else:47 copy(src_path, dst_dir)48def is_desktop(platform):49 return platform in ["windows", "osx", "linuxbsd", "server", "uwp", "haiku"]50def is_unix_like(platform):51 return platform in ["osx", "linuxbsd", "server", "android", "haiku", "iphone"]52def module_supports_tools_on(platform):53 return platform not in ["android", "javascript", "iphone"]54def find_wasm_src_dir(mono_root):55 hint_dirs = [56 os.path.join(mono_root, "src"),57 os.path.join(mono_root, "../src"),58 ]59 for hint_dir in hint_dirs:60 if os.path.isfile(os.path.join(hint_dir, "driver.c")):61 return hint_dir62 return ""63def configure(env, env_mono):64 bits = env["bits"]65 is_android = env["platform"] == "android"66 is_javascript = env["platform"] == "javascript"67 is_ios = env["platform"] == "iphone"68 is_ios_sim = is_ios and env["arch"] in ["x86", "x86_64"]69 tools_enabled = env["tools"]70 mono_static = env["mono_static"]71 copy_mono_root = env["copy_mono_root"]72 mono_prefix = env["mono_prefix"]73 mono_bcl = env["mono_bcl"]74 mono_lib_names = ["mono-2.0-sgen", "monosgen-2.0"]75 is_travis = os.environ.get("TRAVIS") == "true"76 if is_travis:77 # Travis CI may have a Mono version lower than 5.1278 env_mono.Append(CPPDEFINES=["NO_PENDING_EXCEPTIONS"])79 if is_android and not env["android_arch"] in android_arch_dirs:80 raise RuntimeError("This module does not support the specified 'android_arch': " + env["android_arch"])81 if tools_enabled and not module_supports_tools_on(env["platform"]):82 # TODO:83 # Android: We have to add the data directory to the apk, concretely the Api and Tools folders.84 raise RuntimeError("This module does not currently support building for this platform with tools enabled")85 if is_android and mono_static:86 # FIXME: When static linking and doing something that requires libmono-native, we get a dlopen error as 'libmono-native'87 # seems to depend on 'libmonosgen-2.0'. Could be fixed by re-directing to '__Internal' with a dllmap or in the dlopen hook.88 raise RuntimeError("Statically linking Mono is not currently supported for this platform")89 if not mono_static and (is_javascript or is_ios):90 raise RuntimeError("Dynamically linking Mono is not currently supported for this platform")91 if not mono_prefix and (os.getenv("MONO32_PREFIX") or os.getenv("MONO64_PREFIX")):92 print(93 "WARNING: The environment variables 'MONO32_PREFIX' and 'MONO64_PREFIX' are deprecated; use the"94 " 'mono_prefix' SCons parameter instead"95 )96 # Although we don't support building with tools for any platform where we currently use static AOT,97 # if these are supported in the future, we won't be using static AOT for them as that would be98 # too restrictive for the editor. These builds would probably be made to only use the interpreter.99 mono_aot_static = (is_ios and not is_ios_sim) and not env["tools"]100 # Static AOT is only supported on the root domain101 mono_single_appdomain = mono_aot_static102 if mono_single_appdomain:103 env_mono.Append(CPPDEFINES=["GD_MONO_SINGLE_APPDOMAIN"])104 if (env["tools"] or env["target"] != "release") and not mono_single_appdomain:105 env_mono.Append(CPPDEFINES=["GD_MONO_HOT_RELOAD"])106 if env["platform"] == "windows":107 mono_root = mono_prefix108 if not mono_root and os.name == "nt":109 mono_root = monoreg.find_mono_root_dir(bits)110 if not mono_root:111 raise RuntimeError(112 "Mono installation directory not found; specify one manually with the 'mono_prefix' SCons parameter"113 )114 print("Found Mono root directory: " + mono_root)115 mono_lib_path = os.path.join(mono_root, "lib")116 env.Append(LIBPATH=mono_lib_path)117 env_mono.Prepend(CPPPATH=os.path.join(mono_root, "include", "mono-2.0"))118 lib_suffixes = [".lib"]119 if not env.msvc:120 # MingW supports both '.a' and '.lib'121 lib_suffixes.insert(0, ".a")122 if mono_static:123 if env.msvc:124 mono_static_lib_name = "libmono-static-sgen"125 else:126 mono_static_lib_name = "libmonosgen-2.0"127 mono_static_lib_file = find_file_in_dir(mono_lib_path, [mono_static_lib_name], extensions=lib_suffixes)128 if not mono_static_lib_file:129 raise RuntimeError("Could not find static mono library in: " + mono_lib_path)130 if env.msvc:131 env.Append(LINKFLAGS=mono_static_lib_file)132 env.Append(LINKFLAGS="Mincore.lib")133 env.Append(LINKFLAGS="msvcrt.lib")134 env.Append(LINKFLAGS="LIBCMT.lib")135 env.Append(LINKFLAGS="Psapi.lib")136 else:137 mono_static_lib_file_path = os.path.join(mono_lib_path, mono_static_lib_file)138 env.Append(LINKFLAGS=["-Wl,-whole-archive", mono_static_lib_file_path, "-Wl,-no-whole-archive"])139 env.Append(LIBS=["psapi"])140 env.Append(LIBS=["version"])141 else:142 mono_lib_file = find_file_in_dir(mono_lib_path, mono_lib_names, extensions=lib_suffixes)143 if not mono_lib_file:144 raise RuntimeError("Could not find mono library in: " + mono_lib_path)145 if env.msvc:146 env.Append(LINKFLAGS=mono_lib_file)147 else:148 mono_lib_file_path = os.path.join(mono_lib_path, mono_lib_file)149 env.Append(LINKFLAGS=mono_lib_file_path)150 mono_bin_path = os.path.join(mono_root, "bin")151 mono_dll_file = find_file_in_dir(mono_bin_path, mono_lib_names, prefixes=["", "lib"], extensions=[".dll"])152 if not mono_dll_file:153 raise RuntimeError("Could not find mono shared library in: " + mono_bin_path)154 copy_file(mono_bin_path, "#bin", mono_dll_file)155 else:156 is_apple = env["platform"] in ["osx", "iphone"]157 is_macos = is_apple and not is_ios158 sharedlib_ext = ".dylib" if is_apple else ".so"159 mono_root = mono_prefix160 mono_lib_path = ""161 mono_so_file = ""162 if not mono_root and (is_android or is_javascript or is_ios):163 raise RuntimeError(164 "Mono installation directory not found; specify one manually with the 'mono_prefix' SCons parameter"165 )166 if not mono_root and is_macos:167 # Try with some known directories under OSX168 hint_dirs = ["/Library/Frameworks/Mono.framework/Versions/Current", "/usr/local/var/homebrew/linked/mono"]169 for hint_dir in hint_dirs:170 if os.path.isdir(hint_dir):171 mono_root = hint_dir172 break173 # We can't use pkg-config to link mono statically,174 # but we can still use it to find the mono root directory175 if not mono_root and mono_static:176 mono_root = pkgconfig_try_find_mono_root(mono_lib_names, sharedlib_ext)177 if not mono_root:178 raise RuntimeError(179 "Building with mono_static=yes, but failed to find the mono prefix with pkg-config; "180 + "specify one manually with the 'mono_prefix' SCons parameter"181 )182 if is_ios and not is_ios_sim:183 env_mono.Append(CPPDEFINES=["IOS_DEVICE"])184 if mono_root:185 print("Found Mono root directory: " + mono_root)186 mono_lib_path = os.path.join(mono_root, "lib")187 env.Append(LIBPATH=[mono_lib_path])188 env_mono.Prepend(CPPPATH=os.path.join(mono_root, "include", "mono-2.0"))189 mono_lib = find_name_in_dir_files(mono_lib_path, mono_lib_names, prefixes=["lib"], extensions=[".a"])190 if not mono_lib:191 raise RuntimeError("Could not find mono library in: " + mono_lib_path)192 env_mono.Append(CPPDEFINES=["_REENTRANT"])193 if mono_static:194 if not is_javascript:195 env.Append(LINKFLAGS=["-rdynamic"])196 mono_lib_file = os.path.join(mono_lib_path, "lib" + mono_lib + ".a")197 if is_apple:198 if is_macos:199 env.Append(LINKFLAGS=["-Wl,-force_load," + mono_lib_file])200 else:201 arch = env["arch"]202 def copy_mono_lib(libname_wo_ext):203 copy_file(204 mono_lib_path, "#bin", libname_wo_ext + ".a", "%s.iphone.%s.a" % (libname_wo_ext, arch)205 )206 # Copy Mono libraries to the output folder. These are meant to be bundled with207 # the export templates and added to the Xcode project when exporting a game.208 copy_mono_lib("lib" + mono_lib)209 copy_mono_lib("libmono-native")210 copy_mono_lib("libmono-profiler-log")211 if not is_ios_sim:212 copy_mono_lib("libmono-ee-interp")213 copy_mono_lib("libmono-icall-table")214 copy_mono_lib("libmono-ilgen")215 else:216 assert is_desktop(env["platform"]) or is_android or is_javascript217 env.Append(LINKFLAGS=["-Wl,-whole-archive", mono_lib_file, "-Wl,-no-whole-archive"])218 if is_javascript:219 env.Append(LIBS=["mono-icall-table", "mono-native", "mono-ilgen", "mono-ee-interp"])220 wasm_src_dir = os.path.join(mono_root, "src")221 if not os.path.isdir(wasm_src_dir):222 raise RuntimeError("Could not find mono wasm src directory")223 # Ideally this should be defined only for 'driver.c', but I can't fight scons for another 2 hours224 env_mono.Append(CPPDEFINES=["CORE_BINDINGS"])225 env_mono.add_source_files(226 env.modules_sources,227 [228 os.path.join(wasm_src_dir, "driver.c"),229 os.path.join(wasm_src_dir, "zlib-helper.c"),230 os.path.join(wasm_src_dir, "corebindings.c"),231 ],232 )233 env.Append(234 LINKFLAGS=[235 "--js-library",236 os.path.join(wasm_src_dir, "library_mono.js"),237 "--js-library",238 os.path.join(wasm_src_dir, "binding_support.js"),239 "--js-library",240 os.path.join(wasm_src_dir, "dotnet_support.js"),241 ]242 )243 else:244 env.Append(LIBS=[mono_lib])245 if is_macos:246 env.Append(LIBS=["iconv", "pthread"])247 elif is_android:248 pass # Nothing249 elif is_ios:250 pass # Nothing, linking is delegated to the exported Xcode project251 elif is_javascript:252 env.Append(LIBS=["m", "rt", "dl", "pthread"])253 else:254 env.Append(LIBS=["m", "rt", "dl", "pthread"])255 if not mono_static:256 mono_so_file = find_file_in_dir(257 mono_lib_path, mono_lib_names, prefixes=["lib"], extensions=[sharedlib_ext]258 )259 if not mono_so_file:260 raise RuntimeError("Could not find mono shared library in: " + mono_lib_path)261 else:262 assert not mono_static263 # TODO: Add option to force using pkg-config264 print("Mono root directory not found. Using pkg-config instead")265 env.ParseConfig("pkg-config monosgen-2 --libs")266 env_mono.ParseConfig("pkg-config monosgen-2 --cflags")267 tmpenv = Environment()268 tmpenv.AppendENVPath("PKG_CONFIG_PATH", os.getenv("PKG_CONFIG_PATH"))269 tmpenv.ParseConfig("pkg-config monosgen-2 --libs-only-L")270 for hint_dir in tmpenv["LIBPATH"]:271 file_found = find_file_in_dir(hint_dir, mono_lib_names, prefixes=["lib"], extensions=[sharedlib_ext])272 if file_found:273 mono_lib_path = hint_dir274 mono_so_file = file_found275 break276 if not mono_so_file:277 raise RuntimeError("Could not find mono shared library in: " + str(tmpenv["LIBPATH"]))278 if not mono_static:279 libs_output_dir = get_android_out_dir(env) if is_android else "#bin"280 copy_file(mono_lib_path, libs_output_dir, mono_so_file)281 if not tools_enabled:282 if is_desktop(env["platform"]):283 if not mono_root:284 mono_root = (285 subprocess.check_output(["pkg-config", "mono-2", "--variable=prefix"]).decode("utf8").strip()286 )287 make_template_dir(env, mono_root)288 elif is_android:289 # Compress Android Mono Config290 from . import make_android_mono_config291 module_dir = os.getcwd()292 config_file_path = os.path.join(module_dir, "build_scripts", "mono_android_config.xml")293 make_android_mono_config.generate_compressed_config(config_file_path, "mono_gd/")294 # Copy the required shared libraries295 copy_mono_shared_libs(env, mono_root, None)296 elif is_javascript:297 pass # No data directory for this platform298 elif is_ios:299 pass # No data directory for this platform300 if copy_mono_root:301 if not mono_root:302 mono_root = subprocess.check_output(["pkg-config", "mono-2", "--variable=prefix"]).decode("utf8").strip()303 if tools_enabled:304 # Only supported for editor builds.305 copy_mono_root_files(env, mono_root, mono_bcl)306def make_template_dir(env, mono_root):307 from shutil import rmtree308 platform = env["platform"]309 target = env["target"]310 template_dir_name = ""311 assert is_desktop(platform)312 template_dir_name = "data.mono.%s.%s.%s" % (platform, env["bits"], target)313 output_dir = Dir("#bin").abspath314 template_dir = os.path.join(output_dir, template_dir_name)315 template_mono_root_dir = os.path.join(template_dir, "Mono")316 if os.path.isdir(template_mono_root_dir):317 rmtree(template_mono_root_dir) # Clean first318 # Copy etc/mono/319 template_mono_config_dir = os.path.join(template_mono_root_dir, "etc", "mono")320 copy_mono_etc_dir(mono_root, template_mono_config_dir, platform)321 # Copy the required shared libraries322 copy_mono_shared_libs(env, mono_root, template_mono_root_dir)323def copy_mono_root_files(env, mono_root, mono_bcl):324 from glob import glob325 from shutil import copy326 from shutil import rmtree327 if not mono_root:328 raise RuntimeError("Mono installation directory not found")329 output_dir = Dir("#bin").abspath330 editor_mono_root_dir = os.path.join(output_dir, "GodotSharp", "Mono")331 if os.path.isdir(editor_mono_root_dir):332 rmtree(editor_mono_root_dir) # Clean first333 # Copy etc/mono/334 editor_mono_config_dir = os.path.join(editor_mono_root_dir, "etc", "mono")335 copy_mono_etc_dir(mono_root, editor_mono_config_dir, env["platform"])336 # Copy the required shared libraries337 copy_mono_shared_libs(env, mono_root, editor_mono_root_dir)338 # Copy framework assemblies339 mono_framework_dir = mono_bcl or os.path.join(mono_root, "lib", "mono", "4.5")340 mono_framework_facades_dir = os.path.join(mono_framework_dir, "Facades")341 editor_mono_framework_dir = os.path.join(editor_mono_root_dir, "lib", "mono", "4.5")342 editor_mono_framework_facades_dir = os.path.join(editor_mono_framework_dir, "Facades")343 if not os.path.isdir(editor_mono_framework_dir):344 os.makedirs(editor_mono_framework_dir)345 if not os.path.isdir(editor_mono_framework_facades_dir):346 os.makedirs(editor_mono_framework_facades_dir)347 for assembly in glob(os.path.join(mono_framework_dir, "*.dll")):348 copy(assembly, editor_mono_framework_dir)349 for assembly in glob(os.path.join(mono_framework_facades_dir, "*.dll")):350 copy(assembly, editor_mono_framework_facades_dir)351def copy_mono_etc_dir(mono_root, target_mono_config_dir, platform):352 from distutils.dir_util import copy_tree353 from glob import glob354 from shutil import copy355 if not os.path.isdir(target_mono_config_dir):356 os.makedirs(target_mono_config_dir)357 mono_etc_dir = os.path.join(mono_root, "etc", "mono")358 if not os.path.isdir(mono_etc_dir):359 mono_etc_dir = ""360 etc_hint_dirs = []361 if platform != "windows":362 etc_hint_dirs += ["/etc/mono", "/usr/local/etc/mono"]363 if "MONO_CFG_DIR" in os.environ:364 etc_hint_dirs += [os.path.join(os.environ["MONO_CFG_DIR"], "mono")]365 for etc_hint_dir in etc_hint_dirs:366 if os.path.isdir(etc_hint_dir):367 mono_etc_dir = etc_hint_dir368 break369 if not mono_etc_dir:370 raise RuntimeError("Mono installation etc directory not found")371 copy_tree(os.path.join(mono_etc_dir, "2.0"), os.path.join(target_mono_config_dir, "2.0"))372 copy_tree(os.path.join(mono_etc_dir, "4.0"), os.path.join(target_mono_config_dir, "4.0"))373 copy_tree(os.path.join(mono_etc_dir, "4.5"), os.path.join(target_mono_config_dir, "4.5"))374 if os.path.isdir(os.path.join(mono_etc_dir, "mconfig")):375 copy_tree(os.path.join(mono_etc_dir, "mconfig"), os.path.join(target_mono_config_dir, "mconfig"))376 for file in glob(os.path.join(mono_etc_dir, "*")):377 if os.path.isfile(file):378 copy(file, target_mono_config_dir)379def copy_mono_shared_libs(env, mono_root, target_mono_root_dir):380 from shutil import copy381 def copy_if_exists(src, dst):382 if os.path.isfile(src):383 copy(src, dst)384 platform = env["platform"]385 if platform == "windows":386 src_mono_bin_dir = os.path.join(mono_root, "bin")387 target_mono_bin_dir = os.path.join(target_mono_root_dir, "bin")388 if not os.path.isdir(target_mono_bin_dir):389 os.makedirs(target_mono_bin_dir)390 mono_posix_helper_file = find_file_in_dir(391 src_mono_bin_dir, ["MonoPosixHelper"], prefixes=["", "lib"], extensions=[".dll"]392 )393 copy(394 os.path.join(src_mono_bin_dir, mono_posix_helper_file),395 os.path.join(target_mono_bin_dir, "MonoPosixHelper.dll"),396 )397 # For newer versions398 btls_dll_path = os.path.join(src_mono_bin_dir, "libmono-btls-shared.dll")399 if os.path.isfile(btls_dll_path):400 copy(btls_dll_path, target_mono_bin_dir)401 else:402 target_mono_lib_dir = (403 get_android_out_dir(env) if platform == "android" else os.path.join(target_mono_root_dir, "lib")404 )405 if not os.path.isdir(target_mono_lib_dir):406 os.makedirs(target_mono_lib_dir)407 lib_file_names = []408 if platform == "osx":409 lib_file_names = [410 lib_name + ".dylib"411 for lib_name in ["libmono-btls-shared", "libmono-native-compat", "libMonoPosixHelper"]412 ]413 elif is_unix_like(platform):414 lib_file_names = [415 lib_name + ".so"416 for lib_name in [417 "libmono-btls-shared",418 "libmono-ee-interp",419 "libmono-native",420 "libMonoPosixHelper",421 "libmono-profiler-aot",422 "libmono-profiler-coverage",423 "libmono-profiler-log",424 "libMonoSupportW",425 ]426 ]427 for lib_file_name in lib_file_names:428 copy_if_exists(os.path.join(mono_root, "lib", lib_file_name), target_mono_lib_dir)429def pkgconfig_try_find_mono_root(mono_lib_names, sharedlib_ext):430 tmpenv = Environment()431 tmpenv.AppendENVPath("PKG_CONFIG_PATH", os.getenv("PKG_CONFIG_PATH"))432 tmpenv.ParseConfig("pkg-config monosgen-2 --libs-only-L")433 for hint_dir in tmpenv["LIBPATH"]:434 name_found = find_name_in_dir_files(hint_dir, mono_lib_names, prefixes=["lib"], extensions=[sharedlib_ext])435 if name_found and os.path.isdir(os.path.join(hint_dir, "..", "include", "mono-2.0")):436 return os.path.join(hint_dir, "..")...

Full Screen

Full Screen

mono.py

Source:mono.py Github

copy

Full Screen

1#2# Author: Zoltan Varga (vargaz@gmail.com)3# License: MIT/X114#5#6# This is a mono support mode for lldb7#8# Comments about the lldb python api:9# - there are no accessors, i.e. valobj["name"]10# - http://lldb.llvm.org/python_reference/index.html seems to be outdated11# - there is no autoload support, i.e. can't load this file automatically12# when 'mono' is the debugger target.13import lldb14# FIXME: Generate enums from runtime enums15MONO_TYPE_END = 0x0016MONO_TYPE_VOID = 0x0117MONO_TYPE_BOOLEAN = 0x0218MONO_TYPE_CHAR = 0x0319MONO_TYPE_I1 = 0x0420MONO_TYPE_U1 = 0x0521MONO_TYPE_I2 = 0x0622MONO_TYPE_U2 = 0x0723MONO_TYPE_I4 = 0x0824MONO_TYPE_U4 = 0x0925MONO_TYPE_I8 = 0x0a26MONO_TYPE_U8 = 0x0b27MONO_TYPE_R4 = 0x0c28MONO_TYPE_R8 = 0x0d29MONO_TYPE_STRING = 0x0e30MONO_TYPE_PTR = 0x0f31MONO_TYPE_BYREF = 0x1032MONO_TYPE_VALUETYPE = 0x1133MONO_TYPE_CLASS = 0x1234MONO_TYPE_VAR = 0x1335MONO_TYPE_ARRAY = 0x1436MONO_TYPE_GENERICINST= 0x1537MONO_TYPE_TYPEDBYREF = 0x1638MONO_TYPE_I = 0x1839MONO_TYPE_U = 0x1940MONO_TYPE_FNPTR = 0x1b41MONO_TYPE_OBJECT = 0x1c42MONO_TYPE_SZARRAY = 0x1d43MONO_TYPE_MVAR = 0x1e44primitive_type_names = {45 MONO_TYPE_BOOLEAN : "bool",46 MONO_TYPE_CHAR : "char",47 MONO_TYPE_I1 : "sbyte",48 MONO_TYPE_U1 : "byte",49 MONO_TYPE_I2 : "short",50 MONO_TYPE_U2 : "ushort",51 MONO_TYPE_I4 : "int",52 MONO_TYPE_U4 : "uint",53 MONO_TYPE_I8 : "long",54 MONO_TYPE_U8 : "ulong",55 MONO_TYPE_R4 : "float",56 MONO_TYPE_R8 : "double",57 MONO_TYPE_STRING : "string"58 }59#60# Helper functions for working with the lldb python api61#62def member(val, member_name):63 return val.GetChildMemberWithName (member_name)64def string_member(val, member_name):65 return val.GetChildMemberWithName (member_name).GetSummary ()[1:-1]66def isnull(val):67 return val.deref.addr.GetOffset () == 068def stringify_class_name(ns, name):69 if ns == "System":70 if name == "Byte":71 return "byte"72 if name == "String":73 return "string"74 if ns == "":75 return name76 else:77 return "{0}.{1}".format (ns, name)78#79# Pretty printers for mono runtime types80#81def stringify_type (type):82 "Print a MonoType structure"83 ttype = member(type, "type").GetValueAsUnsigned()84 if primitive_type_names.has_key (ttype):85 return primitive_type_names [ttype]86 else:87 return "<MonoTypeEnum 0x{0:x}>".format (ttype)88def stringify_ginst (ginst):89 "Print a MonoGenericInst structure"90 len = int(member(ginst, "type_argc").GetValue())91 argv = member(ginst, "type_argv")92 res=""93 for i in range(len):94 t = argv.GetChildAtIndex(i, False, True)95 if i > 0:96 res += ", "97 res += stringify_type(t)98 return res99def print_type(valobj, internal_dict):100 type = valobj101 if isnull (type):102 return ""103 return stringify_type (type)104def print_class (valobj, internal_dict):105 klass = valobj106 if isnull (klass):107 return ""108 aname = member (member (member (klass, "image"), "assembly"), "aname")109 basename = "[{0}]{1}".format (string_member (aname, "name"), (stringify_class_name (string_member (klass, "name_space"), string_member (klass, "name"))))110 gclass = member (klass, "generic_class")111 if not isnull (gclass):112 ginst = member (member (gclass, "context"), "class_inst")113 return "{0}<{1}>".format (basename, stringify_ginst (ginst))114 return basename115def print_method (valobj, internal_dict):116 method = valobj117 if isnull (method):118 return ""119 klass = member (method, "klass")120 return "{0}:{1}()".format (print_class (klass, None), string_member (valobj, "name"))121def print_domain(valobj, internal_dict):122 domain = valobj123 if isnull (domain):124 return ""125 target = domain.target126 root = target.FindFirstGlobalVariable("mono_root_domain")127 name = string_member (domain, "friendly_name")128 if root.IsValid () and root.deref.addr.GetOffset () == root.deref.addr.GetOffset ():129 return "[root]"130 else:131 return "[{0}]".format (name)132def print_object(valobj, internal_dict):133 obj = valobj134 if isnull (obj):135 return ""136 domain = member (member (obj, "vtable"), "domain")137 klass = member (member (obj, "vtable"), "klass")138 return print_domain (domain, None) + print_class (klass, None)139# Register pretty printers140# FIXME: This cannot pick up the methods define in this module, leading to warnings141lldb.debugger.HandleCommand ("type summary add -w mono -F mono.print_method MonoMethod")142lldb.debugger.HandleCommand ("type summary add -w mono -F mono.print_class MonoClass")143lldb.debugger.HandleCommand ("type summary add -w mono -F mono.print_type MonoType")144lldb.debugger.HandleCommand ("type summary add -w mono -F mono.print_domain MonoDomain")145lldb.debugger.HandleCommand ("type summary add -w mono -F mono.print_object MonoObject")146lldb.debugger.HandleCommand ("type category enable mono")147# Helper commands for runtime debugging148# These resume the target149# Print the method at the current ip150lldb.debugger.HandleCommand ("command alias pip p mono_print_method_from_ip((void*)$pc)")151# Print the method at the provided ip152lldb.debugger.HandleCommand ("command regex pmip 's/^$/p mono_print_method_from_ip((void*)$pc)/' 's/(.+)/p mono_print_method_from_ip((void*)(%1))/'")...

Full Screen

Full Screen

SCsub

Source:SCsub Github

copy

Full Screen

1#!/usr/bin/env python2import build_scripts.mono_configure as mono_configure3Import("env")4Import("env_modules")5env_mono = env_modules.Clone()6if env_mono["tools"]:7 # NOTE: It is safe to generate this file here, since this is still executed serially8 import build_scripts.gen_cs_glue_version as gen_cs_glue_version9 gen_cs_glue_version.generate_header("glue/GodotSharp", "glue/cs_glue_version.gen.h")10# Glue sources11if env_mono["mono_glue"]:12 env_mono.Append(CPPDEFINES=["MONO_GLUE_ENABLED"])13 import os.path14 if not os.path.isfile("glue/mono_glue.gen.cpp"):15 raise RuntimeError("Mono glue sources not found. Did you forget to run '--generate-mono-glue'?")16if env_mono["tools"] or env_mono["target"] != "release":17 env_mono.Append(CPPDEFINES=["GD_MONO_HOT_RELOAD"])18# Configure Mono19mono_configure.configure(env, env_mono)20if env_mono["tools"] and env_mono["mono_glue"] and env_mono["build_cil"]:21 # Build Godot API solution22 import build_scripts.api_solution_build as api_solution_build23 api_sln_cmd = api_solution_build.build(env_mono)24 # Build GodotTools25 import build_scripts.godot_tools_build as godot_tools_build26 godot_tools_build.build(env_mono, api_sln_cmd)27 # Build Godot.NET.Sdk28 import build_scripts.godot_net_sdk_build as godot_net_sdk_build29 godot_net_sdk_build.build(env_mono)30# Add sources31env_mono.add_source_files(env.modules_sources, "*.cpp")32env_mono.add_source_files(env.modules_sources, "glue/*.cpp")33env_mono.add_source_files(env.modules_sources, "mono_gd/*.cpp")34env_mono.add_source_files(env.modules_sources, "utils/*.cpp")35env_mono.add_source_files(env.modules_sources, "mono_gd/support/*.cpp")36if env["platform"] in ["osx", "iphone"]:37 env_mono.add_source_files(env.modules_sources, "mono_gd/support/*.mm")38 env_mono.add_source_files(env.modules_sources, "mono_gd/support/*.m")39if env["tools"]:...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run yandex-tank automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful